PeppyMeter

New version of the PeppyMeter was released today:
GitHub - project-owner/PeppyMeter: PeppyMeter Repository

The updated documentation can found here:
Home * project-owner/PeppyMeter.doc Wiki * GitHub

New features:
- PeppyMeter can send HTTP requests with volume data to remote web servers
- PeppyMeter can receive HTTP requests and display volume data from those requests
- Added cache for needle sprites. It makes transition from one meter to another much faster. It also fixed the Pygame/SDL memory leak
- Implemented ability to embed PeppyMeter to larger screens
- New configuration parameter enables exit on touch event

Here is the video showing the example of using the PeppyMeter in the Volumio Add-on:
Volumio VU Peppy Meter (6/25/2021 version) - YouTube
 
Last edited:
Hi Rpi,


Do you remember a spell ago we (you, me and phofman) were involved into a problem with CPU spikes while switching radio stations in PeppyPlayer?
Phofman made some fixes to libasound.so.2.0.0
Hope you remember.
Looks like I’ve found a related problem while playing a test file click1.wav (full scale sine on one channel and clicks on another).
Might I ask you to play the file and share the results?
Dropbox - click1.wav - Simplify your life


Actually the file was created for a different purpose but I’ve detected a strange PeppyMeter behavior (I’m using mpd/peppyalsa plugin/PeppyMeter chain), the needles movements are ugly intermittent.
Trying to diagnose, I switched PeppyMeter off and checked ‘hexdump peppyalsa.pipe’ (peppyalsa output pipe) and saw the same terrible intermittence that was never observed while playing music.
So the problem is definitely not in PeppyMeter, but rather in the alsa-metering (tried the both libasound.so.2.0.0-s, the original and the patched) or peppyalsa.
Most probably the first as peppyalsa source is pretty straightforward.


Could you please try, I’d like to understand whether the problem is not solely mine at least


Thanks,
Serge
 
Hi Serge,

I'm not sure what kind of issue you observed. Your file has a high level signal of constant frequency in the left channel and clicking sound in the right channel. I think PeppyMeter works as expected - the left channel hand/needle is in the right/max position and doesn't move. The right channel hand/needle shows clicks as expected.

Best regards
 
Hi Rpi,


Thank you for trying!
What I observe is extremely strange. The left needle is in the max position as it should be.
The right needle reflects the clicks for a second, then drops to the min position (or just shows zero level between the clicks) and freezes for a second or two, so for a second or two, the right needle shows the minimum.
When I stop PeppyMeter and use “hexdump/cat the-fifo” I see the normal flow (max on the right and spikes on the left for a second, then the flow freezes for "one and a half" seconds and then the process repeats.
So probably the second stage of needles (freezing), i.e max on the right, min on the lift (between the clicks) is just no signal from peppyalsa, so nothing new to show/update he needles with.


Would be happy if you suggest me a more in-depth diagnostics.
I do understand nothing so far


Thanks
 
Hi Rpi,


After you confirmed it’s not a general problem I started focusing on what is unique in my system.
So the problem was found and fixed.
It was snd-dummy sound driver that was used as slave.pcm in peppyalsa config.
I would not like to bother you with the details, however if you need them, I would be happy to explain.
Anyway thank you very much, you actually helped me!


Yours,
Serge
 
Hi Serge,

Good to know that you found the issue. I don't think I was helpful though.

The ALSA configuration is very confusing area. It's probably next to rocket science :)
I was thinking for a long time how to simplify the ALSA configuration process in the Peppy Player. I thought to represent it either as a diagram with nodes or just as a template or set of templates for .asoundrc files. BTW, Volumio player started using templates for ALSA configuration recently.

Best regards
 
Hi Rpi,


I’d like to ask for an advice from you if I might.
I’m creating a box with Pi4 (with mpd and PeppyMeter) + I2C connected DSP board (crossover + room equalization).
Some DSP parts (especially PEQs for room equalization) can produce positive amplification (above 0db), so some clipping may happen. I’ve already inserted a clipping detection algorithm into DSP that works, I can read per-channel clipping flags from DSP via I2C.
Now I need to display the clipping in Peppymeter anyhow.
I’m not a guru in python and especially not in pygame, so would need an advise for how to insert a clipping indicator into Peppymeter.
I believe it should be a sprite (nearly as the needle) with the same display approach (partially refreshing the background and adding new sprite).
Am I wrong? Or there is a way to inject a “static” (slowly volatile) “label” into the pygame surface?


What is the best point to create such functionality in your class structure?
Should it be a part of the meter class or meterfactory, or something else.
Peppymeter looks well structured, so there should be a logic for finding a proper place you are definitely aware of better.


Thank you,
Serge
 
Hi Serge,

As far as I understand you want to add two states indicator: one state - no clipping and another state - clipping. So it's like a LED which is shining whenever clipping happens. If this is the case then you have to create additional layer for the meter. There are currently three layers: background, indicator and foreground (optional):
Meter Anatomy * project-owner/PeppyMeter.doc Wiki * GitHub
You have to add the layer for the clipping indicator and control its state/visibility in a separate thread. You can check how background/foreground layers have been added in the meter.py.

I would recommend to setup development environment on your desktop machine (PC or Mac) and then deploy on Pi or whatever Linux machine you use. This way you can develop the visual part much faster as it can take a lot of time. I mostly use my Windows PC desktop for development and from time to time just deploy on Pi for the final testing. I use VS Code IDE with Python extension.

Best regards
 
>So it's like a LED which is shining whenever clipping happens.
Maybe not a LED precisely but similar to that


>to create additional layer for the meter.
Brilliant! The layer based approach will definitely simplify the things.



>I would recommend to setup development environment on your desktop machine (PC or Mac) and then deploy on Pi or whatever Linux machine you use.


I already go the same way actually :)




