notan icon indicating copy to clipboard operation
notan copied to clipboard

Audio latency

Open troyc opened this issue 1 year ago • 6 comments

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: https://github.com/RustAudio/cpal/pull/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.

troyc avatar Mar 11 '24 15:03 troyc

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

Nazariglez avatar Mar 11 '24 16:03 Nazariglez

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

troyc avatar Mar 11 '24 17:03 troyc

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?

Nazariglez avatar Jun 08 '24 14:06 Nazariglez

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

Right

troyc avatar Jun 08 '24 15:06 troyc

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!

Nazariglez avatar Jun 08 '24 15:06 Nazariglez

This issue is stale because it has been open for 1 year with no activity.

github-actions[bot] avatar Jun 09 '25 11:06 github-actions[bot]