create a raw file with silence. for example 1 second, 16 bit mono at 44100 Hz: dd if=/dev/zero of=silence.raw bs=44100 count=2 and convert it to wav: sox -t raw -r 44100 -s -w -c 1 silence.wav On Wed, 31 May 2006, Alex Polite wrote:
I need to programatically pad a wav file with x frames of silence. I figure the best way of doing is to generate a wav file containing x frames of silence and concatenate the generated file with the original. Problem is I don't know how to generate the silence. The method I'm using now feels kind of backwards. I generate two sine waves that are phase shifted in relation to one another and then I mix them so that they cancel one another out. sox -t nul /dev/null /tmp/tmp1.wav synth $secs sine create 1 0 0 sox -t nul /dev/null /tmp/tmp2.wav synth $secs sine create 1 0 50 soxmix /tmp/tmp1.wav /tmp/tmp2.wav /tmp/tmp3.wav sox /tmp/tmp3.wav -r 8000 /tmp/silence.wav I guess there's a more elegant way of doing obtaining the same result? I'd also like to be able to specify the amount of silence to be generated in frames rather than in seconds. -- Alex Polite http://flosspick.org - finding the right open source