The xcorr function calls the conv function, which again uses fft. If you 
know the general structure and length of your signals ahead of time, you 
can probably gain some performance by planning the ffts beforehand. I don't 
know why it doesn't work for you, but you could have a look in at conv in 
dsp.jl.

If you *really* want to speed things up, though, you might implement your 
own xcorr.  xcorr dominates the runtime in your function, and if you know 
an upper bound on the signal lags, you can implement xcorr with a limited 
number of lags. By default xcorr calculates for all lags (in your case 
that's 2*48000*60-1 ~ 6million lags). If you know that the max lag is 1 
second, you can save ~98% percent of the runtime of xcorr.

A couple of other remarks:
* There's no need to put type annotations next to the function outputs, 
it's just visual noise
* Use ct_idx = cld(lₛ, 2) and forget about the mod.

Reply via email to