• 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!

The Perfect CD Sample Rate Converter (Shannon Interpolation)

JulianW

Member
Joined
Jan 12, 2025
Messages
72
Likes
34
Shannon Reference64 — 44.1 → 88.2 kHz


An offline reference sample-rate converter based directly on ideal Shannon interpolation.


Exact-copy interpolation:
Every original 44.1 kHz sample is preserved exactly. Only the new samples located halfway between the original samples are calculated.


Global interpolation:
The complete recording is processed as one finite signal. There are no processing blocks and no independently windowed sections.


No truncated sinc:
There is no selectable FIR length or finite number of taps. The interpolation uses the complete finite recording rather than truncating the reconstruction kernel to a predetermined length.


No window function:
No Kaiser, Blackman, Hann, or other window is used.


Exactly zero passband ripple:
The mathematical Shannon reconstruction has unity gain throughout the entire open passband. Passband ripple is therefore exactly 0 dB, rather than merely being designed below some tolerance.


Exactly zero-width transition band:
The ideal cutoff occurs directly at the original Nyquist frequency of 22.05 kHz. There is no finite transition region between passband and stopband.


Ideal stopband = zero:
Above 22.05 kHz, the mathematical response is exactly zero, corresponding to −∞ dB attenuation in the ideal definition.


No filter-design parameters:
There is no chosen passband ripple, stopband attenuation, transition width, tap count, window, weighting function, or optimization target. These are not design specifications—the Shannon reconstruction itself defines the result.


What is unusual about this new Shannon version is that it is no longer merely trying to calculate the interpolation very accurately in ordinary floating-point arithmetic. The goal is to determine the correctly rounded IEEE-754 binary64 result for every interpolated sample.


For 2× interpolation, the new samples are mathematically defined by


> y_k=
> \frac{2}{32768\pi}
> \sum_n
> \frac{q_n(-1)^{k-n}}{2(k-n)+1}.
>


The problem is that, because of \pi, the exact result will generally be irrational. Therefore it cannot normally be represented exactly as a binary64 number.


The new implementation approaches this differently. Instead of pretending that a finite approximation of \pi is exact, it constructs certified upper and lower bounds for \pi, based on exact rational arithmetic and the Machin formula


> \pi=16\arctan(1/5)-4\arctan(1/239).
>


Those bounds propagate through the Shannon calculation, giving a mathematically guaranteed interval


> L_k\le y_k\le U_k
>


containing the exact real-valued Shannon result.


The program then asks a very strict question: do both ends of that interval round to exactly the same IEEE-754 binary64 value?


> RN_{64}(L_k)=RN_{64}(U_k).
>


If they do, the program has established which binary64 number the exact mathematical Shannon result must round to. It then outputs that value.


If the interval is still too wide to make that decision, the program does not guess and does not fall back to an approximate result. The calculation is repeated at higher internal precision. The current adaptive version starts at 96-bit kernel precision and escalates to 128-bit precision when necessary.


On an actual music file I tested, this was not merely theoretical: at 96-bit precision, 718 samples in one channel and 632 in the other could not yet be certified. The program automatically repeated those channels at 128-bit precision, resolved the ambiguity, and only then completed the conversion.


So the interesting part is not simply that it “uses 128 bits”. The important part is that the extra precision is used to prove the final rounding decision. Internal precision is only a means to establish which point on the binary64 lattice contains the correctly rounded result.


There is also no intermediate 24-bit quantization in this version. The final target is binary64 itself:


> \boxed{
> \text{exact Shannon expression}
> \rightarrow
> \text{certified enclosure}
> \rightarrow
> \text{correct binary64 rounding cell}
> \rightarrow
> \text{64-bit float WAV}
> }
>


In other words, the objective is no longer “make the numerical error extremely small”. It is: do not release an interpolated sample until the program can certify which binary64 value the ideal Shannon interpolation rounds to.


 
Last edited:
Sorry ELI5 what is the purpose?
The purpose is to create an offline reference for 44.1 → 88.2 kHz conversion with as few arbitrary design choices as possible.


Conventional SRCs approximate ideal reconstruction using a finite filter, which means choosing things like filter length, transition width, windowing, passband ripple and stopband attenuation.


This one simply uses global Shannon interpolation of the complete file. So the original samples are preserved exactly, while the samples between them are reconstructed according to the sampling theorem.


I’m not claiming it sounds better. The point is to see what happens when computational cost and realtime operation are irrelevant and the mathematical ideal itself is used as the reference.
 
Sorry ELI5 what is the purpose?
In theory, feeding the DAC 88.2 kHz instead of 44.1 kHz can make its job easier. The difficult first interpolation stage has already been performed offline, so the DAC no longer has to transition from the 44.1 kHz audio band to its first image over such a narrow frequency range. At 88.2 kHz, the first image is much farther away, giving the DAC a much wider guard band and therefore a less demanding filtering problem.


This does not guarantee a better analog output — it depends on the DAC’s internal architecture — but it potentially moves the most demanding interpolation step from the DAC into a controlled offline process.
 
Can you do a comparison with DeltaWave's built in SRC like here?

 
The purpose is to create an offline reference for 44.1 → 88.2 kHz conversion with as few arbitrary design choices as possible.
But why upsample at all? I so far see no practical purpose. If it's just a theoretical math experiment, then nvm
 
In theory, feeding the DAC 88.2 kHz instead of 44.1 kHz can make its job easier.
...
This does not guarantee a better analog output — it depends on the DAC’s internal architecture — but it potentially moves the most demanding interpolation step from the DAC into a controlled offline process.
But DACs are basically solved, and relatively cheap.

Dies this require putting a computer full-time in the audio signal chain?
 
But why upsample at all? I so far see no practical purpose. If it's just a theoretical math experiment, then nvm
There are practical DSP benefits as well. Processing at a higher sample rate reduces frequency warping in bilinear-transform-based filters such as biquads, especially toward the upper end of the audio band. It also gives subsequent DSP stages more spectral headroom.


So the purpose isn’t to create new information above 22.05 kHz. It’s to move the existing 44.1 kHz signal onto a higher-rate sampling grid before subsequent DAC or DSP processing.



The motivation was simply to see what can be achieved if the goal is rigorously the best possible offline conversion, with computation time being the only real downside I’m willing to accept. I’m deliberately not optimizing for speed, latency, memory usage, or real-time operation. The question was: if I’m willing to wait, how close can I get to the mathematical ideal?
 
But DACs are basically solved, and relatively cheap.

Dies this require putting a computer full-time in the audio signal chain?
I agree that modern DACs are already extremely good. My question is simply: why stop at “good enough” when CPU power and storage are no longer meaningful constraints for offline processing?


If I don’t need real-time operation, I see little reason to deliberately accept approximations just to save computation time. I can instead push the calculation until the meaningful limitation is essentially numerical precision itself — whether that’s Float64, or potentially even higher precision.


I’m not claiming that this produces an audible improvement. The motivation is engineering rather than audibility: if the computational resources are available, I want to know how close to the mathematical ideal the process can actually be.
 
Can you do a comparison with DeltaWave's built in SRC like here?

Sure. I’m away from home at the moment and don’t have access to my PC, but I’ll do the DeltaWave comparison when I’m back.
 
Good enough means transparent. Inaudible technical improvements are a waste of resources.
Sure, but in this case the “waste of resources” amounts to waiting only a few seconds for a normal 44.1 kHz WAV file. That’s a trade-off I’m perfectly happy to make for an offline process.
 
The only requirement is Visual Studio with the required C++ package installed. Extract the ZIP, click “BUILD_ONCE”, and once it has built successfully, simply drag and drop the WAV file onto the drag-and-drop icon.
 

Attachments

Sure, but in this case the “waste of resources” amounts to waiting only a few seconds for a normal 44.1 kHz WAV file. That’s a trade-off I’m perfectly happy to make for an offline process.
But the obvious waste of resource is the extra storage from doing an offline conversion at all. If on-the-fly conversion is close enough to your "perfect" then that is a waste. If you are converting a big library it is a waste of time and effort as well.
 
The only requirement is Visual Studio with the required C++ package installed. Extract the ZIP, click “BUILD_ONCE”, and once it has built successfully, simply drag and drop the WAV file onto the drag-and-drop icon.
Nice!, what reconstructed inter sample-overs?
 
Sure, but in this case the “waste of resources” amounts to waiting only a few seconds for a normal 44.1 kHz WAV file. That’s a trade-off I’m perfectly happy to make for an offline process.
It's still a waste as it has no audible improvement.
 
See for yourselves and compare the two WAV files.
Can you provide two tracks to compare that are music files (and not electronic or computer generated). The test files you have here have a lot of stuff right near 0.5fs. I understand why you would include that as an academic type test, but for practical purposes those tracks are not very good for comparing.
edit: also you should probably warn people when offering files with high level >20Khz sections.

1790599121274.png
 
Last edited:
1790599449741.png
 
-170 db of distortion isn't enough?
 
Can you provide two tracks to compare that are music files (and not electronic or computer generated). The test files you have here have a lot of stuff right near 0.5fs. I understand why you would include that as an academic type test, but for practical purposes those tracks are not very good for comparing.
edit: also you should probably warn people when offering files with high level >20Khz sections.

View attachment 561469
 
Back
Top Bottom