Analog VU meter developed using the PulseAudio library, using a Python wrapper of the original C library. Composed by one node, vumeter_node, explained below.
To fix all dependencies run the install.sh script in /scripts first.
roslaunch rospypavumeter levels_monitor.launch
PulseAudio allows any sound sink to be monitored. The PulseAudio API is asynchronous and callback based, and the documentation is primarly just an API reference. To help with volume meter style applications, PulseAudio even allows you to ask for peak level measurements, which means you can sample the monitor sink at a low frequency, with low CPU utilisation, but still get useful values. When this feature is used, each sample read indicates the peak level since the last sample.
This program is designed to detect whatever sink is active in any moment in a dynamic manner, instead of previous implementations which have this parameter harcoded, and read the stream of audio coming from it, publishing the detected peaks through ROS.
audio_level
(std_msgs/UInt8):
Integer with the value of the peak received from the sink.
~meter_rate
(int, default: 5):
Rate of audio checks.
~display_scale
(int, default: 0):
For scaling purposes, not used.
The license of the packages is custom LASR-UC3M (Licencia Académica Social Robotics Lab - UC3M), an open, non-commercial license which enables you to download, modify and distribute the code as long as you distribute the sources.