Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android high latency #132

Closed
kraftwer1 opened this issue Oct 14, 2024 · 3 comments
Closed

Android high latency #132

kraftwer1 opened this issue Oct 14, 2024 · 3 comments

Comments

@kraftwer1
Copy link

I'm playing a short sound effect on touch. It plays immediately on iOS, but has a noticable lag on Android (I estimate around 300ms). The same happens using the default Bevy audio (which uses rodio I believe). I've seen that there might be a way to fiddle around with buffer sizes in kira, see: https://docs.rs/kira/latest/kira/manager/backend/cpal/struct.CpalBackendSettings.html#structfield.buffer_size. The page even mentions that "the default buffer size might be surprisingly large, leading to latency issues". (It seems this is even being discussed on Bevy: bevyengine/bevy#13876).

However I'm not sure how to access those settings from within Bevy or the plugin.

Or there might be other solutions as well? Do you have any tips or hints?

Possibly related: #79

@kraftwer1
Copy link
Author

kraftwer1 commented Oct 14, 2024

Hmmm I've tried kittyaudio which allows to override the cpal buffer size and the sample rate. I've tried 8bit and 22_100hz without any noticable difference. It might even be cpal or oboe. Found this: RustAudio/cpal#890.

@NiklasEi
Copy link
Owner

Have you tried patching cpal with RustAudio/cpal@master...Rodrigodd:cpal:oboe-low-latency from the issue above?

@kraftwer1
Copy link
Author

Thanks. I gave it a try and indeed it plays a bit sooner – I estimate an improvement of 300ms => 200ms. However, it's still unusable for my use case (SFX when shooting a laser). Meanwhile I think this probably does not belong here but either to cpan, oboe-rs, or even oboe. If you don't have any other ideas, I'll close the issues.

(cc @Rodrigodd).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants