Upsampling discussion (technical)
Jun 18, 2002 at 1:43 AM Thread Starter

#### AndreYew

Out of respect for requests that technical discussion be left out of the other upsampling threads:

Upsampling DACs v2
Upsampling DACs

I've created this thread where technical discussion is allowed. Subjective opinions are welcome as well. And technical discussions correlating to subjective opinions are most welcome.

I mentioned in the v2 thread that Jan's analysis of sampling a 21 kHz sine wave at 44.1 kHz and the conclusions he draws are wrong. The analysis is in Jan's Analoguer project writeup:

Jan Meier's Analoguer

The analysis is in error because Jan uses linear interpolation rather than sinc interpolation. What is sinc interpolation? Instead of connecting the sample points with straight lines, as Jan does, you connect, or interpolate, several sample points with sinc functions (sin(x)/x). The technical phrase is you convolve the sample points with a sinc function. This basically means, to compute the value of the curve at one point, you center a sinc function on that point, and multiply it by that point's value. Move the sinc function down the left a little bit (an infinitesimally small amount in theory), and repeat, and add to the original multiplication. Do the same thing to the right also. Do this for every sample point you have.

Why such a convoluted scheme? First some basic math. Fourier analysis is the best tool to analyze this because we're talking about sine waves. A Fourier transform (FT) of a convolution of two things, A and B (here A are the sample points and B is the sinc function) is a multiplication in frequency domain of the FT of A and FT of B. If you work out the math, a sinc function is a brickwall low-pass filter in frequency domain, that is, when you perform brickwall filtering, you are actually interpolating your sample points with a sinc function.

The FT of the sample points is the well-known spectrum where the baseband frequencies of the original signal sampled is accompanied by images centered at multiples of the sample rate frequency. Why it looks like that after sampling is another interesting application of convolution, except this time you're convolving the original signal with a chain of delta functions (point-sampling).

Because we have images at high frequencies, we need to apply the low-pass filter (which is equivalent to sinc interpolation as mentioned above) to get rid of all the high frequency noise. Because we want to use a brickwall filter is why we need to use sinc interpolation instead of a linear interpolater.

Anyway, what Jan's done in his analysis is to use the wrong reconstruction filter (the linear interpolater which looks like some kind of funny parabolic-shaped filter with all kinds of non-linear phase) on his points, and that's why he gets his high-frequency wobble.

A useful way to think about digital sampling is that the sampling method has to be matched to the reconstruction filter. Sort of like the RIAA curve for LPs. For an LP mastered to RIAA standards, there is exactly one RIAA filter curve that will correct the LP back to what the engineer intended. Similarly for sampling, there is one reconstruction filter for each sampling method. If you use point-sampling (as Jan does in his analysis), then you must use sinc-interpolation.

--Andre

Jun 18, 2002 at 1:59 AM

#### Nezer

##### Antibacterial soap... kills bacteria... bad karma?
It's not just Dr. Meier but also these guys:

Certainly you're not implying that these folks and Jan are selling snake oil?

I can personally vouch for the Analoguer's ability to smooth-out the hig frequencies (but at a cost). This leads me to beleive that Jan has a solid understanding of the problem or that he got really, really lucky (and Jan doesn't strick me as the type of person that relies on luck to acomplish things).

I'd like to hear your explanations for that high-pitch distortion and ways you would get around it. You can't convince me it doesn't exist and I have a hard time believing that it's just the side-effect of this filter or that filter as it's been *everywhere* I've looked for it. This seemingly says that it's a problem with the foundation of the technology and not in a particular implementation.

If *you* were to design a DAC, how would you go about doing it?

Thanks for starting this technical thread and keeping this out of the others.

I'm sure this will get Jan's attention and he might even join-in the fun!

Jun 18, 2002 at 2:13 AM

#### aos

##### May one day solve the Mystery of the Whoosh
Actually, AndreYew is correct, the output of an IDEAL DAC is a sequence of delta pulses with "amplitude" of sample value at that time, followed by brickwall filter. Which yields series of sin(x)/x pulses, so at any given time the final value is a sum of contributions of all those pulses at that point.

Real DACs however don't work exactly like that since it is impossible to create a delta function, as it has infinitely narrow peak around 0, whose integral is 1. Instead, DAC can hold sample value for the duration of sample. That changes things a bit, and it's possible that's what Jan's hinting at. It is possible this wobbling occurs due to that fact that DACs approximate. I don't remember what the actual signal looks like in that case but I'm sure it can be calculated or at least simulated. Also, brick filters are IMPOSSIBLE to make. In fact, if you take a pulse a put it through such filter, you'd get response before the pulse actually happened (no matter how much your filter delays the signal) which is physically impossible, obviously. That is used as the proof, at least that's what we were given in school. You'd need a filter of an infinite order. That's not to say you can't get very close using digital filters as sin(x)/x settles pretty fast for all practical purposes. Anyway, that's something I didn't like in Jan's article - I don't like using step response as the judge whether a DAC is good or not but this is used far too often. First, any such thing in the original recorded signal would get removed by the "Brickwall" filter before digitizer (as the first step of A/D conversion) so it wouldn't be in the digital stream at all.

Jun 18, 2002 at 2:18 AM

#### AndreYew

Nezer,

Certainly you're not implying that these folks and Jan are selling snake oil?"

Tell me why it has to either work or it's snake oil? That's also known as the fallacy of the excluded middle. What Taddeo and Jan have done is to implement a low-pass filter than filters out some stuff in the audible range. They both roll off the highs. As to whether that's snake-oil or not, I wouldn't presume to speak for them.

"I'd like to hear your explanations for that high-pitch distortion and ways you would get around it."

Get a better CD player? Out of all the systems and DACs I own (Rotel RCD-971, Muse Model 2, modified Assemblage DAC-2, Sony DVD-S7000, Philips SACD 1000, Theta Pro Prime IIA, Lexicon DC-1, Lexicon MC-1, Lexicon MC-12, Sony XA-55ES CD player, my portable Panasonic, various PCs), I have never heard high-pitched distortion that was either not a fault in the recording, or a fault in the implementation of the DAC (mostly the crappy PC sound cards). I have certainly heard many different artifacts, some of whose origins and mechanisms would surprise you as they affect a large majority of the mega-compressed pop music out there, but done well, 44.1 kHz PCM is very, very good with no fundamental flaws. Here's one example of a production flaw that's common, and not well-known:

0dBFS+ levels in music

I have heard this in my system, and it was due to a bug in the DSP code.

"You can't convince me it doesn't exist and I have a hard time believing that it's just the side-effect of this filter or that filter as it's been *everywhere* I've looked for it."

I've never dictated what you do or don't hear. What I've only responded to are technical conjectures based on subjective opinions. I'm sure you heard what you heard, but I don't think you've considered all possibilities before damning 44.1 kHz PCM.

"If *you* were to design a DAC, how would you go about doing it?"

Easy. Do what Wadia does, and reprogram their reconstruction filter to something sane. Or buy a Prism Dream or Weiss DAC if I felt lazy.

--Andre

Jun 18, 2002 at 2:32 AM

#### AndreYew

aos,

I agree that a true sinc function and brickwall, and indeed delta-function point-sampling are impossible to realize physically. However, with FIR filters, you can implement acausal filters, ie. filters that start ringing before the actual sample, by using delay. Perceptually how important is this? I don't know --- it would make for a great undergrad senior thesis experiment, I think.

Moreover, practically speaking, one can approach the ideal of a point-sample reconstruction by careful design. I believe all DAC chip manufacturers have been doing this for quite a while, as you can see in their data sheets. If not, we'd have pretty cruddy measuring CD players that wouldn't be able to pass a simple sine wave with low distortion, and obviously even the cheapest players will do this well.

My contention with Jan's analysis is that he uses linear interpolation.

--Andre

Jun 18, 2002 at 2:36 AM

#### Nezer

##### Antibacterial soap... kills bacteria... bad karma?
Quote:

 Originally posted by AndreYew "If *you* were to design a DAC, how would you go about doing it?" Easy. Do what Wadia does, and reprogram their reconstruction filter to something sane. Or buy a Prism Dream or Weiss DAC if I felt lazy.

If there's nothing inherently wrong with 44.1khz digital audio why jump through hoops with upsampling and processing with a DSP as Wadia and Weiss seems to do?

Define doing something sane to the signal?

Jun 18, 2002 at 2:42 AM

#### aos

##### May one day solve the Mystery of the Whoosh
>However, with FIR filters, you can implement acausal filters, ie. >filters that start ringing before the actual sample, by using delay.

Sure. It's not a coincidence that filters introduce delay, and it goes up with the order of the filter. If you don't have to process data real-time (e.g. if running a filter on a .wav file) you can do pretty much anything if you're willing to wait.

I don't know if sample-and-hold is how it's actually done in practice. I have seen many many DAC datasheets in last year but I can't recall any of them describing that. If not, however, it just gives more fuel to discussions. As long as you stay with the theory, not many people will argue. But once you start engineering for real world, side effects start mounting and soon there's lots of possibilities that formulas won't be good enough to describe what's going on. At least not the starting formulas; then it's time to do more math.

Jun 18, 2002 at 2:48 AM

#### Nezer

##### Antibacterial soap... kills bacteria... bad karma?
Screw it, I'm going back to vinyl... l-)

Jun 18, 2002 at 3:24 AM

#### aos

##### May one day solve the Mystery of the Whoosh
Nezer, actually, you should be fine with 96kHz sampling
). Once you move sampling frequency up whatever artifact exist will move higher and well out of audio range and then everyone should be happy
.

