Skip to content

Instantly share code, notes, and snippets.

@pwenzel
Last active January 2, 2023 15:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwenzel/f0b7589fd548c3ec4aad2842eb8d66b7 to your computer and use it in GitHub Desktop.
Save pwenzel/f0b7589fd548c3ec4aad2842eb8d66b7 to your computer and use it in GitHub Desktop.
FFMPEG Convert Wave to Mono Raw Audio for Radio Music Eurorack Module. Test playback with ffplay.
# Bulk convert wave to mono raw audio for Radio Music Eurorack module
# Uses FFMPEG and Fish Shell
for file in *.wav;
set basename (string match -r "(.*)\.[^\.]*\$" $file)[2]
ffmpeg -i $file -f s16le -acodec pcm_s16le -ac 1 $basename.raw;
end;
# play raw file with ffmpeg, loop it 4 times, and exit. Disable display.
ffplay -f s16le -ar 44.1k -ac 1 -nodisp -autoexit -loop 4 example.raw
# play raw file with ffmpeg, loop it 4 times, and exit. Include display.
ffplay -f s16le -ar 44.1k -ac 1 -autoexit -loop 4 example.raw
# Bulk play all raw files
# Uses ffplay (part of FFMPEG) and Fish Shell
# https://lynxbee.com/how-to-play-raw-pcm-voice-audio-files-using-ffplay-on-ubuntu/
# https://ffmpeg.org/ffplay.html
for file in *.raw;
ffplay -f s16le -ar 44.1k -ac 1 -nodisp -autoexit $file;
end;
# https://stackoverflow.com/a/37826687
num=0; for i in *; do mv "$i" "$(printf '%04d' $num).${i#*.}"; ((num++)); done
# https://github.com/TomWhitwell/RadioMusic/wiki/SD-Card%3A-Format-and-File-Structure
# https://stackoverflow.com/questions/4854513/can-ffmpeg-convert-audio-to-raw-pcm-if-so-how
# https://trac.ffmpeg.org/wiki/AudioChannelManipulation
ffmpeg -i Break1.wav -f s16le -acodec pcm_s16le -ac 1 Break1_mono.raw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment