Comments (4)
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.
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.
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.
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)
- Is it ready for production on Android and iOS?
- [Request] Sleep thread on pause
- Could this library be used to create Virtual Audio Devices or feed audio files into an InputStream?
- Output callback is called less frequently than input callback
- How to change sample rate? HOT 1
- How do I capture audio and visualize it? HOT 5
- cpal works fine in one program but fails (without error) in the other HOT 2
- Remove / add feature for NotSendSyncAcrossAllPlatforms
- ai::* not found on build with feature asio HOT 6
- WASAPI `SupportedStreamConfig`s `buffer_size` is a maxed out range instead of `Unknown`
- Assertion in WASAPI HOT 2
- [ASIO] bug/strange behaviour with threads - only one thread can access devices HOT 2
- [ASIO] Pre build script HOT 1
- Memory leak in WASAPI `input_devices`
- trying to compile the wasm example...issue HOT 1
- append HOT 1
- Crash on default_output_config when using cpal with Flutter using Dart FFI HOT 1
- Pausing a stream doesn't clear out sample buffers
- emscripten support is broken (since wasm-bindgen does not work there?) HOT 7
- No devices on default host on WASM32, specifically Chromium HOT 1
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 cpal.