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

Sound instances and volume #11

Closed
sashamirkovic opened this issue Sep 16, 2016 · 4 comments
Closed

Sound instances and volume #11

sashamirkovic opened this issue Sep 16, 2016 · 4 comments

Comments

@sashamirkovic
Copy link

Hello,

I use this library as described however I have following problems with it. First once I write sndA = sounds[sndApathj] whenever I use in the code sndA.play() it starts another instance. Then I noticed that adjusting sndA.volume does not affect volume level at all. Also, with example code I get a errors for synth sound like:

sound.js:838 Oscillator.frequency.linearRampToValueAtTime value -1 outside nominal range [0, 24000]; value will be clamped.

Also I noticed that other functions like fade, fadeIn, fadeOut act strange (for example fadeIn is not fading in in linear fashion). Also, when one sound is playing and another sound is started overall volume is affected.

Could you please check the sound.js?

@kittykatattack
Copy link
Owner

Hi,

Please let me know on which browser you received this error message:

sound.js:838 Oscillator.frequency.linearRampToValueAtTime value -1 outside nominal range [0, 24000]; value will be clamped.

Did you receive this message while testing the "index.html" example file?

@Qriva
Copy link

Qriva commented Jun 14, 2017

Hello,
I have also problems with changing volume but I made some research:

Bug appear for Firefox (I did not check Safari) and you can observe it even in your own demo @kittykatattack when trying to fadeOut fade is cuted off.
I checked how it works in library and it stops working after using any volume.gain method like linearRampToValueAtTime. After using methods, property value (of gain) stops working.
Methods don't set value property to new one, it just stuck in original one.

Im not an expert in audio but possible fix can be change all volume.gain.value to method gain.setValueAtTime. Also its probably related to Bug 893020 and this implementation

@kittykatattack
Copy link
Owner

@Qriva Thanks so much for those details!
Can anyone suggest a fix?

@Qriva
Copy link

Qriva commented Jul 6, 2017

I needed sound library so I checked others like howler.js but it seems that problem exists in all libraries.

I think that easy fix is not possible. Only thing I thought was to use everywhere gain.setValueAtTime instead of value but this way it's still not possible to get current value so only way to fix that is to store type used function and if value is needed - manually "predict", calculate current value from formula (in W3).
But this is very complex solution... Paul Adenot said it's not going to be fixed in near future so the only solution for that is to rebuild library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants