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

AudioParam.linearRampToValueAtTime #341

Closed
pendragon-andyh opened this issue Jun 23, 2014 · 5 comments
Closed

AudioParam.linearRampToValueAtTime #341

pendragon-andyh opened this issue Jun 23, 2014 · 5 comments

Comments

@pendragon-andyh
Copy link

I am currently writing tests for the specification and have found linearRampToValueAtTime does not match my understanding of my spec.

If you do:

    param.value=0;
    param.linearRampToValueAtTime(1, 1);

then Chrome and Firefox both then there is no change until 1 second - when it jumps instantaniously from 0 to 1.

However,

    param.setValueAtTime(0, 0);
    param.linearRampToValueAtTime(1, 1);

then you get a smooth ramp between 0 and 1.

https://github.com/pendragon-andyh/WebAudio-Testing/blob/master/webaudio/the-audio-api/the-audioparam-interface/method-linearRampToValueAtTime.html

@chrislo recommended that I clarify here whether you feel this is a bug or if the specification needs to be amended.

@padenot
Copy link
Member

padenot commented Jun 23, 2014

Schedules a linear continuous change in parameter value from the previous scheduled parameter value to the given value

(emphasis mine).

If there is no previous event (and keep in mind that setting the value directly is not an event), then we can't interpolate, so we return the previous value.

@cwilso
Copy link
Contributor

cwilso commented Jun 23, 2014

The part about "setting the value directly is not an event" is the part
that is confusing. I ran in to this when I started, as well. Perhaps we
should call it out better?

On Mon, Jun 23, 2014 at 7:37 AM, Paul ADENOT [email protected]
wrote:

Schedules a linear continuous change in parameter value from the
previous scheduled parameter value to the given value

(emphasis mine).

If there is no previous event (and keep in mind that setting the value
directly is not an event), then we can't interpolate, so we return the
previous value.


Reply to this email directly or view it on GitHub
#341 (comment)
.

@pendragon-andyh
Copy link
Author

I agree. There are 2 distinct usage scenarios. You can use value property
OR you can use the scheduling methods.

I expected setting the value directly to be treated implicitly as
setValueAtTime(x, ac.currentTime).

The problem with audio programming (in general) is that it is difficult to
see when these things don't work intuitively. I only found this issue
because I was writing tests that look very closely at the output.
Previously I just puzzled about why some of my sounds were delayed or had
attack phases that were too fast.

On 23 June 2014 17:28, Chris Wilson [email protected] wrote:

The part about "setting the value directly is not an event" is the part
that is confusing. I ran in to this when I started, as well. Perhaps we
should call it out better?

On Mon, Jun 23, 2014 at 7:37 AM, Paul ADENOT [email protected]
wrote:

Schedules a linear continuous change in parameter value from the
previous scheduled parameter value to the given value

(emphasis mine).

If there is no previous event (and keep in mind that setting the value
directly is not an event), then we can't interpolate, so we return the
previous value.


Reply to this email directly or view it on GitHub
<
https://github.com/WebAudio/web-audio-api/issues/341#issuecomment-46838891>

.


Reply to this email directly or view it on GitHub
#341 (comment)
.

@cwilso
Copy link
Contributor

cwilso commented Oct 23, 2014

This is a duplicate of #128.

@olsonpm
Copy link

olsonpm commented Jan 3, 2015

I just ran into this exact issue now. I appreciate your guys' explanation of the problem - and would love the docs to make this explicit. What's further confusing is the following exmple seen on the official MDN docs which exhibits the above bug:

docs: https://developer.mozilla.org/en-US/docs/Web/API/AudioParam.linearRampToValueAtTime
example in docs: http://mdn.github.io/audio-param/

mnvr added a commit to mnvr/mrmr.io that referenced this issue Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants