2

I setup a nice utility to log and record scanner radio traffic and then remove silence using SOX. To record continuously I keep calling SOX with silence detection:

function dosox() {
/usr/bin/sox -t alsa -D "plughw:2,0" $DATE.wav silence 1 0.1 2% 1 1.0 2%
 dosox  
}
dosox

This works very well for ALSA sound devices. However I now would like to get the stream from a url. I use the URL source like:

function dosox() {
/usr/bin/sox -t mp3 $CHAN_URL $DATE.wav silence 1 1.0 2% 1 2.0 2%   
 dosox  
}
dosox

With the stream SOX seems to generate many audio output files quickly. Many of these files are near duplicates. (They contain the same transmission). I think SOX is out running the stream cache and considering this the end of the file, then terminating. Then when SOX is called the next time it grabs the same stream which apparently can be of audio which was already streamed.

Assuming this is what is going on, I am looking for an easy way to have SOX exit on actual silence on the stream, but wait a bit when it thinks it got to the end of the stream for more audio. Things I tried:

-Used mplayer to stream to a fifo and read that in with SOX.

-Tried to adjust the silence settings of the SOX silence effect.

Here is an example stream

  • I don't know about the silence effect, but the voice activity detection effect (vad) seems to work. – Thor Sep 1 '16 at 6:57
  • SOX continues to impress me with its seemingly endless features - didn't even know vad existed, thanks! – Tycon Sep 1 '16 at 14:26
  • @Thor , could you provide an example? There is not much in the way of vad examples. I am also reading vad can be used to start recording, but not end it. – Tycon Sep 2 '16 at 13:54
  • I fetched a bit of the stream to out.mp3 and played it back with: play out.mp3 vad and play out.mp3 norm vad. – Thor Sep 3 '16 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.