Hi Josh, We have finished implementing the SetValueCurveAtTime function and it works well on testing on our example. https://github.com/JHBalaji/media-1/blob/master/audio/param.rs#L418-L436
The example we have written can be found in the set_value_curve.rs file: https://github.com/JHBalaji/media-1/blob/master/examples/set_value_curve.rs We also tried to define a sine function for the values and the variations were right. We have submitted a pull request now. Thank you for your help and we will proceed on the upcoming steps. Best, Akhilesh On Mon, Apr 1, 2019 at 10:22 AM Josh Bowman-Matthews <j...@joshmatthews.net> wrote: > Answers inline: > > On 3/31/19 11:24 PM, Akhilesh Venkatasubramanian wrote: > > Hi Josh, > > > > I have some questions regarding how the params.rs code works as I was > not > > able to find the answers to these online. > > > > *1. *When I run an example to setValueCurve with start_time = 1 with a > > duration of 5 (shown here > > < > https://github.com/JHBalaji/media/blob/master/examples/set_value_curve.rs#L68 > >), > > then after the function is called*, if I print start_time inside the > > function SetValueCurveAtTime (which is defined here > > < > https://github.com/JHBalaji/media/blob/master/audio/src/param.rs#L422-L437 > >) > > in param.rs <http://param.rs> then it shows a value of 44100. How does > the > > value that I pass as 1s change to 44100?*(Hope I am right in assuming > that > > the value 1 that I pass is in seconds?). Also, Start_time is set to 88200 > > if I start from 2s. > > > The time values are multiplied with the sampling rate, so if the rate is > 44100 then a time value of 1 is 44100, two seconds later would be > 1*44100 + 2*44100, etc. > > > > 2. Because of the above, my automation value also keeps on increasing > from > > 44100. But I have my values function defined as [.5, 1, .5, 0, .5, 1, .5, > > 0, .5]. Ideally should my *value (automation value) also change within > the > > value range that I have declared for my values array?S > > > I think the calculation at > > https://github.com/JHBalaji/media/blob/4e00b800248dcc07eae729ff95a57b9c5e747efc/audio/src/param.rs#L437 > is mixing up time values and tick values, which is leading to the large > numbers that you're seeing. The easiest way to do this might be to pass > in the sampling rate as an argument to AutomationEvent::run (using > block.sampling_rate) so you can divide tick values by the rate (or > multiply non-tick values by the rate). > > > Sample output: > > > > Akhileshs-MBP:media akhilesh$ ./target/debug/set_value_curve > > > > Start Time value: 44100 > > > > Current time value: 44100 > > > > The value of k is: 0.0 > > > > Value of the Automation Value is: 44100.023 > > > > The difference in time values is: (Current_tick - start) 0 > > > > > > Start Time value: 44100 > > > > Current time value: 44101 > > > > The value of k is: 1.6 > > > > Value of the Automation Value is: 44101.773 > > > > The difference in time values is: (Current_tick - start) 1 > > > > > > Start Time value: 44100 > > > > Current time value: 44102 > > > > The value of k is: 3.2 > > > > Value of the Automation Value is: 44100.223 > > > > The difference in time values is: (Current_tick - start) 2 > > > > > > Start Time value: 44100 > > > > Current time value: 44103 > > > > The value of k is: 4.8 > > > > Value of the Automation Value is: 44097.793 > > > > The difference in time values is: (Current_tick - start) 3 > > > > > > Start Time value: 44100 > > > > Current time value: 44104 > > > > The value of k is: 6.4 > > > > Value of the Automation Value is: 44103.836 > > > > The difference in time values is: (Current_tick - start) 4 > > > > > > Start Time value: 44100 > > > > Current time value: 44105 > > > > The value of k is: 8.0 > > > > Value of the Automation Value is: NaN > > > > The difference in time values is: (Current_tick - start) 5 > > > > 3. Where should we specify that the automation should stop after the > > duration? Inside the example or inside param.rs? > > > https://github.com/JHBalaji/media/blob/4e00b800248dcc07eae729ff95a57b9c5e747efc/audio/src/param.rs#L332 > is called by > > https://github.com/JHBalaji/media/blob/4e00b800248dcc07eae729ff95a57b9c5e747efc/audio/src/param.rs#L113-L123 > to determine if the event is complete or not. Instead of a duration > value, your automation event should be storing a second Tick which > represents the end of the event that can be returned by that function. > > > > > > Thanks > > Akhilesh > > > > > > On Sun, Mar 31, 2019 at 3:50 PM Akhilesh Venkatasubramanian < > > avenk...@ncsu.edu> wrote: > > > >> Hi Josh, > >> > >> What are your thought on this question : > >> > >> 1. Is it necessary we define and initialize the values and duration > >> parameter that we are using inside SetValueCurveAtTime inside the struct > >> Param > >> <https://github.com/JHBalaji/media/blob/master/audio/src/param.rs#L30>? > >> We assume that this is not needed as the implementation works without > >> doing the same (values vector gets passed). But duration gets passed as > >> Tick(44100) if we set a startTime as 1.0s. (Which we assume is because > >> of tick?) > >> > >> > >> Thanks > >> Akhilesh > >> > >> On Mar 31, 2019, at 12:15 AM, Akhilesh Venkatasubramanian < > >> avenk...@ncsu.edu> wrote: > >> > >> Josh, > >> > >> Just one more clarification, > >> > >> 1. Is it necessary we define and initialize the values and duration > >> parameter that we are using inside SetValueCurveAtTime inside the struct > >> Param > >> <https://github.com/JHBalaji/media/blob/master/audio/src/param.rs#L30>? > >> We assume that this is not needed as the implementation works without > >> doing the same (values vector gets passed). But duration gets passed as > >> Tick(44100) if we set a startTime as 1.0s. (Which we assume is because > >> of tick?) > >> > >> Thanks, > >> Akhilesh > >> > >> On Sat, Mar 30, 2019 at 11:55 PM Akhilesh Venkatasubramanian < > >> avenk...@ncsu.edu> wrote: > >> > >>> Hi Josh, > >>> > >>> I totally understand. We will try to fix it using the examples you have > >>> provided for now. Anyways, we will be continuing with the project for > our > >>> final project so whenever you/your team can validate our > implementation, it > >>> would help us proceed if we don't fix the issue by then. Thank you for > >>> doing the same. > >>> > >>> Best, > >>> Akhilesh > >>> > >>> On Sat, Mar 30, 2019 at 11:27 PM Josh Bowman-Matthews < > >>> j...@joshmatthews.net> wrote: > >>> > >>>> On 3/30/19 6:20 PM, Akhilesh Venkatasubramanian wrote: > >>>>> Hi Josh, > >>>>> > >>>>> 1. Yes we are working on the example and have it defined as follows: > >>>>> > >>>> > https://github.com/JHBalaji/media/blob/master/examples/set_value_curve.rs > >>>>> > >>>>> Can you tell us if the example we have defined is right? We have > >>>> written it > >>>>> similar to the example you shared with us > >>>>> < > >>>> > https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/setValueCurveAtTime > >>>>> > >>>>> . > >>>>> > >>>>> 2. Our implementation of the SetValueCurveAtTime to this point is as > >>>>> follows: > >>>>> > >>>> > https://github.com/JHBalaji/media/blob/master/audio/src/param.rs#L419-L439 > >>>>> > >>>>> As you had mentioned earlier, can you/someone from your team verify > if > >>>> our > >>>>> function definition is right? (Specifically for the linear > >>>> interpolation > >>>>> part, that's where we think the mistake is but not sure how to change > >>>> it) > >>>>> as we are getting a few errors while trying to run the example. > >>>> > >>>> I cannot guarantee that anybody will review it before Monday, sorry. > You > >>>> could try looking at an existing implementation in Firefox for > reference: > >>>> * > >>>> > >>>> > https://searchfox.org/mozilla-central/source/dom/media/webaudio/AudioEventTimeline.h#71-75 > >>>> * > >>>> > >>>> > https://searchfox.org/mozilla-central/source/dom/media/webaudio/AudioEventTimeline.cpp#31-53 > >>>> > >>>>> Error: > >>>>> > >>>>> Akhileshs-MBP:media akhilesh$ ./target/debug/set_value_curve > >>>>> > >>>>> thread 'AudioRenderThread' panicked at 'index out of bounds: the len > >>>> is 9 > >>>>> but the index is 9', > >>>>> /rustc/94fd0458951a4ff91c03366445f0e2e93b86bd2f/src/libcore/slice/ > >>>> mod.rs:2539 > >>>>> :10 > >>>>> > >>>>> note: Run with `RUST_BACKTRACE=1` environment variable to display a > >>>>> backtrace. > >>>>> > >>>>> thread 'main' panicked at 'called `Result::unwrap()` on an `Err` > value: > >>>>> RecvError', src/libcore/result.rs:997:5 > >>>> > >>>> Running with RUST_BACKTRACE=1 will show you the precise line that is > >>>> panicking. I suspect you are not dealing with the case where the > >>>> duration has been exceeded. > >>>> > >>>> > >>>> Cheers, > >>>> Josh > >>>> _______________________________________________ > >>>> dev-servo mailing list > >>>> dev-servo@lists.mozilla.org > >>>> https://lists.mozilla.org/listinfo/dev-servo > >>>> > >>> > >> > > _______________________________________________ > dev-servo mailing list > dev-servo@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-servo > _______________________________________________ dev-servo mailing list dev-servo@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-servo