vDSP_conv returning wrong results

Hi!

We're trying to calculate the delay between two audio inputs, represented by float arrays, by getting their maximum correlation, using vDSP_conv. Our solution is very similar to the one in the first answer here, only we are looking at a 0..5000 radius to find the delay in ms:

https://stackoverflow.com/questions/65571299/swift-read-two-audio-files-and-calculate-their-cross-correlation

The problem is that we had mixed results, sometimes the calculated delay is ok, but other times it isn't. Our best guess is that there is some overflow error happening, since the arrays we're working with can be pretty large (they can have around 4-5 million values). If we use a simple foreach to calculate these correlations we get good results, but obviously the is quite slow. Did anyone have similar problems?

Replies

May I suggest you provide an example of your data and the code you're using to Apple via https://feedbackassistant.apple.com/.