WT_MagAbove pass coefficients above a magnitude threshold


WT_MagAbove(buffer, threshold = 0.0, startindex = 1)


Zeroes out any coefficients whose magnitude is not above a threshold.


buffer - dwt buffer.

threshold - absolute magnitude threshold for coefficients

startindex - index of coefficient to begin thresholding at. Defaults to 1 to avoid zeroing the maximal lowpass smoothing information before reconstruction, but you can threshold on that too if you set this to 0 (or start at a higher scale). 




s.boot;


b = Buffer.alloc(s,1024,1)


(

SynthDef("help-magAbove", { arg out=0;

var in, chain;

in = WhiteNoise.ar(0.2);

//in = SoundIn.ar; 

chain = DWT(b, in);

chain = WT_MagAbove(chain, MouseX.kr(0.0,0.5)); 

//chain.poll;

Out.ar(out, 0.5 * IDWT(chain).dup);

}).play;

)


//noisy

(

SynthDef("help-magAbove", { arg out=0;

var in, chain;

in = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));


chain = DWT(LocalBuf(1024), in);

chain = WT_MagAbove(chain, MouseX.kr(0.0,7.0)); 


Out.ar(out, 0.3 * IDWT(chain).dup);

}).play;

)


b.free;