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

Audio latency #320

Open
troyc opened this issue Mar 11, 2024 · 5 comments
Open

Audio latency #320

troyc opened this issue Mar 11, 2024 · 5 comments

Comments

@troyc
Copy link
Contributor

troyc commented Mar 11, 2024

I noticed audio latency when playing audio with the wasm build (it was also noticeable on the Linux desktop build, but that doesn't concern me). It might be due to the way cpal currently works with wasm (old thread, maybe still relevant: RustAudio/cpal#372). I ended up making bindings to howler.js for audio on wasm. This is a video with the same sounds being played via howler.js bindings and notan_audio/oddio/cpal: https://youtu.be/lyZKoDjTZY0. I was able to confirm that the delayed sound is from Notan.

@Nazariglez
Copy link
Owner

Thanks for the report @troyc! I'll take a look.

@troyc
Copy link
Contributor Author

troyc commented Mar 11, 2024

These are the bindings I used: https://gist.github.com/troyc/9be9b26b1b8af61ef0e2e54ec2077d0a

@Nazariglez
Copy link
Owner

Nazariglez commented Jun 8, 2024

This is interesting, is it the video showing the latency? I think that I can hear at first two sounds with a short time amount between them, and then after a few seconds the same sounds have a bigger gap between them. Is that the issue? My guess it that the first one is using howler and the last one is using notan right?

@troyc
Copy link
Contributor Author

troyc commented Jun 8, 2024

My guess it that the first one is using howler and the last one is using notan right?

Right

@Nazariglez
Copy link
Owner

I guess that could be something related to cpal, or to the notan's implementation of how notan starts sound, maybe the code is awaiting for the sound to end to start other? Could be a few things, but I am not too worried about this because I have a few ideas to fix it, and at the end of the day we can always implement WebAudio directly in the web backend.

Thanks, I'll investigate it!

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