XCut


Select one from an array of inputs. When index is changed, fades between the old and new signals using switch-and-ramp technique, minimizing audible artefacts/clicks.


Class methods


*ar(inArray, which, envLength, mul, add)


inArray - array of inputs.


which -  index of the signal to select.


envLength -  length of the x-fading window in samples, (default 2000).



Examples



// execute this line first

b=Buffer.read(s,"sounds/a11wlk01.wav");


// now, execute this block and click the mouse button to switch between two signals

(

s.doWhenBooted {

  {

    var b1,b2;

    b1 = PlayBuf.ar(numChannels:1,bufnum:b,trigger:LFPulse.ar((1/b.duration)*3));

    b2 = PlayBuf.ar(numChannels:1,bufnum:b,startPos:b.numFrames/2,trigger:LFPulse.ar((1/b.duration)*2));

    

    XCut.ar([b1, b2], MouseButton.kr(0,1,0))

  }.play

}

)