Using Centripetal Catmull–Rom spline in place of oversampling

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
This discussion is aimed more at people with electronic knowledge and contains such terminology.

I was reading up about DAC methodologies like R-2R with some enthusiasts saying how much better it is than Delta-Sigma etc. I understand that Delta-Sigma is chosen for cost reasons. It is expensive to manufacture a laser trimmed R-2R ladder IC which is why manufacturers look at other alternatives.

It occurred to me that a VERY smooth output could be achieved by using a Centripetal Catmull–Rom spline to calculate a smooth interpolation between steps at any reasonable desired sampling rate. Instead of oversampling by 256, use the above spline formula to calculate 256 new points along a smooth curve between the known samples.

It is 2015 and there are plenty of powerful low cost microcontrolers that can do the job.


My idea for making a better affordable DAC is to use a PWM constant current to charge and discharge a capacitor, similar to how class D amplification works, but using a microcontroler and spline calculations to construct the PWM signal.

My reason for choosing a constant current over the usual LC circuit is that it is far easier to calculate perfect PWM timings when using a constant current. LC circuits are curved and good luck trying to figure out where your pulse fits onto that curve.

Any thoughts from the experts?
 
This discussion is aimed more at people with electronic knowledge and contains such terminology.

I was reading up about DAC methodologies like R-2R with some enthusiasts saying how much better it is than Delta-Sigma etc. I understand that Delta-Sigma is chosen for cost reasons. It is expensive to manufacture a laser trimmed R-2R ladder IC which is why manufacturers look at other alternatives.

Wadia is may the only one who started/introduced spline oversampling some decade ago using the PCM1704 DAC.

I own a 27 WADIA and can tell you about the pleased hearing experiences... but requires high resolution speakers (Magnepan), tube gear and not boom boom music at all :D

The benefit against traditional FIR oversampling is the smaller overshoot, no much cap's in the signal path and use of low plastic for the connection wires ... :)

I had once a paper claiming a overshot (post & pre echo) below 1/100 of the main peak will not be hear able...

just my 2 cents

Hp
 
dundy said:
It occurred to me that a VERY smooth output could be achieved by using a Centripetal Catmull–Rom spline to calculate a smooth interpolation between steps at any reasonable desired sampling rate. Instead of oversampling by 256, use the above spline formula to calculate 256 new points along a smooth curve between the known samples.
Why do you want a "very smooth" output? The main aim of splines is to provide a curve which looks nice to the eye, not one which correctly replicates the input to a sampling process.

As a little exercise for yourself, use a spreadsheet (or Matlab etc.) to sample a 22kHz sine wave at 48kHz (or 20kHz at 44.1kHz). What sort of spline will enable you to recover the sine wave, and reject the image at a slightly higher frequency and slightly lower amplitude?
 
I don't think that any existing technology will accurately recover a 22kHz sine wave sampled at 40 something kHz. My point was that Delta-Sigma was implemented as a cheap alternative to costly laser trimming of R-2R ladders.

A microcontroler decoding SPDIF into analogue using my proposed method surely has to be better than Delta-Sigma, yet just as cost effective.

As for wanting smooth output, I was referring to the step staircase effect that even R-2R can't avoid. Spline solves that. ( but not at 22kHz obviously)
 
dundy said:
I don't think that any existing technology will accurately recover a 22kHz sine wave sampled at 40 something kHz.
A 22kHz sine wave can be recovered from a 48kHz sampling stream. 20kHz sine waves are routinely recovered from 44.1kHz sampling in every CD player on the planet.

If you want to suggest new methods for DAC it might help if you start by learning about how the current technology works. Not just the DAC itself, but also the reconstruction filter. If you draw "smooth" curves through samples where the sampling frequency is very high compared with the signal frequency you can easily fool yourself - newbies do it on here all the time. Move up nearer the Nyquist limit as I suggested and you should start to see how digital audio really works. "Smooth" curves may play a limited role, but the real issue is good filters.
 
Thank you HP. I just looked it up and saw that WADIA 27 did use a spline for the exact reasons I want to use it for.

A quote from another discussion...

with Wadia's algorithms you are effectively listening to CD at SACD/DVD-A resolutions. Their spline fit algorithm fills in the interpolation of the upsample without just leaving blanks, or simple connect the dot functions used in many other systems as filler. What their algorithm can't do is reproduce the EXACT original analog signal. What it can do is approximate it to such an extent that its sound is SACD/DVD-A resolution (truly). The only real argument to be had is, "well, it still is approximated analog, not the true recording".

And to DF96, I'm hardly a newby. I have been an engineer in the electronics and software fields since 1980 and am quite familiar with "how the current technology works. "
There is still no way you can accurately recover the original signal (20kHz sampled at 44.1kHz) because that equates to just two samples per cycle. Those two samples do not contain sufficient information to tell you if it was a sine wave, triangular, square or some combination of those.

Reconstruction filters are therefore a compromise or an interpolation of the original signal. They assume a smooth transition from one sample to the next, and in "every CD player on the planet" the reconstruction filter boils down to a low pass filter of some sort.

See the wikipedia page for The Whittaker–Shannon interpolation formula or sinc interpolation is a method to construct a continuous-time bandlimited function from a sequence of real numbers.

On that page it states "This is equivalent to filtering the impulse train with an ideal (brick-wall) low-pass filter."

It's not that smoothing "may play a limited role", it's a case of smoothing being the entire point of the reconstruction filter.

The spline formula, in my opinion (and Wadia's) should do a better job of it than "current main stream technologies".

I started this thread because I was thinking about using a single microcontroler to stereo decode SPDIF, create a PWM signal and smooth it with a spline. I had googled DAC and spline and came up empty so asked on this forum expecting that someone might know something about using splines with audio.
 
There is still no way you can accurately recover the original signal (20kHz sampled at 44.1kHz) because that equates to just two samples per cycle. Those two samples do not contain sufficient information to tell you if it was a sine wave, triangular, square or some combination of those.

Perhaps it's time for you to review Shannon-Nyquist? You might also want to think about what the Fourier expansions of 20kHz square waves and triangle waves comprise.
 
...
I started this thread because I was thinking about using a single microcontroler to stereo decode SPDIF, create a PWM signal and smooth it with a spline. I had googled DAC and spline and came up empty so asked on this forum expecting that someone might know something about using splines with audio.
Pulse-Width Modulation? I don't see how a spline would work with that. The transition in one direction is a constant time, but the timing in the other direction varies to make the pulse width. You're going to use some sort of spline curve between these points?

Or did you mean PCM?
 
Administrator
Joined 2004
Paid Member
A 22kHz sine wave can be recovered from a 48kHz sampling stream. 20kHz sine waves are routinely recovered from 44.1kHz sampling in every CD player on the planet.

<snip>

Nyquist says this is so and the math is there to support it, but as a practical matter neither of my M-Audio sound cards (2496/24192) nor several cheap CD players I tried could reproduce a decent sine wave at 20kHz with a sample rate of 44.1kHz.
 
@ kevenkr

While I see the beauty of maths, I have to agree with your practical observations. Two data points of signal at 20Khz can't possible reproduce the original signal simply because you do not have enough information to know what the original signal was.

The fancy maths and theorems are still just making an educated guess at this point.
 
dundy said:
And to DF96, I'm hardly a newby. I have been an engineer in the electronics and software fields since 1980 and am quite familiar with "how the current technology works. "
There is still no way you can accurately recover the original signal (20kHz sampled at 44.1kHz) because that equates to just two samples per cycle. Those two samples do not contain sufficient information to tell you if it was a sine wave, triangular, square or some combination of those.
Perhaps you need to consider which (if any) of those two statements are true:
"I know how it works"
"You can't recover a 20kHz sine wave from 44.1kHz sampling"

If you actually knew how it works then you would understand what is meant by a band-limited signal, and would be perfectly aware how two samples per cycle are enough to fully recover a sine wave below the Nyquist limit. It is because I suspected (rightly, it turns out) that you don't understand digital audio that I suggested you learn about it before 'inventing' an improvement.

Reconstruction filters are therefore a compromise or an interpolation of the original signal. They assume a smooth transition from one sample to the next, and in "every CD player on the planet" the reconstruction filter boils down to a low pass filter of some sort.
Reconstruction filters assume a band-limited original signal. They do not assume a "smooth transition" from one sample to the next - that is a common newbie confusion.

As I said, look at how a reconstruction filter recovers a 20kHz sine wave from 44.1kHz sampling. You can do this with a spreadsheet or Matlab etc. Try to understand how it all works. Alternatively, read a good book on digital sampling - which may require brushing up on Fourier, convolution etc.

Your first sentence
dundy said:
This discussion is aimed more at people with electronic knowledge and contains such terminology.
was perhaps a warning to us of what was to come.
 
The other rather common misconception here is that two points suffices, it does not.

You need strictly more then two points per cycle to be able to reconstruct (Strictly the sample rate must exceed twice the bandwidth), but 2.0000001 will do, given a perfect reconstruction filter (But it would be a pain in the ****).

Sampling is essentially modulation, so the usual modulation theory applies.

Upsampling with a windowed sinc is easy and has some very obvious optimisations, and reconstruction is NOT curve fitting.

In particular consider that splines are usually some sort of polynomial function and a function of order N will, when fed with a signal having a frequency f, produce components up to N*f, thus you need to upsample BEFORE applying such a polynomial function at which point you may as well just do the sinc thing, it is this fact that makes fast limiters such a complete pain to implement in the digital domain....

Regards, Dan.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.