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

From: <mdeboer@email-addr-hidden>
Date: Wed May 31 2006 - 23:30:11 EEST

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
>
>
>
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