chrisguttandin/standardized-audio-context

Changing in the gain doesn't always work

Closed this issue · 3 comments

I've been struggling for days with the following issue:

this.gainNode.gain.value = volume doesn't always work, the volume is often not changed.

this.gainNode.gain.setValueAtTime(volume, this.gainNode.context.currentTime + 0.1) does always work... Changing the 0.1 into a smaller number breaks it more often. (edited: didn't really help)

I'm using Chrome 87 on Windows 10 x64

I noticed the problem only seems to occur when using IMediaElementAudioSourceNode as a source, using an audio buffer works fine.

Any hints? I don't have reproducible code right now, could try.

I have the same issue with the plain web audio API, so I this has nothing to do with this nice library.

Most likely a bug in my code.

Closing, sorry for the noise.

Hi Peter, since you mentioned that you're using a MediaElementAudioSourceNode I guess the audio is coming from a media element. Is it possible that the media element itself is still outputting audio on its own? A handy trick to check that is to insert a DelayNode at the end of the Web Audio audio graph to hear the difference.

I hope this helps.

Thanks for the help, highly appreciated.

It was just a silly bug, the audio element was created more than once, and I was indeed playing the wrong audio element...