web-audio-api-rs: Setting HRTF on panner node will freeze for 800 milliseconds

Trying out 0.34, there’s another oddity with the Panner Nodes (you’ll be getting a lot of in a game testing from me!) Again, thank you for this lib, and I’ll try my best to shake out bugs for you.

If you do this:

panner.set_panning_model(PanningModelType::HRTF);

You get a pause (on my AMD/windows home, haven’t tested it on my mac yet) or about 800 milliseconds. My physics thread was complaining a lot about this 😃

If you use ::EqualPower, it works fine. BTW, no crashing on panner nodes anymore, so that issue has been fixed.

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Alright thanks for the feedback. I will update #375 with

  • preloading the HRTF data at the first online AudioContext creation
  • update the upstream hrtf lib with improved performance
  • a benchmark to track performance over time

I would say that in term of usage solution 2. is the best one, as the AudioContext is generally created at application startup

I’d second that. My audio context creation is spun up at the same time I’m spinning up my web gpu context, that’s all expected time loss at the beginning of any application. 300 ms once really isn’t that bad; it’s just bad when you have to do it 10,000 times and only have a couple ms to spare every time.

And, again: Thanks for all the work! I picked rust to learn specifically because of the wgpu and this library; I want to be as cross platform as possible and I want my interfaces to things like lower level sound and graphics to be as long lived as possible and being a web standard gives me that option.

I am new to rust so how to pull from a local repository is something I’ll have to figure out, or maybe a test branch.

Importing a lib locally is quite simple actually, you just have to change your Cargo.toml to give a relative path to the lib, e.g.:

# web-audio-api = "0.34"
web-audio-api = { path = "../web-audio-api-rs" }