montage/merge/combine audio/sfx in bash using sox

OpenGameArt currently requires a preview to be uploaded for audio submissions that consist of more than one audio file. I have been using

sox *wav preview.mp3

but this does not work when the input files have different channel amounts or rates. I wrote a simple bash script to handle ‘complicated’ cases:


DATE="$(date +%Y%m%d@%H%M%S)"

# Unify!
for i in $*
sox "$i" -c 2 -r 44100 "$i-tmp.wav" pad .1@0

# Montage!
sox *-tmp.wav $NAME pad 0 .1

# Delete!
for i in $*
rm "$i-tmp.wav"

I call it montage-audio in honor of imagemagick’s montage, which makes making image preview fun! :D

Download the .sh and use it like this:

./ *wav

This entry was posted in qubodup and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s