Comments (6)
I'm guessing it's this super-tight loop that's causing the problem:
https://github.com/pimoroni/pivumeter/blob/devel/python_server/socket_server.py#L136-L148
You might want to add a time.sleep(0.001)
or something similar before each instance of break
in that loop, that should prevent it running unbounded and CPU-hungry. There's probably a much better way to accomplish this.
from pivumeter.
I've done a simple debbuging - log here https://github.com/pimoroni/pivumeter/blob/devel/python_server/library/pivumeter/__init__.py#L72 and here https://github.com/pimoroni/pivumeter/blob/devel/python_server/library/pivumeter/__init__.py#L133 but they are logged only when music is playing so it looks like it's not that...
from pivumeter.
Trying to revive this old thread. I've created the clone of the ameter/pivumeter:
https://github.com/project-owner/peppyalsa.doc/wiki
I replaced I2C output by the named pipe output. That allows to separate software and
hardware implementations:
https://github.com/project-owner/PeppyMeter.doc/wiki/Outputs
I have faced almost all issues reported for the pivumeter. Recently I fixed the Segmentation Fault
issue described here:
#16
Here is the fix:
https://github.com/project-owner/peppyalsa/blob/master/src/peppyalsa.c#L111
Now I'm experiencing high CPU usage issue which terribly slows down my application.
Did you debug further this issue? Thank you!
from pivumeter.
@project-owner sorry for the radio silence- I've had so many other things to do that attempting to improve PiVUMeter has taken a back seat. I'm glad you took this code and ran with it- I was hoping it would gain more traction in the Pi community than it did, and invite some people to solve some of the long standing issues.
In what cases are you experiencing a high CPU usage? I suspect the sheer volume of audio frames, coupled with the need to run each through a fast-fourier transform probably isn't optimal but then it's not like dozens of music players haven't already done this since WinAmp. It should be a solved problem.
I could venture that my code - me not really being a C/C++ developer, and certainly not a very experienced one around the time I wrote it - probably has some room for improvement.
from pivumeter.
Hi Philip, thank you for reply even one year later :) I also put VU Meter on hold after facing that issue and focused on another stuff.
As far as I remember the issue with high CPU usage usually occurred during track change. After some period of time it went back to normal. The CPU usage was about 150%, which means that one core was 100% and the second one 50% busy. I don't think this is normal. My wild guess - there is some kind of buffering issue. I'm just not sure at which level it happens - audio player, plugin, FFT or anywhere else.
I was planning to start working on this issue. If I'll find any other info I'll let you know. If you will find any info/fix please let me know.
Thank you!
from pivumeter.
Since Raspberry Pi OS has rolled out (if I'm remembering correctly) Pulse Audio now it might be prudent to look into adapting pavumeter to replace the ALSA plugin part of pivumeter.
I dare say, I've not touched this code for so long that I'm likely only to break it further!
Closing this for now, with the hope of finding some time to explore a better, more robust alternative!
from pivumeter.
Related Issues (19)
- vu meter to match song dynamics and not current volume HOT 3
- How about support for the Unicorn pHat? HOT 6
- support i2c lcd display (16x2 or parametric)
- Support for generic SN3218 (such as piglow) HOT 2
- Segmentation Fault in get_channel_level accessing data at channel buffer pointer - Raspbian Stretch HOT 1
- pivumeter server - only 0 values? HOT 1
- Support for X ( please read if you want support for a new device ) HOT 7
- Micro Dot Phat HOT 1
- Use with volumio HOT 2
- Crazy blinking when playing multiple streams HOT 1
- pivumeter and dmixer do not work together HOT 4
- Not working with Raspotify and blinkt HOT 5
- Won't work HOT 1
- How to use pivumeter alongside the python phatbeat library? HOT 2
- Segmentation Fault in get_channel_level HOT 1
- wiringpi is deprecated and not in the bullseye repos HOT 2
- pHat DAC option... HOT 2
- Locks up audio stream HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pivumeter.