Or, SACD, which uses different technique (delta modulation instead of PCM) and is free of some of its problems... But it brings its own set of problems (such as high noise level outside audible range, and from what I've seen possibly even in audio range).

Jun 18, 2002 at 4:43 PM

#### AndreYew

Nezer,

"If there's nothing inherently wrong with 44.1khz digital audio why jump through hoops with upsampling and processing with a DSP as Wadia and Weiss seems to do?"

I have no idea why Wadia does the DSP they do. As I've said many times, I think the Wadia oversampling filter is terrible. Weiss does it because it's oversampling --- they're trying to ease the analog filter's job, just like every other oversampling DAC out there. I met Daniel Weiss this past CES, and asked him about upsampling in his DAC, and he said he calls it that for marketing reasons only, and it really doesn't do anything different than OS.

Besides why assume that upsampling and DSP exist just because something may be wrong with 44.1 kHz? As aos points out, once you're in the real world beyond theory, there are lots of practical problems you need to solve, and you would be amazed at the kinds of problems faced by every DAC.

"Define doing something sane to the signal?"

Implement a nice brickwall filter, instead of the crazy spline interpolator they have in there. Basic THD+N measurements (which are about as insensitive as you can get) already show crappy results from Wadia players. If they can't even pass high-frequency sine waves without messing up, I wouldn't trust them with actual music.

--Andre

Jun 18, 2002 at 4:48 PM

#### AndreYew

aos,

"But once you start engineering for real world, side effects start mounting and soon there's lots of possibilities that formulas won't be good enough to describe what's going on. At least not the starting formulas; then it's time to do more math."

I fully agree. If you look at the construction of Wadia players and compare them to a Mark Levinson player, I think this difference is very well illustrated. Both, of course, start from the same point with the theory of PCM sampling (except the Wadia's stupid OS filter), and implement the basic blocks necessary to play back such signals. However, on the one hand, the physical construction of the Wadia accounts for many real world effects that the ML doesn't consider. And on the other hand, the ML seems to be designed to work in an ideal world where there's no RF noise or pollution, and it gets nice clean inputs all the time, and consequently is a poor piece of engineering.

The basic theory will not get you to a fully functional DAC, but it's important to know the basic theory before taking further steps.

--Andre

Jun 18, 2002 at 5:16 PM

#### Anders

Andre,
It would be interesting to know a little about how RF noise and pollution affects the CD player.
There are two now highly praised DACs (e.g Stereophile) that are not extremely expensive: Musical Fidelity A3-24 and Perpetual Technologies. It's easy to ask, but you may know something?

Jun 19, 2002 at 6:49 AM

#### kelly

##### Herr Babelfish der Übersetzer, he wore a whipped-cream-covered tutu for this title.
Andre

I have two Panasonic portable players, the CT570 and the S320. I also have the Sony S7000 DVD player you mentioned explicitly.

In my experience, theres three players do exhibit the type of digital artifacting that haunts both Nezer and me.

I'd like to, as you do, simply acredit these artifacts to poor recordings, bad microphones, etc. However, the reason I cannot do this so simply is because I hear the artifact less and less in better players. I certainly hear the artifact far less often in the Sony XA777ES than in the S7000.

Is this because the XA is converting the signal or doing some kind of upsampling that the S7000 is not? I don't know. Whatever it is, the high frequency distortion is lowered in some areas and missing altogether in others.

As I said before, it was only in the Wadia where from all my listening, I could not seem to locate the artifact *at all.* I don't pretend to truly understand how they've managed to hunt and kill this disturbing sound without rolling off the other information, but they certainly seem to have done so.

Jun 19, 2002 at 7:45 AM

#### MirandaX

Quote:

 Originally posted by AndreYew Implement a nice brickwall filter, instead of the crazy spline interpolator they have in there.

Is Wadia really using a spline interpolator? That's nuts. (Doesn't that inject garbage as a side effect across the frequency spectrum?)

Jun 19, 2002 at 11:13 AM

#### Jan Meier

##### King CordaMember of the Trade: Meier Audio

Most things already have been said/argued so I will only throw in two cents (and not a whole dollar

" The analysis is in error because Jan uses linear interpolation rather than sinc interpolation. "

It is true, linear interpolation is not used in CD-players. However, in practical life it is no true sinc interpolation either. It's only an approximation as the true algorithm is very hard to realize.

With a true sinc interpolation there would be no wobbling. However, as any practical algorithm is just a approximation the wobbling can not completely be removed. It will of course be much less than shown in my article but please understand that I used linear interpolation for didactic reasons. Hardly any normal mortal knows what a convolution or a sync function is and what their relations to the FFT of a deltafunction are. To explain a problem one sometimes has to simplify.

Moreover, it's not just the wobbling that is cured by the algorithms of the Digital Antidote / Analoguer / Wadias. More important is the reduction of the post-pulse and after-pulse ringing. The shape of the pulse response definitely improves in the time-domain. The price to be paid is less extension in the frequency domain but most people can't hear up to 22 kHz anyway.

How much the Analoguer helps depends strongly on your setup and on the music you play. However, in contrast to the Antidote and the Wadia algorithm, the effect of the Analoguer can be varied and adapted to personal taste.

I never sold many Analoguers, as people are very hesitating to buy something they don't understand, but I never got any unit returned and no customer ever showed to be disappointed.

(Recently a Brasilian customer demonstrated his units to a number of friends. These friends immediately ordered 4 (!) more units so it must have worked for them .

Cheers,

Jan