[linux-audio-user] seeking simple library to detect sound volume
S.W.Harris at ecs.soton.ac.uk
Wed Jun 1 05:53:53 EDT 2005
On Tue, May 31, 2005 at 10:45:34AM +0000, michael at michaelshiloh.com wrote:
> I've been looking on the web, and have visited the excellent resource
> linux-sound.org, and am a bit overwhelmed as there are so many choices,
> most much more elaborate than I need.
> What I need is the ability to monitor sound going from the computer out
> to my sound card, and to report when the volume exceeds a certain
> threshold. I need no graphic capability and as I will be writing my own
> application around this I prefer as simple and straightforward a library
> as possible. In fact I don't even need a library - a C function would be
> Extra features that would be nice, but not critical, would be the
> ability to have one or more filters so that I could report on the volume
> in various frequency ranges.
> Do any of you have any suggestions for me?
Its not documented *cough*, but its pretty straightforward, just call
rms_env_new() to create a new object for each channel, and
rms_env_process() for every incoming sample (y), the rest should be
NB its not the fastest way to calculate RMS (root mean squared) amplitude
values, there is a filter network that will approximate it much more
efficiently, but I dont have the filter code factored out like that.
If you need filters, there is a biquad implementation at
http://plugin.org.uk/ladspa-swh/util/biquad.h but thats a bit more
More information about the linux-audio-user