GithubHelp home page GithubHelp logo

Buffer underrun about chatterpi HOT 7 CLOSED

diveblue avatar diveblue commented on August 14, 2024
Buffer underrun

from chatterpi.

Comments (7)

ViennaMike avatar ViennaMike commented on August 14, 2024

from chatterpi.

arwpc avatar arwpc commented on August 14, 2024

from chatterpi.

diveblue avatar diveblue commented on August 14, 2024

from chatterpi.

arwpc avatar arwpc commented on August 14, 2024

from chatterpi.

ViennaMike avatar ViennaMike commented on August 14, 2024

OK, this one will be a tough one. There's no doubt that ChatterPi really pushes a Pi to its limits. The issue is clearly related to taking too long in the audiopy callback function that determines the jaw movements, but I have not found a way to make that run any faster. Any suggestions for further optimizing that code welcomed.

Try increasing the BUFFER_SIZE parameter to 16384. In the past, this seemed, in my setup, to elliminate the problem on the Pi4.
Changing the CPU governor to performance mode may also help, but it wasn't sufficient by itself. The downside of a larger buffer size is that it introduces delay in the output.

Hope this helps! I started a separate issue regarding the image file not working.

from chatterpi.

ViennaMike avatar ViennaMike commented on August 14, 2024

I'm testing a fix for the buffer underrun problem. Rather than calling the heavy duty math processing for determining jaw movements at the same rate that chunks are fed to produce audio, only calling for it 50x per second. So far, this seems to be keeping buffer underruns away, at least on my Pi 4. This can probably be made less frequent if there's still a problem on slower machines like the Pi Zero, but dropping it to only 10x per second had a visibly detrimental effect on jaw movement.

from chatterpi.

ViennaMike avatar ViennaMike commented on August 14, 2024

Ran repeatedly. Sometimes the audio cut out while the jaw kept moving properly, but that seems to be a different problem. Did not see a single "buffer underrun" error. Fixed code uploaded. Declaring this bug fixed. If anyone sees buffer underrun problems with this new code, please start a new issue.

from chatterpi.

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.