[LAU] Realtime sound level measurement with logging

Maurizio Berti maurizio.berti at gmail.com
Sat May 13 02:33:22 UTC 2017

Hi Jonathan,
I found your request actually interesting to play with.
If you use jack, I made a little python script, which only requires you to
download and compile a small program, jack-peak, that Robin Gaerus wrote a
couple of years ago.
You can find it here: http://gareus.org/gitweb/?p=jack-peak.git;a=tree
Just download the tar or zip file, unpack it and type make. It might give
you some erros, but don't worry: if a "jack-peak" file (without any
extension) is created, it means that the build process was successful.
Then, just use the attached "meter.py" script, put it anywere you want,
then copy that jack-peak compiled file in the same path, then run

./meter.py -c 1

this will just create a single input port, without jack connection, and
will print the output at the default delay rate (100ms).
For example, this command line will record the value every second, connect
to the first system audio input and save the data to the file "peaks.txt"
./meter.py -d 1000 -f peaks.txt system:capture_1

By default, the value is a float linear (3 digits after decimal point),
from 0 to 1, you can use a custom integer scale, eg from 0 to 1000.
To stop recording, just hit ctrl+c.

For more options, look at the help documentation:
./meter.py -h

I'm actually thinking about converting it to a pure python script, by
including jack-python bindings and supporting alsa too, but right now I'm
in the middle of another project and I don't have much time for that right
Anyway, let me know if this suits your needs.

PS: Robin's program can be used even without this script, but you need to
forward its output to a file and then parse every line, since it just
rewrites the lines everytime the data is analyzed, which results in an
unreadable output or file.


2017-05-12 11:47 GMT+02:00 Jonathan Gazeley <Jonathan.Gazeley at bristol.ac.uk>

> Hi folks,
> I'd like to set up sound level monitoring for my office, with periodic
> logging. I have a handheld meter but I'm really looking for a way to use a
> traditional condenser microphone and USB audio interface to measure the
> level with some kind of windowing, and log it periodically to a file (maybe
> once per minute). Is there a decent application that can monitor and log
> data in this way?
> I'm also open to the idea of just recording a WAV file over 24 hours and
> doing the analysis afterwards, with periodic readings from the file.
> Is my approach reasonable, to set up a microphone and use the gain knob to
> calibrate it against the handheld meter?
> I don't need amazing accuracy. We've just moved into a large open-plan
> office for the first time and it is very noisy (handheld meter says about
> 50dB of air handling noise measured at my desk, rising to 60dB when there
> is background talking). I want to monitor sound levels throughout the day
> to test my theory that people are more noisy in the afternoon, and to get
> an overnight control reading with the people gone and only the air handling
> and computers running.
> Thanks,
> Jonathan
> --
> Jonathan Gazeley
> Senior Systems Administrator
> IT Services
> University of Bristol
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user at lists.linuxaudio.org
> http://lists.linuxaudio.org/listinfo/linux-audio-user

È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-user/attachments/20170513/03bb8c0e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: meter.py
Type: text/x-python
Size: 3286 bytes
Desc: not available
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-user/attachments/20170513/03bb8c0e/attachment.py>

More information about the Linux-audio-user mailing list