Closed Bug 1232644 Opened 9 years ago Closed 8 years ago

Clicking noise can be heard, when oscillator's volume is changed through gain.

Categories

(Core :: Web Audio, defect, P2)

42 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1228207

People

(Reporter: m_lajos, Unassigned)

References

(Depends on 1 open bug)

Details

(Whiteboard: [parity-Chrome][parity-Edge])

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0
Build ID: 20151029151421

Steps to reproduce:

Please take a look at this jsfiddle code: http://jsfiddle.net/87j0wh0x/

This creates an oscillator node and it's volume is being controlled with a gain node. The volume is periodically changing from 0 to 1, resulting in having sound for a short amount of time and having half a second gaps with no sound.


Actual results:

Please notice, that when the oscillator is muted, then it doesn't cut the sound, when the waveform is at zero crossing, but somewhere in the middle, resulting in a clicking/popping sound.

This can also be reproduced with the example page provided in this closed bug ticket: https://bugzilla.mozilla.org/show_bug.cgi?id=937057

If you press 'Start audio' in the testpage below and press the 'Stop audio' after a second or so, then the issue happens again:
https://dl.dropboxusercontent.com/u/40949268/Bugs/short_beep.html

I tried applying exponentialRampToValueAtTime/linearRampToValueAtTime to give the gain a more gentle fade out, but it didn't solve it.

I also tested this on the latest nightly build of firefox on a different computer and the issue also exists there too.

I would like to add, that it is not required to completely mute the oscillator, but it's the simplest way to reproduce the issue. When the gain value is changed through for example a range input, then it will click/pop on every occasion, when the gain's value is changed.


Expected results:

The sound should get muted without any noise.
I can reproduce the issue on Firefox25-Nightly46.0a1. But I cannot reproduce on Chrome48.0.2564.22 and MS-Edge.

https://hg.mozilla.org/mozilla-central/rev/ae37fdb042c07c0cb9d0afcd41372a96454f4f4f
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0 ID:20151215030221
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [parity-Chrome][parity-Edge]
Depends on: 1228207
Paul/Karl (whomever gets to it first) - is this a dup of a known issue?
Rank: 22
Flags: needinfo?(padenot)
Flags: needinfo?(karlt)
Priority: -- → P2
This is expected behaviour, per spec (Chrome is still de-zippering, and IE is basically a fork of Chrome implementation), but is clearly not ideal. We are exploring our options in bug 1228207.
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(padenot)
Resolution: --- → DUPLICATE
Does the specification provide any standard way to solve this? Can we control where to cut the wave with the API or should the API need to be extended?
Phase cannot be controlled at the moment, but it's planned. Please chime in at https://github.com/WebAudio/web-audio-api/issues/541 with your use case !

That said, using something like `gain.gain.setTargetAtTime(stopTime - epsilon, 0)` should work for your purpose, right?
Yes, that would work nicely. I would expect, that in 90% of real use cases the user would never want to have the wave cut at non zero phase, nor would they want to fiddle with phase controlling.

There is only one use case: if a user wants to do phase cancellation, like creating a phaser/flanger effect.
Flags: needinfo?(karlt)
You need to log in before you can comment on or make changes to this bug.