- From: Jussi Kalliokoski <jussi.kalliokoski@gmail.com>
- Date: Thu, 9 Jun 2011 10:15:24 +0300
- To: Chris Rogers <crogers@google.com>
- Cc: public-audio@w3.org
- Message-ID: <BANLkTimh5KJERHohWQbLAtDQS9ELKDhOdw@mail.gmail.com>
On Tue, Jun 7, 2011 at 8:27 PM, Chris Rogers <crogers@google.com> wrote: > > > On Mon, Jun 6, 2011 at 1:48 PM, Jussi Kalliokoski < > jussi.kalliokoski@gmail.com> wrote: > >> Yeah, that being the main case and also that of abstraction layers, such >> as if someone wrote, for instance something called a MixerNode, that uses >> gain nodes to take multiple inputs and such, maybe AUXes or whatever. Also, >> now that I think of it, it would be pretty handy if AudioParam was an >> instance of EventTarget, so you could add listener hooks to such things as >> onChange or onAutomationEnd (I don't know about this one), don't you think? >> It might complicate the thing a bit, but at the benefit of hackability, and >> that's always a good thing if you want to attract developers. > > > Hi Jussi, with automation the AudioParam value can change for every single > sample-frame, so I think it would be pretty dramatic to have an > EventListener get called thousands of times a second! Instead, I think it > should be possible to query the AudioParam for its value at any exact time. > You're right. However this makes me think of interaction with UI elements such as knobs, could there be some call like AudioParam.scheduleValue (that's a stupid name for it, but...) that would define the value of that AudioParam relative to the time of calling, so that you could get a smooth change in the value instead of change on every buffer fill callback? > > > > > >> Also, now that I'm asking, can you dereference AudioParams? For example, >> make two separate AudioGainNodes and make them share the AudioParam for >> .gain? As here: >> >> var gain1 = ctx.createGainNode(); >> var gain2 = ctx.createGainNode(); >> gain1.gain = gain2.gain; >> gain1.gain.value = 0.5; >> > > >> >> And that would change the value of both? I could've just tried, but quite >> honestly I'm pretty ill and tired, so I'll just ask. :) >> > > I believe this should work. > Great! > > >> >> I think that would be a useful feature to have, if it's not that way. >> After all, it only follows the same logic as do most things in javascript, >> for example being able to do Array.prototype.slice.call(arguments, 1); sorta >> things. >> >> I realize these things have many complicating effects, >> implementation-wise, but I'm just throwing things at you and the rest of us, >> to see whether you think they're good ideas or not. >> >> Another thing about AudioParam on my mind may be completely absurd, the >> fever talking and impossible to implement (I'm not sure if V8 for instance >> allows that, without changing the toString), but what if the primitive of >> AudioParam was the value of it? That way one could use normal number values >> in stead of AudioParams, if one pleases, and yet not making horrible >> performance sacrifices in checking whether it's an audio param or not on >> every sample, for example: >> >> sample = sample * myGainlikeEffect.gain; >> >> versus >> >> sample = sample * (isNaN(myGainlikeEffect.gain) ? >> myGainlikeEffect.gain.value : myGainlikeEffect.gain.value); >> >> This would be similar to behaviour of Date(), as +new Date does the same >> trick as (new Date).getTime(). >> > > I'll have to think about this one, but I'm not sure I understand your > example here. If you want to use the time-varying AudioParam values over a > time-range,then I think it might be better to have a method to get the > values into a Float32Array, then work from there. > Actually that's a far better idea! > > > >> >> I'm sorry not having brought up these things earlier, but such things come >> to mind only when you have a working prototype to play with. >> >> Jussi >> >> On Mon, Jun 6, 2011 at 9:33 PM, Chris Rogers <crogers@google.com> wrote: >> >>> Hmmm, that's an interesting idea. I assume you're talking in the context >>> of a JavaScriptAudioNode? In this case, I can see where it might be useful >>> to add your own AudioParams to the JavaScriptAudioNode, then they could be >>> automated (envelope, fade-in/out, LFO, etc.) just like any other parameter. >>> If you wanted to get sample-accurate parameter data then we'd have to add >>> another method (something like requesting to fill a Float32Array for a given >>> time range) from AudioParam, so custom DSP code can do useful things with >>> it... >>> >>> Chris >>> >>> >>> On Mon, Jun 6, 2011 at 10:26 AM, Jussi Kalliokoski < >>> jussi.kalliokoski@gmail.com> wrote: >>> >>>> Hello Chris, others, >>>> >>>> Is there a way to create an AudioParam from your code, I've tried >>>> several things in the fashion of >>>> >>>> new (new webkitAudioContext).createGainNode().gain.constructor >>>> >>>> but I keep getting errors, like Illegal constructor. Is it possible to >>>> do? Would be pretty handy when crafting your own effects. >>>> >>>> Jussi >>>> >>> >>> >> >
Received on Thursday, 9 June 2011 07:15:52 UTC