-
Notifications
You must be signed in to change notification settings - Fork 160
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
setVolume does not effect #38
Comments
Hey @timotoots, thanks for using wad.js. According to the Web Audio spec, gain nodes will ignore changes to their value if there is currently automation scheduled. All basic wads have automation scheduled to implement their envelopes, so this would prevent setVolume from changing the volume while a note is playing. I don't think it has anything to do with setTimeout specifically. I'm not sure if the web audio API always worked this way, because I could swear this feature used to work. You can work around this issue by wrapping the bell in a polywad, because polywads have their own gain nodes, but they have no automation.
|
As per the current implementation of WebAudio (the spec has some upcoming changes about this) if the AudioParam is in 'automation mode' then the setters/getters are disabled. The setter doesn't change anything, and the getter returns a 'last stable value'. |
@notthetup Thanks for the link. That adds some clarity to this issue for me. I don't think I'll be able to find a better solution to this issue than the workaround I posted above, due to how web audio handles automation. In that case, I will close this issue. |
I got it working that way! |
Hello @rserota! Thanks for the great work, I really like the script!
I do have one problem. I try to get setVolume working at later times after loading, but it seems not to have effect. I am using latest Chrome. Here is a demo, bell.setVolume(0.5) works, but the one inside of the setTimeout does not. Also it does not work from any other function. Or am I missing anything here?
The text was updated successfully, but these errors were encountered: