[chuck-users] real-time convolution in Chuck
Daniel Chapiro
dchapiro at gmail.com
Mon Nov 24 20:51:43 EST 2014
Hi - I have a performance problem, and I wonder if anyone has already solved this. I want to do a time-domain convolution of a real time signal (generated with a MIDI controller) and an IR of a cello body (a short .wav file).
TIME DOMAIN:
I tried first doing it brute-force, in the time domain:
(1) I pre-loaded the IR wav file (with SndBuf) into an array (truncated to N elements), and normalized the values (divided by the sum of the abs values)
(2) using .last() I kept grabbing each music sample (and keeping the last N values in a circular buffer)
(3) for each new music input value, I convolved the last N with the IR, and then stuffed the output into the dac (using an Impulse UGen)
Surprisingly, it worked. Not surprisingly it ran out of steam with N > 50… ;-)
Has anybody coded this as a Chugin, and made it work with reasonable-size IRs?
FREQUENCY DOMAIN:
Would this go much faster if instead of the above, I pre-computed the DFT of the IR, and then went in block fashion doing FFTs of the music, multiplying by the IR spectrum, doing the iFFT, and overlap-summation to get the time domain signal?
Has anybody coded this in Chuck or as a Chugin?
SC:
Or is this the kind of application for which I should go with SuperCollider instead, to get the required real-time performance?
Thanks,
Daniel
More information about the chuck-users
mailing list