This project has moved and is read-only. For the latest updates, please go here.

Wrong filterCount for WdlResamplingSampleProvider?

Oct 29, 2015 at 11:36 AM
Edited Oct 29, 2015 at 11:39 AM
The WdlResamplingSampleProvider is created with const filterCount = 2.

Since one filter has a filterorder of 2, it produces a transferfunction of order 2x2 = 4.
I have rebuild the filter in Matlab and the bodeplot would look like this:

https://www.dropbox.com/s/dzxahfr5h5sqof1/BodeFilt2x2.jpg?dl=0

Fs = 44100 Hz
FsDown = 14700 Hz

I think the filterorder is to slow. For example if you have a quantization of 16 bit, then a good antialiasing-filter should have an attenuation of 6.02 * N_QuantBit = 96dB.

To get this 96 dB, the correct filterCount would be 12.
This would look like this:

https://www.dropbox.com/s/tt0qln2lpe1v6sq/BodeFilt12x2.jpg?dl=0

I would suggest to calculate the dynamic filterCount in the constructor:

int filterCount = (int) Math.Floor(6.02*source.WaveFormat.BitsPerSample/8)/2;
resampler.SetMode(true, filterCount, false);

So do I missed something or what is your opinion?
Oct 29, 2015 at 3:23 PM
The NAudio code is a straightforward port of the original C++ code from the WDL library, used with permission. If you have questions about the implementation, I suggest you ask them over at the WDL forums on the cockos site.
Oct 29, 2015 at 3:33 PM
markheath wrote:
The NAudio code is a straightforward port of the original C++ code from the WDL library, used with permission. If you have questions about the implementation, I suggest you ask them over at the WDL forums on the cockos site.
Yeah I know, they helped me out with some information about the filters.

But the filterCount is set by WdlResamplingSampleProvider and not the WDLResampler itself. So I thought it's kinda NAudio-thing. Anyway, I thought it would be interesting for you to know.
Oct 29, 2015 at 3:37 PM
OK, thanks. I'll try to take another look at this.