*/ /////////////////////////////////////////////////////////////////////// ( // simple forward and inverse transform of the same signal. // just proves that you can get back out what you put in.. // Since this is a direct in and out without modification, there is no overlap-add going on. // in these simple, sort of modular experiments, we extract amp, phase, run a blip through it // to show lobes, etc. try different combinations. // lp, dr { var fftsize, cosineTable, src, fft, ifft; fftsize = 4096; cosineTable = Signal.fftCosTable(fftsize); // make cosine table required for FFT // src = LFPulse.ar(SinOsc.kr(0.4, 0, 200, 300), 0.3, 0.9); // input wave // src = LFPulse.ar(400, 0.3, 0.1); // src = SinOsc.ar(Line.ar(1, 8000, 10), 0, 0.5); // src = SinOsc.ar(Line.ar(1, 8000, 10), 0, 0.5); // src = Blip.ar(50, Line.kr(1,100,20), 0.8); src = Blip.ar(Line.kr(20, 1000, 50), 25, 0.8); // fourier transform fft = FFT.ar(fftsize, 0, cosineTable, nil, nil, src, 0.0); // Scope.window("IFFT", fftsize/2, nil, fft.magnitudeApx); // inverse fourier transform ifft = IFFT.ar(fftsize, 0, cosineTable, nil, nil, fft.real, fft.imag); s = atan(fft.imag/fft.real); // m = hypot(fft.imag, fft.real); // m = m * 15; s = s * 30; Scope.window("IFFT", fftsize/4, nil, 2* s/fftsize); src }.play )