question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spatial audio does not work with audio streams

See original GitHub issue

I’m trying to use this as part of a voice chat feature in a game that implements CEF. However, it doesn’t seem to apply any 3D effects to the voice stream. I tested a normal sound (ogg) and it worked as expected, with the audio becoming quieter as the player moved away from the other and the direction in the speakers changing as well. With an audio stream from a microphone, using window.URL.createObjectURL(stream) to get the source, it only plays the sound as if it were a normal sound - it doesn’t matter where my player is in the game; the sound is the same volume and direction.

I’m curious as to if this even works with spatial audio. I tried using a different library (HowlerJS), but I read that audio streams are not supported with their spatial audio. Is this the same case here?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
drewbitllamacommented, Jan 5, 2018

Hi Benank,

I have a feeling you need to explicitly have WebAudio handle the stream via a createMediaStreamSource() function call and then pipe it’s output to our renderer. See https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createMediaStreamSource for more details.

Please feel free to post some example code as well so I can help you better. 😃

Cheers, Drew

1reaction
ryancwalshcommented, Apr 14, 2021

@benank Wow, I didn’t really expect that you’d respond at all, and the fact that you responded so quickly is blowing me away, especially given that you’re sharing code.

I really appreciate it. 😃

As it turns out, at the same time as you were typing this, I was able to figure it out based on your earlier hint: https://github.com/resonance-audio/resonance-audio-web-sdk/issues/34#issuecomment-819902221

Thank you so much! This is really cool.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is Spatial Audio not working on my iPhone?
So, if you believe Spatial Audio is not working, it could be because: You don't have a compatible device (see “Spatial Audio Compatible...
Read more >
Spatial Audio not working on Apple AirPods or Beats? Steps ...
Is spatial audio not working on your Apple AirPods? Learn how to fix this issue by clicking here to learn more.
Read more >
About Spatial Audio with Dolby Atmos in Apple Music
Yes. You can listen to Dolby Atmos music in Spatial Audio with dynamic head tracking on AirPods Pro, AirPods Max, and Beats Fit...
Read more >
Spatial Audio "Not Playing" Error in iPhone and iPad Let's Fix It
Spatial Audio Not Playing in iPhone or iPad? Don't Worry. This simple troubleshooting step will help you Fix it. AirPods 3, AirPods Pro...
Read more >
Apple Music lossless: which devices will (and won't) play ...
You don't have to line Apple's pockets to hear the Dolby Atmos tracks, either. The 'regular' Spatial Audio also works on any headphones...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found