Giter Club home page Giter Club logo

Comments (4)

pacmancoder avatar pacmancoder commented on July 22, 2024 2

I think cpal really lack of buffer size setting. I making emulator at the moment and I need to make synchronization of sound with video. With portaudio it was pretty easy, but I decided to switch from it because of very tricky compilation on windows and bugs. It would be great if it will be possible to set buffer size for small latency, because using thread::sleep for waiting before next buffer fill is very inaccurate and produces many sound glitches.
Can this be implemented?

from cpal.

tomaka avatar tomaka commented on July 22, 2024

I suspect that cpal has a several second buffer internally which is getting filled up; when I change the volume it happens right away but that goes onto the back of the cpal queue and it takes a while for the change to be heard.

If this is the case, I don't really see how to configure it in cpal. Maybe there's something I'm missing? For this DSP stuff I really want to have latency as low as possible.

That's probably what happens.
You should try submitting fewer samples at once. Don't call append_data(size_of_data) but append_data(min(size_of_data, size_of_ten_milliseconds_of_data)) instead.

from cpal.

bburdette avatar bburdette commented on July 22, 2024

ah, that does appear to be helpful, although after a while it reverts to having latency again. I'm not properly tracking how quickly samples need to be produced, I'll try monitoring the amount of time that has passed and feeding samples to cpal accordingly.

from cpal.

mitchmindtree avatar mitchmindtree commented on July 22, 2024

I've added an issue about providing an API for requesting certain buffer sizes at #205. The original issue of data submission size can no longer be an issue with the current CPAL API (there is no longer an append_data method). Going to close this in favour of #205.

from cpal.

Related Issues (20)

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.