-
Notifications
You must be signed in to change notification settings - Fork 6
VU Meter Usage
The following image shows the data flow between different components involved into the process of displaying volume data:
The peppyalsa plugin has the example pipe reader program written in C. It can be used to learn the logic of reading data from the named pipe. When the program is running it reads data from the named pipe and shows ASCII VU Meter:
To compile the program:
cd /home/pi/peppyalsa/src
gcc peppyalsa-client.c -o peppyalsa-client
To run the program:
./peppyalsa-client
PeppyMeter can be used to show volume level in UI in a form of traditional VU Meters:
In addition to UI the PeppyMeter can output the volume to the serial and I2C interfaces. That allows to use it with hardware devices:
Any programming language which is capable to read the data from the named pipe can be used for consuming data generated by the peppyalsa plugin. The program should be aware of the data structure in the named pipe.
The plugin always sends the signal for two channels to the named pipe even if the signal is mono. The maximum value in each channel is 32767 (can be reduced using parameter meter_max). Therefore two bytes are used for each channel. The signal in pipe is the stream of bytes. The first byte in the stream is the low byte of the LEFT channel. The second byte is the high byte of the LEFT channel. The third byte is the low byte of the RIGHT channel. And the fourth byte is the high byte of the RIGHT channel. The following image explains the data structure in the pipe for VU Meter: