Hi, Siebe! Welcome on board, IMHO there is a great shortage of Dutch ChucKists so it's good to see you here.
Thanks for your reply, Kas. I hope I can help making ChucK a bit more popular around here, I'm sure others will like the way it works.
As FFT expects to deal with complex numbers it's not so surprising that the one using floats doesn't work.
Now I'm afraid you misunderstand. The one getting complex numbers is an IFFT.
From the manual:
fft.transform(float[]) //input fft, which i believe doesn't work. fft.spectrum(complex[]) //output fft, which works when using fft.upchuck() ifft.transform(complex[]) //input ifft ifft.samples(float[]) //output ifft Also, both examples run, the FFT one is just not giving any output. In my experience the VM will break and give an error when variable types don't match, so that's not my problem here. I'm currently trying to tweak around a bit with the signal chain. There the types do not exactly match, but that I could correct with a dummy IFFT (FFT fft => IFFT dummy => blackhole), also that didn't help. IMO there really seems to be a problem with he fft.transform function. I can't get it to do anything. Siebe _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Siebe; Thanks for your reply, Kas. I hope I can help making ChucK a bit more
popular around here, I'm sure others will like the way it works.
That would be interesting. Might be hard as I understand HKU students are already learning about MAX and SC as well. I think it's clear that there is a space for all three but of course everyone's time is limited.
As FFT expects to deal with complex numbers it's not so surprising that the one using floats doesn't work.
Now I'm afraid you misunderstand. The one getting complex numbers is an IFFT. From the manual:
Well, yes, I miss-read the examples and didn't read carefully enough. For some reason I also kept copying the line numbers on those pages along with the code, even when they weren't highlighted. I'll try again. Could be just me making mistakes again.
Also, both examples run, the FFT one is just not giving any output. In my experience the VM will break and give an error when variable types don't match, so that's not my problem here.
Quite so, yes.
I'm currently trying to tweak around a bit with the signal chain. There the types do not exactly match, but that I could correct with a dummy IFFT (FFT fft => IFFT dummy => blackhole), also that didn't help. IMO there really seems to be a problem with he fft.transform function. I can't get it to do anything.
Right, I'll have a close look at it right now. Sorry about not reading your examples with enough care Yours, Kas.
Fellow ChucKists, Below I'm pasting a slight edit of this example; http://chuck.cs.princeton.edu/doc/examples/analysis/win.ck Note that my change involved editing out the upchuck and replacing it with a transform on a array full of zero's. We'd expect that to result in silence. Instead it sound exactly like the original example. I believe this means that ,transform() is still looking to FFT's input instead of to the array fed to it. In Siebe's case that meant silence as he didn't chuck a UGen into his FFT. I further tested this by feeding the input of FFT in Siebe's code with a Noise UGen and indeed in that case the printout dutifully supplies us with a train of numbers. So, yes, that's a bug, probably a typo on .transform()'s code which seems to be taking the wrong array. Yours, Kas. ========demo code follows============== // our patch SinOsc g => FFT fft => blackhole; // synthesis IFFT ifft => dac; // set srate second / samp => float srate; // set parameters 1024 => fft.size; // window Windowing.hamming(512) => fft.window; Windowing.hamming(512) => ifft.window; // use this to hold contents complex s[fft.size()/2]; // divide int div; float foo[fft.size()]; //note this is a array holding just zero's and will stay that way // control loop while( true ) { // set freq srate / fft.size() * div++ => g.freq; fft.size()/2 %=> div; // take fft //fft.upchuck(); //commented out by Kas fft.transform(foo); //added by Kas // get contents fft.spectrum( s ); // take ifft ifft.transform( s ); // advance time 256::samp => now; }
participants (2)
-
Kassen
-
Siepie