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

When muting, fading sounds are not muted when using webAudio #666

Closed
soruly opened this issue Dec 14, 2016 · 4 comments
Closed

When muting, fading sounds are not muted when using webAudio #666

soruly opened this issue Dec 14, 2016 · 4 comments
Labels

Comments

@soruly
Copy link

soruly commented Dec 14, 2016

when webAudio is used, it only checks if howler is muted before fade starts. It doesn't check if it is muted while fading (which is handled by linearRampToValueAtTime ). It seems that howler does not disconnect nodes correctly when muting?

self.sound.fade(0,1,2000,id);
self.sound.mute(true);

The above code doesn't play any sound on HTML5 audio (correct)
But when webAudio is used, the fade in still plays

Ref: (howler v2.0.2)
https://github.com/goldfire/howler.js/blob/v2.0.2/src/howler.core.js#L1109

The workaround is to set {usingWebAudio: false} in global options.
It works well with HTML5 audio.

@soruly
Copy link
Author

soruly commented Dec 15, 2016

This issue is because howler use the same node for fading and muting. So when we mute and unmute during volume fade, it cannot restore the incomplete fade. One suggestion would be have a separate gain node to control global volume, and another gain node for fading.

Ref:
https://github.com/goldfire/howler.js/blob/v2.0.2/src/howler.core.js#L960

@soruly
Copy link
Author

soruly commented Dec 15, 2016

var sound = new Howl({
    src: ['sound.mp3']
});

calling global mute Howler.mute(true); works fine, it only happens when calling per sound mute sound.mute(true);

@goldfire goldfire added the bug label Dec 24, 2016
@Jokero
Copy link

Jokero commented Sep 5, 2017

Also faced with this bug. Yeah, global mute works but this is not an option for me.
Plunker https://plnkr.co/edit/49UZfvZen8M3xiADRwAn?p=preview

@soruly Do you see any pitfalls when using {usingWebAudio: false}?

@Jokero
Copy link

Jokero commented Sep 8, 2017

Do you see any pitfalls when using {usingWebAudio: false}?

Found that using html5 audio is bad approach, because sounds that were not caused by user action in mobile browser (tap for example) will not play. What I see in console of chrome for android:

Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.

There are no such errors when using WebAudio, so it is the only correct approach in modern browsers.

And also in Firefox (55.0.2, ubuntu 16.04) looped sound has some delay between replays

bhaskarp-vg pushed a commit to ValueGlobal/howler.js that referenced this issue Feb 7, 2018
ringcrl pushed a commit to ringcrl/howler.js that referenced this issue Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants