Got it - here's what worked in the end:> Anyone have experience using the 'conv' function described in vDSP.h?

> I can sort of get it to work, but can't figure out how the output is

> aligned in the result array (or be sure how it should be aligned in

> the input arrays - is there FFT style swapping of segments?). I get

> a convolved signal out but I seem to lose more at the ends than I'd

> expect.

> ...

1) pick a filter length (must be between 4 and 26 floats)

2) pick the length of the convolution result (must be more than 36

floats)

3) the length of the *input* signal must then be at least the sum of

the

lengths of the filter and the output minus one (the ends will not be

valid).

In my case I wanted the output result to be the same length as the input

vector, and to be correctly aligned with the input so I could replace a

signal with a smoothed copy of itself. Zero padding at the beginning

and end of the signal with half the length of the filter at each end (

for a total number of zeros equal to the length of the filter) produced

the desired result. For example:

length of original signal = 64 floats

filter length = 16 floats

desired result length = 64 floats

signal length to pass to conv() = 80 floats (minimum would be 79)

signal is zero padded at each end before passing to conv:

0 0 0 0 0 0 0 0 (64 floats) 0 0 0 0 0 0 0 0

I guess this is a fairly standard arrangement for convolution, but I

wish Apple provided more doentation for these useful functions!

## Bookmarks