sample rate

It seems there should be an easy way to do this but I can’t find it. I’d like to go to 48k because that is what may wav files are at from other apps. btw, to the reader do you use jack as a time master, or keep ardour set to internal? thanks I excited to get into the program.
Chris

It uses the sample rate that JACK is using.

I have a little shell script using the program ‘sndfile-resample’ which resample wav files. The ‘sndfile-resample’ program belongs to a suite of programs included in a package called ‘samplerate-programs’ (at least in debian based distros). So if you have such a debian based system, make sure you ‘apt-get install samplerate-programs’ beforehand. Then, open a terminal, open a file called e.g. resample-wav.sh with your favorite text editor (I personaly use emacs) and add the following :

#!/bin/sh

newrate=96000
if [ ! -z “$1” ]; then
newrate=$1
fi

echo " Will resample to new rate ‘$newrate’"

for fname in ls -1; do
wav_file=file $fname | grep "WAVE audio"
if [ -z “$wav_file” ]; then
echo “’$fname’ is NOT a wav file, skipping …”
else
mv $fname $fname.old && sndfile-resample -to $newrate -c 0 $fname.old $fname && rm $fname.old
fi
done

I have a default newrate of 96000. You can change this if you want or invoke the script with your preferred rate (see below). Anyway, make that script executable :

chmod +x resample-wav.sh

move it to your $PATH :

mkdir ~/bin mv resample-wav.sh ~/bin

or

sudo mv resample-wav.sh /usr/local/bin

go to a directory where you have wav files to resample and call the script from the terminal

cd directory-where-i-have-wav-files-to-be-resampled resample-wav.sh (or 'resample-wav.sh 48000' if 48000 is not the default in the script)

There are of course cases when this will fail if the filenames have spaces. As an old time unix user, I don’t put spaces in my filenames. So beware :slight_smile:
Moreover, the command line argument (new sample rate) is not checked thoroughly in the script. If you type a garbage string, I don’t know what’s gonna happen :wink:

Hope this helps.