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