Re: AudioBufferSource usage

Hmm, I'm really surprised it works this way. I'm aware that polyphony can
come into play here, as well as potential clicks in the sound, but if you
don't specifically care about that.... in this form, i'm not really sure i
can use this node.

Would it be an idea to alter this behavior? If it had a oneShot parameter
in the constructor that defaults to true, which lets the node behave
exactly like it does now, you could use it in other ways as well. Setting
it to false would allow you to call noteOn and noteOff as many times as you
want, simply restarting the sample every time (on noteOn).


Peter


> On 22/07/2012 10:48, Peter van der Noord wrote:
> > For some reason, i've been reasing over this sentence a few times
> > without actually realizing what it meant:
> >
> > "Once an AudioBufferSourceNode has reached the FINISHED state it will
> > no longer emit any sound. Thus noteOn() and noteOff() may not be
> > issued multiple times for a given AudioBufferSourceNode."
> >
> > This strikes me as quite odd, what's the reasoning for this?
>
> The philosophy appears to be that the buffers are "one shot" only, and
> anything that they're connected to is potentially garbage collected as
> soon as the sample is played.
>
> All nodes appear to be considered short-lived, and if they're not
> connected to anything they'll get garbarge collected.   If you need to
> play the sample again, it's considered "cheap" to instantiate a new
> node, and reconnect it.
>
> Like you, I would prefer to think of nodes as the parts of a modular
> synth, that stay around until they're explicitly disconnected from all
> of their inputs and outputs.
>
> Ray
>
>

Received on Sunday, 22 July 2012 11:41:40 UTC