Thank you very much!
Serge
 
Yes, I'm planning to make a standalone spectrum analyzer - PeppySpectrum the same way as the PeppyMeter was made as a standalone program by minor refactoring of the Peppy Player VU Meter screensaver.

I was thinking about improving the spectrum analyzer UI but always found more interesting things to do ;)

Best regards
 
Hi Francesco,

Very well done!
I'm planning to make new releases for the peppyalsa, PeppyMeter and Peppy Player. The release for the meter will include ability to define the meters which you want to show using comma separate string with meter names. Also I'll center the meter on screen if the screen resolution is larger than the meter resolution. I can also add the ability to call the external script when you touch the screen (in case of touchscreen). Do you think it can be helpful for switching screens?

Best regards

Hello, thank you so much for your efforts, it works good for me.

Sooo... :)

1. *PLEASE* make the touch screen to change meters,
2. Yes waiting for the analyzer too.
3. I use it as VUmeter to my DIY amps, using a USB audio card as input. I notice there is a small delay from actual music, I don't know if anything can be done.
 
Hi,

Good to know that you find it useful.
I'll try to implement a meter switching by touch in the next version. Though I'm not sure how to exit from meter in this case :)
Regarding a stand-alone Spectrum Analyzer, I'm not sure that that will happen this year. We will see...

Which display do you use for VU Meter? If that's a touchscreen with SPI interface then there can be delay between audio and meter. I didn't observe delays with HDMI touchscreens. Which software and USB card do you use?

Best regards
 
Last edited:
Playing with this on a Pi Zero with Hyperpixel 4" touchscreen.

It paints the meter backgrounds without issue, the pipe is working fine, but animations don't work, never see a needle or moving "lights" on the bars.

A print(r) statement in update_rectangle() method of component.py shows the data flowing through, but no animation:

pygame 2.0.1 (SDL 2.0.9, Python 3.7.3)
Hello from the pygame community. Contribute - pygame wiki
[2021-09-23 12:34:31,379] {datasource.py:102} DEBUG - opening pipe...
[2021-09-23 12:34:31,382] {datasource.py:124} DEBUG - starting data source...
[2021-09-23 12:34:31,397] {datasource.py:104} DEBUG - /home/pi/myfifo opened
[2021-09-23 12:34:31,406] {datasource.py:133} DEBUG - data source started
[2021-09-23 12:34:31,420] {peppymeter.py:106} DEBUG - PeppyMeter initialized
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
<rect(143, 141, 256, 268)>
<rect(143, 108, 259, 301)>
<rect(184, 97, 220, 307)>
<rect(200, 80, 207, 323)>
<rect(233, 72, 176, 328)>
<rect(251, 58, 161, 342)>
...


Any suggestions?