W3C home > Mailing lists > Public > public-audio-dev@w3.org > September 2013

Re: multiple script processors not working in a row

From: Joseph Berkovitz <joe@noteflight.com>
Date: Fri, 20 Sep 2013 13:12:05 -0400
Cc: public-audio-dev@w3.org
Message-Id: <E2153BAF-F3FD-4F2C-BF16-9157EFE07601@noteflight.com>
To: Erik Werner <ew.rikner@gmail.com>
Looks like you have a couple of mistakes in the code:


>             //some other script processor node, just passing through the signal
>             var otherScriptProcessorNode = audioContext.createScriptProcessor(BLOCKLENGTH,1,1);
>             otherScriptProcessorNode.onaudioprocess = function(e){
>                 var otherNodeInput = e.inputBuffer.getChannelData(0);
>                 var otherNodeInput = e.outputBuffer.getChannelData(0);
>                 otherNodeInput = otherNodeInput.subarray();

1. You probably meant to have two variables here: otherNodeInput and otherNodeOutput. Otherwise you'll be copying the output array back to itself.

2. Even after you have two variables, assigning an array to the local variable otherNodeOutput will not copy the data, it will just change what array that local variable points to. You'll need to do this instead:

                otherNodeOutput.set(otherNodeInput);


Best,

.            .       .    .  . ...Joe

Joe Berkovitz
President

Noteflight LLC
Boston, Mass.
phone: +1 978 314 6271
www.noteflight.com
"Your music, everywhere"


Received on Friday, 20 September 2013 17:12:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:03:50 UTC