People who use hrtflib often don’t have a background in audio programming, and so they ask me what to do with the output of that library. The answer is convolution. There is tons of information on the net about it, and there is lots of cover on it but I wanted to put up a simple code sample in C, to show how convolution works. Here it is:

void Convolve(const float* const input, unsigned int inputLength, const float* const filter, unsigned int filterLength, float* output) { unsigned int i; unsigned int j; unsigned int lengthOfOutput = inputLength + filterLength - 1; for(i = 0; i < lengthOfOutput; ++i) { output[i] = 0.f; } for(i = 0; i < inputLength; ++i) { for(j = 0; j < filterLength; ++j) { output[i + j] += input[i] * filter[j]; } } } |