Last active
June 13, 2020 09:48
-
-
Save sroccaserra/513266a5cfe51ac95d7c3bcbce17763e to your computer and use it in GitHub Desktop.
Convert wave files to 44100 kHz with SoX (useful for 44100 kHz only samplers like the Octatrack)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Note: requires bash 4.4+ for `readarray -d` | |
# Note: requires SoX - http://sox.sourceforge.net/ | |
set -e | |
back="${PWD}" | |
function convert_samples_in_dir { | |
local outdir="../${1}_44100" | |
mkdir -p "$outdir" | |
for file in *.wav | |
do | |
sox "$file" -r 44100 -V3 "$outdir/$file" | |
done | |
} | |
readarray -d '' array < <(find . -type d -print0) | |
unset "array[0]" | |
for dir in "${array[@]}" | |
do | |
cd "$dir" | |
convert_samples_in_dir "${PWD##*/}" | |
cd "$back" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment