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

From: Alex Polite <notmyprivateemail@email-addr-hidden>
Date: Wed May 31 2006 - 22:45:36 EEST

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
Received on Thu Jun 1 04:15:02 2006

This archive was generated by hypermail 2.1.8 : Thu Jun 01 2006 - 04:15:02 EEST