Re: Sox recording to null of an audio loopback?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2016-08-24 08:49, JamesH wrote:
> Aloha from Hawaii!
> 
> I'm using a Raspberry Pi and am trying to make an alarm kinda thing...
> 
> What I need to figure out how to do, and what I'm looking for help with 
> is
> to figure out how to make sox (using the rec command I believe) record 
> into
> a null file (meaning it doesn't really record, just goes through the
> motions) until there's 5 seconds of silence...
> 
> Being that the Raspberry Pi doesn't have any kind of audio capture 
> setup, I
> was able to run a command that brought up a loopback audio device (that
> command is "sudo modprobe snd-aloop")
> 
> Now, how can I give sox a command to record from the loopback until 
> there's
> 5 seconds of audio, or should I be looking at a different way of 
> checking if
> the audio output of the raspberry pi has no sound?

I think you might need to use sox to record to a real (or null) file & 
use the stat
or stats effect to get output telling you what the peak sound level was 
in that five
second period.  Your alarm process would need to read the output of 
stat/stats to
see whether the silence you want to find had occurred.   I'm not sure 
how you limit
sox so that it only produces a 5-second recording.

If you needed, say, 1 second granularity you'd need to start five such 
processes at
one second intervals so each one would look at a different (overlapping) 
5-second
period.  That might also not be possible, for all I know.

If you're unable to overlap 5-second periods you could do one-second 
analyses of sound
levels and have a separate process that repeatedly looks at the last 
five such levels.


-- 
Jeremy Nicoll - my opinions are my own

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux