pd-externals / earplug

binaural filter based on KEMAR impulse measurement for Pd
GNU General Public License v2.0
14 stars 1 forks source link

Interpolation issue #8

Closed chikashimiyama closed 3 years ago

chikashimiyama commented 3 years ago

The author of earplug tried to interpolate the previous impulse response and the current impulse by crossfading it. However, the current implementations have two issues.

  1. It is not working

https://github.com/pd-externals/earplug/blob/0ba02415bbbf6381083442d2f2c90b08cd8e744d/earplug~.c#L171-L172 the copy from the current to the previous buffer is executed in the convolution process of the first iteration of the blocksize. From the second sample, the current and previous buffer are the same thus, interpolation is not working at all.

  1. interpolation should be independent of the block size.

In the current implementation, the duration of interpolation depends on the sample rate and block size. Because the crossfade duration is matched with the block size. Thus, if the user changes the SR or block size, the interpolation duration will be changed accordingly and it results in a significant audible difference. This should be avoided.

chikashimiyama commented 3 years ago

My first approach is to get rid of this interpolation since it is not properly implemented (interpolation duration should be fixed independent of SR or blocksize)

chikashimiyama commented 3 years ago

@danomatika

Please check out the PR and merge if you think it makes sense.

danomatika commented 3 years ago

It seems to work fine for me. I compared the interpolation_issue branch and develop at 44.1, 48, & 96 SRs.

The biggest thing I noticed is that the CPU usage seems to drop by almost half when just running the sample patch!

danomatika commented 3 years ago

@umlaeute Can you check #11?

danomatika commented 3 years ago

I will go ahead and assume this is working as intended...

danomatika commented 3 years ago

Closed by merging #11.