SoX (Sound eXchange)
Revision as of 16:48, 9 November 2005 by 161.253.47.104 (talk)
SoX (Sound eXchange) is a GPL command-line sound processor available from http://sox.sourceforge.net/.
I haven't used it yet, but I wanted to start taking notes on it; it may become useful for writing sound scripts. :-)
boutell.com scripts
Concatenating two .wav files
This is from http://www.boutell.com/scripts/catwav.html.
#!/bin/sh sox $1 -r 44100 -c 2 -s -w /tmp/$$-1.raw sox $2 -r 44100 -c 2 -s -w /tmp/$$-2.raw cat /tmp/$$-1.raw /tmp/$$-2.raw > /tmp/$$.raw sox -r 44100 -c 2 -s -w /tmp/$$.raw $3 rm /tmp/$$*.raw
Generating silence
This is from http://www.boutell.com/scripts/silence.html. Even though I like Perl a whole lot, I'd probably be inclined to just dd from /dev/null and sox it as a raw file.
#!/usr/bin/perl $seconds = $ARGV[0]; $file = $ARGV[1]; if ((!$seconds) || ($file eq "")) { die "Usage: silence seconds newfilename.wav\n"; } open(OUT, ">/tmp/$$.dat"); print OUT "; SampleRate 8000\n"; $samples = $seconds * 8000; for ($i = 0; ($i < $samples); $i++) { print OUT $i / 8000, "\t0\n"; } close(OUT); system("sox /tmp/$$.dat -b -r 44100 -c 2 -s -w $file"); unlink("/tmp/$$.dat");