[LAU] How to remove buffering silence from wav files

Kjetil S. Matheussen k.s.matheussen at notam02.no
Sun May 30 13:32:01 UTC 2010


Nigel Henry:
>
> Big problem for dialup users since BBC stopped realmedia streams.
>
> Listening to BBC radio on dialup is now hopeless as both the BBC's iplayer
> (flash), and wm streams need all the dialup bandwidth plus more (48kbps), so
> what I'm doing is recording the programmes, and hope to remove the silent
> buffering sections after which I can listen to them in the normal manner.
>
> Removing the silent bits manually, in mhwaveedit for example is going to take
> forever, so the question is, does anyone know of anything that would
> accomplish this automatically?  I can think of 2 options as below, but how to
> accomplish them.
>
> 1: Some way of doing these recordings where the recording device will pause
> for the buffering silences, then continue when the speech starts again.
> Obviously it wouldn't want to stop for speech pauses, but these are not
> completely silent as are the buffering silences. I'm using qarecord at the
> moment for the recordings.
>
> 2: Some program to run the recorded wav files through, which would remove the
> buffering silence sections.
>

If you load your file into Snd, it should work to paste the following 
lines into the terminal Snd was started from:

(let loop ((x 0)
            (x0 -1))
   (let ((y (sample x)))
     (cond ((and (= x0 -1)
                 (= y 0))
            (loop (1+ x)
                  x))
           ((and (not (= x0 -1))
                 (not (= y 0))
                 (> (- x x0) 32))
            (display "deleting")(display x0)(display " -> ")(display x)(newline)
            (let loop ((ch 0))
              (cond ((< ch (channels))
                     (delete-samples x0 (- x x0) (selected-sound) ch)
                     (loop (1+ ch)))))
            (loop x0 -1))
           ((and (not (= x0 -1))
                 (not (= y 0)))
            (loop (1+ x) -1))
           ((< x (frames))
            (loop (1+ x) x0)))))


You might want to adjust the number 32 (minimum number of zero-frames to 
yield a deletion), but I think 32 should work fine.



More information about the Linux-audio-user mailing list