• Welcome to ASR. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Alternative reconstruction method for PCM upsampling: impulse response, spectrograms, and samples

The easiest way to check if the filter is implemented correctly (including the downsampling/decimation) is to check the frequency and phase response. From a quick glance at the plots, it looks OK to me.
 
I have managed to implement @RandomEar sinc lin-fast 512-tap filter as the comparison baseline. Coefficients are natively designed for 8x, so I zero-stuff by 8, convolve, and decimate by 2 to get the 4x output. Should be faithful to the filter's intended operation if I did this right.
You can also re-normalize the coefficients for 4x upsampling. That would save you the decimation step.

The sum of the filter coefficients represents the integral under the impulse response curve. Technically it's a stair-stepped approximation, but at 513 coeffs it's close enough. That integral determines the amplitude gain of the filter. Currently the sum is 1, but for your use case I think it should be 2.

EDIT: That will change the delay of the filter, though. And thinking anout it, it should also halve the stopband frequency, right? Probably better to stay with upsampling to 8x and decimating.
 
Last edited:
You can also re-normalize the coefficients for 4x upsampling. That would save you the decimation step.

The sum of the filter coefficients represents the integral under the impulse response curve. Technically it's a stair-stepped approximation, but at 513 coeffs it's close enough. That integral determines the amplitude gain of the filter. Currently the sum is 1, but for your use case I think it should be 2.

EDIT: That will change the delay of the filter, though. And thinking anout it, it should also halve the stopband frequency, right? Probably better to stay with upsampling to 8x and decimating.
Thanks for confirming! Yes, I'm sticking with the 8x -> decimate path. Works cleanly it seems.
Next thing I’ll try to address in amplitude difference so the comparisons can be even more precise.
 
19 kHz sine - progress

Following up on the 19 kHz request frrm @voodooless . The original issue was that near-Nyquist tones triggered the transient detection path., high derivative magnitude looks the same whether it's a fast-changing tone or an actual onset. With only ~2.3 samples per cycle, the backward stencil had almost nothing to fit, producing ugly polynomial artifacts and audible artifacts.

The fix uses an integral-based tonality detector. Derivatives tell you "how fast is it changing" but not whether the change is periodic or sudden. Integrals reveal that distinction. Tonal content now gets the centered stencil (correct for steady-state), while transients still get the full backward stencil treatment.

composite_vs_sinc.png


Top: original 44.1 kHz. Middle: composite 176.4 kHz. Bottom: sinc reference.

Amplitude envelope isn't perfectly uniform, expected with polynomial reconstruction at ~2.3 samples/cycle. Well below audibility at 19 kHz.

Apologies, for using bad sinc again. The proper filter from @RandomEar is in another branch, will merge it soon though.
 
Back
Top Bottom