Script for resampling a DrumGizmo kit

Hi all, some months ago I discovered that exists a DrumGizmo kit for Tchackpoum DrumSamples because @cjoke mentioned it in this forum here:

I was curious, so I searched it on the internet and I found the download link here: https://forum.cockos.com/showthread.php?p=2263382

Since it is sampled to 44.1kHz and I usually record at 48kHz, I had to enable the “Resampling” option in DrumGizmo. However, I realized that DrumGizmo reported 144 samples of latency, so Ardour had to compensate it with 3ms. So, I though it might be a good idea to convert the samples from the drumkit to 48kHz, so DrumGizmo would not have to do any resampling, resulting in less CPU usage and less latency.

I started to play with some bash commands for resampling .wav files with sox, and I ended up with an script for resampling DrumGizmo kits. So, here it is, but before the disclaimer:

  • I have only tested it for resampling the Tchackpoum up to 48kHz and loaded it on Ardour 6.3, and it worked.
  • The script does some file copying, create directories, and process audio files (using sox), so it should not damage anything, but of course, if you run it on your machine, I am not responsible of undesired side effects :slight_smile:

How to use it?
This is the command syntax:
dg_resample.sh [-h|-v] INPUT_DIR OUTPUT_DIR [SAMPLE_RATE]

Where INPUT_DIR parameter is the directory of the DrumGizmo kit to be converted. OUTPUT_DIR parameter is the directory where the conversion is going to be saved. Optional SAMPLE_RATE parameter specifies the sample rate (default is 48000). -v parameter will made the script print what it is doing.

Example call:
$ ./dg_resample.sh -v tchackpoum_drumgizmo_12 t48k 48000

It will issue an error if the number of parameters is wrong, the input directory does not exist, or if the output directory exist (for not messing data from existing dirctories). For more info about invocation, run:
$ ./dg_resample.sh -h

How it works?
You need bash (quite common) and sox installed (see your distro package manager). After running it with correct parameters it will perform follow actions:

  • Replicate the folder structure of the input drumkit.
  • Copy all non-wav files to that new folder structure.
  • Resample .wav files (and save them in the new folder sctructure. It uses sox’s paramters rate -v -s -L
  • Modify XML files that contain a <drumkit> XML element, for adding (or changing) a samplerate attribute.
3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.