Last active
March 3, 2021 10:40
-
-
Save nattog/2c8588d48dca1f15fb9fe120395f5f1b to your computer and use it in GitHub Desktop.
audio cli tools and compositions
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
-- ffmpeg batch convert mp3 to 128k mp3 | |
for i in *.mp3; do ffmpeg -i "$i" -codec:a libmp3lame -b:a 128k "${i%.*}128.mp3"; done | |
-- ffmpeg batch convert audio files from flac to wav | |
for i in *.flac; do ffmpeg -i "$i" "${i%.*}.wav"; done | |
-- batch convert aiff to wav with sox | |
find -E . -maxdepth 1 -iregex '.*\.(aif|aiff)' -exec bash -c '$0 "$1" "${1%.*}.wav"' sox {} \; | |
-- ffmpeg john cage 4'33 | |
ffmpeg -f lavfi -i anullsrc=r=44100:cl=stereo -t 273 -q:a 9 -acodec libmp3lame johncage.mp3 | |
-- sox batch convert audio files in subdirectories to 44.1khz and add headroom, and store in new directory mirroring directory structure | |
-- useful for preparing samples for hardware samplers not supporting frequencies > 44.1khz | |
baseDir="${PWD##*/}_44100" && mkdir ../"$baseDir" && for d in */ ; do | |
(cd "$d" && mkdir converted && for i in *.{wav,aif}; do sox "$i" converted/"${i%.*}.wav" gain -3 rate -L -s 44100; done && mv converted ../../"$baseDir"/"${PWD##*/}"); | |
done | |
-- like above batch convert but just for files in current directory | |
mkdir ../"${PWD##*/}_44100" && for i in *.{wav,aif}; do sox "$i" ../"${PWD##*/}_44100"/"${i%.*}.wav" gain -3 rate -L -s 44100; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment