Created
January 22, 2020 15:59
-
-
Save talhanai/0fe1df8280ca4ed39bcff3e62c91e82b to your computer and use it in GitHub Desktop.
bash script to downsample audio file
This file contains hidden or 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
| #!/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