[linux-audio-user] Generating x frames of silence wav.

Alex Polite notmyprivateemail at gmail.com
Wed May 31 15:45:36 EDT 2006


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



More information about the Linux-audio-user mailing list