Re: Starting

Thanks Joe, I really appreciate you taking the time to explain that. Makes
perfect sense. Thank you.

Ah, good idea regarding AudioBufferSourceNodes! Should've thought of that.

Thanks again,

On 16 April 2013 00:32, Joseph Berkovitz <> wrote:

> Hi Stuart,
> It isn't a silly question at all since it points at the need for clearer
> documentation in the future.
> The reason that ScriptProcessorNodes do not have start and stop times is
> that they act as processors of the raw sample blocks which serve as the
> basis for the AudioContext's operation. These blocks of necessity have a
> regular size and always begin/end at sample block boundaries. Adding
> scheduling to these nodes would make their operation more complicated to
> define and would mess with their "straight to the metal" simplicity.
> The scheduling of a GainNode's gain in front of your noise generator will
> work, but you could also do this within the ScriptProcessorNode although
> it's slightly more complicated. You can examine the playbackTime of each
> AudioProcessEvent, determine whether a start/stop occurs during the current
> sample block, and and begin/cease synthesis of a nonzero signal at the
> appropriate number of frames within the block.
> Perhaps an even simpler (and less performance intensive) way is to
> algorithmically pre-generate one or more reasonably long AudioBuffers of
> white noise and surface these as audio via one or more
> AudioBufferSourceNodes, which can be scheduled with start() and stop(). If
> you needed continuous white noise this wouldn't be so good, but since
> you're emulating drum sounds it may be a reasonable approach.
> .            .       .    .  . ...Joe
> *Joe Berkovitz*
> President
> *Noteflight LLC*
> Boston, Mass.
> phone: +1 978 314 6271
> "Your music, everywhere"
> On Apr 15, 2013, at 6:41 PM, Stuart Memo <> wrote:
> Hi all,
> I'm currently using a ScriptProcessorNode to generate white noise to
> emulate various drum sounds. My understanding from reading the spec is that
> there doesn't seem to be any way of scheduling a ScriptProcessorNode to
> start and stop it at desired times. The best solution to this problem I can
> think of is to schedule a gain node to mute/unmute at a certain time and
> then do my own garbage collection with setTimeout to disconnect the
> ScriptProcessorNode.
> This might be an edge case, and there's probably a very good reason that
> you shouldn't be able to start and stop a ScriptProcessorNode, but I
> thought I would flag it anyway. How about connectAtTime & disconnectAtTime
> as an alternative? Silly? Probably.
> - Stuart

Received on Tuesday, 16 April 2013 08:59:05 UTC