Intent to Implement and Ship: WebAudio: AudioParam Setter is setValueAtTime

69 views
Skip to first unread message

Raymond Toy

unread,
Oct 9, 2017, 5:29:50 PM10/9/17
to blink-dev

Contact emails
rt...@chromium.org,hong...@chromium.org

Spec
http://webaudio.github.io/web-audio-api/

https://webaudio.github.io/web-audio-api/#attributes-5

Summary
When setting the .value attribute of an AudioParam via the value setter, the value is updated exactly as if setValueAtTime(newValue, context.currentTime) were called.

This includes throwing errors that weren't previously thrown and changing the the AudioParam timeline, if any.

Motivation
An AudioParam has a value attribute that can be set directly via the setter or indirectly via a set of scheduled automation events.  The interaction between any on-going automation events and the value setter was never specified.  This change completely specifies the behavior by making the value setter be exactly equivalent to calling setValueAtTime(newValue, context.currentTime).  This is much easier to reason about and will eventually make all browsers interoperable.



Interoperability risk
Firefox: No public signals
Edge: No public signals
Safari: No public signals
Web developers: No signals


While this has been part of the WebAudio specification for quite some time, we don’t believe any browser has actually implemented this.  We do expect this to be implemented.


Compatibility risk
In particular, the following items will change behavior when this is implemented:


  • Calling the value setter when a setValueCurveAtTime automation is running.  This will now signal an error because it is illegal to call setValueAtTime during this automation.  The use of setValueCurveAtTime is very low; an http archive search shows just 11 pages out of 16 million using this.

  • Calling the value setter after a setTargetAtTime.  In Chrome, this would make that setTargetAtTime restart with the new value and then approach the target value again.  This will now effectively cancel setTargetAtTime and set the value directly.

  • In other cases, the value setter was basically ignored during other automations.  This will now change so that the value will be changed.  Because a setValueAtTime event is inserted into the timeline, the currently running automation will be changed, and the next event will start using this new setValueAtTime event.


We believe the simultaneous use of the setter and automation is rare.  Searching the http archives will be ineffective because it’s very hard to know if there is any simultaneous usages. The most effective test is to run the actual application and listen for differences.


To mitigate the effect of this change, we propose adding a deprecation message that the behavior of the value setter will change.  The proposed target date is M65.


Ongoing technical constraints
None


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux,
Chrome OS, Android, and Android WebView)? Yes


OWP launch tracking bug
http://crbug.com/764396

Link to entry on the Chrome Platform Status
https://www.chromestatus.com/features/6254081119092736

Requesting approval to ship?
Yes, after the deprecation period is up.





Chris Harrelson

unread,
Oct 9, 2017, 10:13:54 PM10/9/17
to Raymond Toy, blink-dev
LGTM1 to ship in M65 with a deprecation warning in M64.

On Mon, Oct 9, 2017 at 2:29 PM, Raymond Toy <rt...@chromium.org> wrote:

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAE3TgXH7wjKp_-VeCQrcJRv-KkbR%3DQgaQsyi18UifFTFkiuz7A%40mail.gmail.com.

Dimitri Glazkov

unread,
Oct 10, 2017, 5:10:34 PM10/10/17
to Chris Harrelson, Raymond Toy, blink-dev
LGTM2

On Mon, Oct 9, 2017 at 7:13 PM Chris Harrelson <chri...@chromium.org> wrote:
LGTM1 to ship in M65 with a deprecation warning in M64.

On Mon, Oct 9, 2017 at 2:29 PM, Raymond Toy <rt...@chromium.org> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Raymond Toy

unread,
Oct 11, 2017, 10:52:57 AM10/11/17
to Dimitri Glazkov, Chris Harrelson, blink-dev
Oh, I just remembered that Firefox hasn't implemented this yet either, and they want to coordinate launch of this change.  So I guess that's a positive signal from Firefox.

On Tue, Oct 10, 2017 at 2:10 PM, Dimitri Glazkov <dgla...@chromium.org> wrote:
LGTM2

On Mon, Oct 9, 2017 at 7:13 PM Chris Harrelson <chri...@chromium.org> wrote:
LGTM1 to ship in M65 with a deprecation warning in M64.

On Mon, Oct 9, 2017 at 2:29 PM, Raymond Toy <rt...@chromium.org> wrote:
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Rick Byers

unread,
Oct 11, 2017, 9:45:22 PM10/11/17
to Raymond Toy, Dimitri Glazkov, Chris Harrelson, blink-dev
LGTM3

Do you have any way to estimate what fraction of calls will have their behavior changed?  Generally deprecation messages are reserved for "this behavior will stop working on this date".  We don't generally do warnings like "the API you called might behave differently" (we've had too much problem with warning spam/blindness in the past - warnings should all be actionable).  It might be reasonable to do a verbose-level (off-by-default) warning for something like that.  Or if you can target a specific set of cases that used to be valid which are now invalid, generating a warning for those is fine.


Raymond Toy

unread,
Oct 12, 2017, 1:22:55 PM10/12/17
to Rick Byers, Dimitri Glazkov, Chris Harrelson, blink-dev
On Wed, Oct 11, 2017 at 6:44 PM, Rick Byers <rby...@chromium.org> wrote:
LGTM3

Do you have any way to estimate what fraction of calls will have their behavior changed?  Generally deprecation messages are reserved for "this behavior will stop working on this date".  We don't generally do warnings like "the API you called might behave differently" (we've had too much problem with warning spam/blindness in the past - warnings should all be actionable).  It might be reasonable to do a verbose-level (off-by-default) warning for something like that.  Or if you can target a specific set of cases that used to be valid which are now invalid, generating a warning for those is fine.

There's no current way to estimate this fraction. I suppose we could add some metrics to test if you call the value setter in the middle of some automation event.

And the existing behavior will stop working at some point.  Depending on the application, it may or may not matter.

I talked this over with Hongchan, and this is something we can probably do.  When the value setter is called, check to see if it is in the middle of some running automation event.  If so, print out (once!) a message about using the setter in the middle of the event (with as much info as possible).  And also print out the deprecation message.  In this way, developers won't get spammed and you get something possibly actionable (because the value setter is on the main thread and the timeline is running on the audio thread).  This also means that if the developer reloads the page, the message may be different because the timing is different.  But perhaps that's better than nothing.
Reply all
Reply to author
Forward
0 new messages