Skip to content

Instantly share code, notes, and snippets.

@talhanai
Created January 22, 2020 15:59
Show Gist options
  • Select an option

  • Save talhanai/0fe1df8280ca4ed39bcff3e62c91e82b to your computer and use it in GitHub Desktop.

Select an option

Save talhanai/0fe1df8280ca4ed39bcff3e62c91e82b to your computer and use it in GitHub Desktop.
bash script to downsample audio file
#!/bin/bash
# generate list of wav files
find "/usr/users/tuka/fram/sessions-audio-did/audio/wav" -mindepth 1 -maxdepth 1 > file.wav.list
outputdir=/usr/users/tuka/fram/sessions-audio-did/audio/wav_8K
mkdir $outputdir
# clean executable script
rm run.ctl
echo "#!/bin/bash" >> run.ctl
# read list of audio files
while read line;do
# grab the name
id=`basename "$line" | cut -d"." -f1`
# create command and write it to executable file
echo sox \"$line\" \"${outputdir}/${id}.wav\" channels 1 rate 8k >> run.ctl
done < file.wav.list
# downsample files
./run.ctl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment