Hi Fernando,

I cannot try it right now but I think you can use this function:

adc.last() to get each unitary sample.
last() is normally available for all UGen so I think it is ok for adc.

Use a loop to fill your input[] array and when filled call your discreteHaarWaveletTransform function.

Have fun,
Ju


2013/5/13 fernando alonso <lualobus@gmail.com>
Hi guys,

I have implemented the Wavelet Transform in Chuck (to work with it moreover of FFT, etc). The code is:

fun int[] discreteHaarWaveletTransform( int input[]){
    int sum, difference,length,i;
    int  output[input.cap()];


    for ( (input.cap() >> 1) => length ; true ;  (length >> 1) => length) {
        for (0 => i; i < length; ++i) {
            input[i * 2] + input[i * 2 + 1] => sum;
            input[i * 2] - input[i * 2 + 1] => difference;
            sum => output[i] ;
            difference => output[length + i];
        }
        if (length == 1) {
            return output;
        }

        //Swap arrays to do next iteration
        for (0=>i; i < (length<<1); i++){
            output[i] => input[i];
        }
    }
}



The only one problem is that I don't know how get from adc the values of the microphone input signal. I don't want to use FFT or similar. My implementation of Haar Wavelet Transform need this values.


Anybody knows how get its?

Thanks so much.


--
Fernando Alonso Martín
Lualobus@gmail.com


_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users