GithubHelp home page GithubHelp logo

Comments (6)

Gadgetoid avatar Gadgetoid commented on May 26, 2024

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.

roblan avatar roblan commented on May 26, 2024

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.

project-owner avatar project-owner commented on May 26, 2024

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.

Gadgetoid avatar Gadgetoid commented on May 26, 2024

@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.

project-owner avatar project-owner commented on May 26, 2024

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.

Gadgetoid avatar Gadgetoid commented on May 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.