IDWT Inverse Discrete Wavelet Transform


Inherits from: Object : AbstractFunction : UGen 



IDWT.new(chain, wintype, winsize, wavelettype)

IDWT.ar(chain, wintype, winsize, wavelettype)



The wavelet transform analyzes the input signal with respect to a mother wavelet at a number of scales. The IDWT UGen returns from the wavelet coefficient domain to the time domain. 

 Most often this is used as the end of a process which begins with DWT, followed by scale-domain processing using WT (wavelet-transform) UGens, followed by IDWT.


chain - The FFT "chain" signal coming originally from an DWT UGen, perhaps via other WT UGens.

wintype - defines how the data is windowed:

-1 is for rectangular windowing, simple but typically not recommended; 

0 (the default) is for Sine windowing, typically recommended for work when the signal is reconstructed; 

1 is for Hann windowing, typically recommended for analysis work.

winsize - can be used to account for zero-padding, in the same way as the DWT UGen.

wavelettype - The choices of wavelet are those available in the gsl wavelet library code (http://www.gnu.org/s/gsl/manual/html_node/DWT-Initialization.html). Each is given a numeric code as follows (see the web page for the explanation of k):

0-8 gsl_wavelet_daubechies, k = 4,6,8,10,12,14,16,18,20

9-17 gsl_wavelet_daubechies_centered, k = 4,6,8,10,12,14,16,18,20

18 gsl_wavelet_haar, k=2

19 gsl_wavelet_haar_centered, k=2

20-30 gsl_wavelet_bspline, k=103, 105, 202, 204, 206, 208, 301, 303, 305, 307, 309

31-41 gsl_wavelet_bspline_centered k=103, 105, 202, 204, 206, 208, 301, 303, 305, 307, 309



The IDWT UGen converts the DWT data in-place (in the original DWT buffer) and overlap-adds the result to produce a continuous signal at its output.





// example

(

{ arg out=0;

var in, chain;

in = WhiteNoise.ar(0.05);

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

Out.ar(out, 

[IDWT(chain),in] // inverse DWT

);

}.play;

)



//direct synthesis via writing values to buffer (try changing wavelet type...)


(

b = Buffer.alloc(s,1024); 

b.zero;

)


(

{

var chain;

chain = FFTTrigger(b); //works as DWT substitute too

Out.ar(0, (0.1*IDWT(chain,wintype:-1)).dup(2));

}.play;

)


//run this to change sound: WARNING, NOISY!

b.setn(0,Array.rand(1024,-1.0,1.0)); 



b.setn(0,Array.fill(1024,{|i| i/1024.0})); 



b.setn(0,Array.fill(1024,{|i| 1.0-(i/1024.0)})); 



b.setn(0,Array.fill(1024,{|i| [exprand(0.001,0.1),exprand(0.001,0.1).neg,1.0.rand].choose})); 



b.setn(0,Array.fill(1024,{|i| [exprand(0.001,1.0),0.0].wchoose([0.1,0.9])}));