Closed SparkyXI closed 6 years ago
It's something that will come after I've completed the shift to a Python-based front end. Unicorn HAT would be, at best, extremely tricky to get working with the current architecture because it requires root privileges, whereas ALSA + plugins run under the user context of the application that initialised them.
The Python/socket method will decouple the ALSA plugin (now the client) from whatever script (the server) displays the VU information on a HAT or pHAT.
This is still a work in progress though, here's the prototype server: https://github.com/pimoroni/pivumeter/blob/devel/python_server/socket_server.py
And the client plugin: https://github.com/pimoroni/pivumeter/blob/devel/src/devices/socket.c
I've got the build into a state where I can potentially test Unicorn HAT/pHAT blinkies now.
Unfortunately Unicorn HAT/pHAT are not compatible with any DAC add-on, because they have a pin clash. I'll have to fix my audio routing and disable the DAC before I can test it and rig a proof-of-concept.
All fantastic things. Thanks for looking into it - very much appreciated!
Proof of concept: https://twitter.com/Gadgetoid/status/857175875183403009
And accompanying code: https://github.com/pimoroni/pivumeter/blob/devel/python_server/unicorn_server.py
I'm still having trouble with it conking out periodically, specifically in the gap between YouTube videos when playing continuously in Chrome. I'll need to narrow that down, 'cos it's super annoying!
This is excellent. Thanks so much! Now, the question is... how exactly do I get this running? I have unicorn_server.py running in the background, but I get no blinky. Is there something else I should be running, or do I have to define the unicorn phat as the device somewhere?
You'll need to clone and install the development branch, like so:
git clone https://github.com/pimoroni/pivumeter -b devel
cd pivumeter
./setup.sh
Then modify the pcm_scope.pivumeter
section in /etc/asound.conf
, changing the line:
output_device default
Into:
output_device socket
Then fire up the server, play some audio, and cross your fingers!
See title, because how about? Would be a perfect VU meter for my audio/video conferencing test setup.
:)