resonance-audio / resonance-audio-web-sdk

Resonance Audio SDK for Web
https://resonance-audio.github.io/resonance-audio/
Apache License 2.0
200 stars 56 forks source link

Resonance Reverb does not work in Firefox #11

Open ianpetrarca opened 6 years ago

ianpetrarca commented 6 years ago

Hi All,

This a more specific issue around Reverb not working in Firefox that was brought up in : Issue #8

This is the project that I am working on right now that is a WebVR+Resonance scene: Repo: https://github.com/ianpetrarca/spatialaudio Live Example: https://ianpetrarca.com/spatialaudio

If you view that example in Chrome+Chrome Canary you can hear the reverb. If you view that example in Firefox there is no reverb in the mix. I want to be clear that there is still spatialization and volume attenuation in Firefox so it seems like this has something to do with the Convolver. It's almost like someone turned the "Wet" reverb mix completely off.

This bug can be reproduced in this demo as well: https://demo.datavized.com/drums/

Specifically, this is the code that I am using to setup/use resonance (Audio.js in Repo):

https://github.com/ianpetrarca/spatialaudio/blob/master/src/audio.js

ianpetrarca commented 6 years ago

@drewbitllama @mgorzel Any chance you guys were able to take a look at this?

ianpetrarca commented 6 years ago

@drewbitllama @mgorzel I finally figured this out. If you use a stereo audio file, Firefox does not apply reverb to the source. In order for reverb to be applied to a source in a Resonance Scene in Firefox, the file must be mono. In chrome that does't matter and both mono and stereo files work. We can close this.

mgorzel commented 6 years ago

Thanks so much @ianpetrarca for investigating that issue and suggesting a workaround! Mono samples should be generally preferred for spatialization as Resonance Audio does not support independent or linked panning of L/R stereo channels yet. I've added a note on that in the documentation. However, I think it would still be useful to investigate what causes the reverb problem in Firefox, so I will reopen this issue.

ianpetrarca commented 6 years ago

@mgorzel No problem, happy to help. Mono files ultimately make the most sense for a spatialization framework like Resonance. I think that creating a standard for how Resonance handles different file types (mono,stereo, 4-channel Ambix) would be the most helpful. That way developers can expect one result on all platforms.

Just to clarify, a stereo audio file in stereo still spatializes left/right, and has volume attenuation, it's just the reverb that isn't working.

hoch commented 5 years ago

If you use a stereo audio file, Firefox does not apply reverb to the source.

@ianpetrarca This seems like a bug on FireFox side. No?

ianpetrarca commented 5 years ago

@hoch It's hard to say, I'm not familiar with other websites using Channel Merger and having issues on FF. I'm guessing that's where the issue is occurring? However, stereo files working on Safari/Chrome is a good indicator that it could be something in FF. Stereo files in Resonance Web are a bit trivial since it's made for mono-sound objects. or 4-channel AmbiX. I haven't pursued this further.

hoch commented 5 years ago

@ianpetrarca Thanks for clarification. Could you provide a simple/reduced repro case for this issue? Looking at the linked code above might take a while.