<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Dear Perry,<br><br>Thanks very much for the response and for testing the program performance. I am certainly running much much more than the convolution process. I'm not advancing time every sample but I am sending and receiving Events at a fundamental frequency (every 6 - 15 kHz depending on the configuration) however, I would not expect this to take over the system performance. I mentioned previously that running my program without the convolution function took the JACK DSP Load from about 2.5% to about 3.5%.<br><br>After further tests I've found that the sample size, the equivalent to "CelloBodyShort.wav", has very big impacts on the performance. A sample size of 8KB or about 160ms raises the JACK DSP Load to about 30%. A sample size of between 16KB or about 320ms raises the JACK DSP Load to over 60%. And finally a sample size above 16KB pushes the DSP Load to 100% with lots of Xruns. Is this consistent with your measurements?<br><br>I am now running the convolution process and my CPU usage is around 8.5% with the JACK DSP Load running at about 35%. So it appears that my problem is more around the performance of JACK. I'll keep testing. I'd like to run much longer samples than 320ms.<br><br>Regards,<br>Mitch<br><br><div>> From: prc@CS.Princeton.EDU<br>> Date: Wed, 23 Sep 2015 14:15:13 -0700<br>> To: chuck-users@lists.cs.princeton.edu<br>> Subject: Re: [chuck-users] FFT Convolution and CPU Load<br>> <br>> Hum….<br>> <br>> Just checked my example and my CPU went from 7% to 11% when I kicked on<br>> the FFTConvolve.ck program you cite. We can’t see all your code, so not sure what’s<br>> going on. Are you updating really often, like advancing time every sample or <br>> something?<br>> <br>> PRC<br>> <br>> <br>> <br>> > On Sep 22, 2015, at 9:00 AM, chuck-users-request@lists.cs.princeton.edu wrote:<br>> > <br>> > // FFT convolution with static impulse response<br>> > // by Perry R. Cook, November 2014<br>> > // upsides: as efficient as it could be, save for <br>> > // constructing a specific fft convolution chugin<br>> > // downsides: minimum delay is length of impulse response + buffers<br>> > // fix: break into pieces and overlap add<br>> > // Other fix: see filter version using my FIR Filter chugin<br>> > <br>> > // our fixed convolution kernal (impulse response)<br>> > SndBuf s => FFT ffth => blackhole; <br>> > "CelloBodyShort.wav" => s.read; // whatever you like (caution of length!!)<br>> > 2 => int fftSize;<br>> > while (fftSize < s.samples()) <br>> > 2 *=> fftSize; // next highest power of two<br>> > fftSize => int windowSize; // this is windowsize, only apply to signal blocks<br>> > windowSize/2 => int hopSize; // this can any whole fraction of windowsize<br>> > 2 *=> fftSize; // zero pad by 2x factor (for convolve)<br>> > // our input signal, replace adc with anything you like<br>> > adc => Gain input => FFT fftx => blackhole; // input signal<br>> > IFFT outy => dac; // our output<br>> > fftSize => ffth.size => fftx.size => outy.size; // sizes<br>> > Windowing.hann(windowSize) => fftx.window;<br>> > // <<< s.samples(), fftSize >>>;<br>> > windowSize::samp => now; // load impulse response into h<br>> > ffth.upchuck() @=> UAnaBlob H; // spectrum of fixed impulse response<br>> > s =< ffth =< blackhole; // don't need impulse resp signal anymore<br>> > <br>> > complex Z[fftSize/2];<br>> > 1000 => input.gain; // fiddle with this how you like/need<br>> > <br>> > while (true) {<br>> > fftx.upchuck() @=> UAnaBlob X; // spectrum of input signal<br>> > <br>> > // multiply spectra bin by bin (complex for free!):<br>> > for(0 => int i; i < fftSize/2; i++ ) {<br>> > fftx.cval(i) * H.cval(i) => Z[i];        <br>> > } <br>> > outy.transform( Z ); // take ifft<br>> > hopSize :: samp => now; // and do it all again<br>> > }<br>> <br>> _______________________________________________<br>> chuck-users mailing list<br>> chuck-users@lists.cs.princeton.edu<br>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users<br></div>                                            </div></body>
</html>