Jump to content
IGNORED

Multi Bit DACs vs. Delta Sigma DACs


Recommended Posts

Actually, if you are using a virtual 44100 sample rate, it is not allowed to ask for any graph above 22050.

IOW, you would be applying the Nyquist mirror somewhere (like 22050), thus imply a sample rate (like 44100), and any frequency above 22050 is invalid.

 

Maybe it was a piece of cake for you to create this, but I think it is a piece of art.

 

Thanks a lot,

Peter

 

PS: Being on a somewhat faster PC really helps.

 

Lush^3-e      Lush^2      Blaxius^2.5      Ethernet^3     HDMI^2     XLR^2

XXHighEnd (developer)

Phasure NOS1 24/768 Async USB DAC (manufacturer)

Phasure Mach III Audio PC with Linear PSU (manufacturer)

Orelino & Orelo MKII Speakers (designer/supplier)

Link to comment

Peter,

 

thanks for trying it again. The most obvious analogy as to what is going on is filming a car wheel. If the car is going slowly, the film shows the wheel spinning in the right direction. As the car speeds up, at some point the camera takes a photo at the same point of the wheel revolution every frame ( so the wheel seems to stop ), and then, as the car accelerates still further, the wheel appears to go backwards.... so in sampling, you start sampling multiples of sine waves...

 

So, how does filtering help here?

 

Let's imagine a 10kHz sine wave. Now we know that the unfiltered output from our DAC will have the genuine 10k tone, plus "images" at 34.1k, 54.1k and so on. If we perform filtering, so that we guarantee the output has no images, we are left with the fundamental, perfect 10k tone and nothing else

 

So how do we do this filtering?

In the early days of digital audio, this was done using an analogue filter - this was tricky, because at 44.1k, you want to have as little attenuation as possible at 20k ( the top limit of hearing ), and as much attenuation as possible as quickly after that.

Then it was worked out you could do the majority of filtering digitally, by oversampling. That is, we take in 44.1k and output something higher in sample rate but filtered, to allow the analogue filtering to have much less work to do.

Here is another chart, this time showing a 10kHz sine wave, and the same data oversampled by 4x using a butterworth IIR filter

 

http://spreadsheets.google.com/pub?key=tqe1JKKO8uUrFitBlXUHn7g&single=true&gid=1&output=html

 

The code for generating this data is at the bottom of this post, and the butterworth code was taken from:

http://www-users.cs.york.ac.uk/~fisher/mkfilter/trad.html

 

The IIR is not fantastic, but shows the concept, I think!

 

NB in the above example, the DAC is converting at 176.4k, so the analogue filter would typically start rolling off at 88.2k.

NB2 I would show 20k, but the IIR filter I've demonstrated is not fast enough. The concept, though remains absolutely correct, PROVIDING you can get a filter that is sharp enough

 

your friendly neighbourhood idiot

 

 

 

 

 

 

 

 

 

 

 

#include

#include

#define NZEROS 9

#define NPOLES 9

#define GAIN 2.327801853e+00

#define PI 3.1415926

 

float filterx2_1(float in, float *s1 , float *s2)

{

static float xv[NZEROS+1], yv[NPOLES+1];

xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = xv[4]; xv[4] = xv[5]; xv[5] = xv[6]; xv[6] = xv[7]; xv[7] = xv[8]; xv[8] = xv[9];

xv[9] = in / GAIN;

yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; yv[3] = yv[4]; yv[4] = yv[5]; yv[5] = yv[6]; yv[6] = yv[7]; yv[7] = yv[8]; yv[8] = yv[9];

yv[9] = (xv[0] + xv[9]) + 9 * (xv[1] + xv[8]) + 36 * (xv[2] + xv[7])

+ 84 * (xv[3] + xv[6]) + 126 * (xv[4] + xv[5])

+ ( -0.1845474211 * yv[0]) + ( -1.9712441162 * yv[1])

+ ( -9.3917143883 * yv[2]) + (-26.2001880020 * yv[3])

+ (-47.1747279540 * yv[4]) + (-56.8666310080 * yv[5])

+ (-45.9055074420 * yv[6]) + (-23.9369366310 * yv[7])

+ ( -7.3184954634 * yv[8]);

 

*s1 = yv[9];

*s2=in;

return yv[9];

}

 

float filterx2_2(float in,float *s1, float *s2)

{

static float xv[NZEROS+1], yv[NPOLES+1];

xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = xv[4]; xv[4] = xv[5]; xv[5] = xv[6]; xv[6] = xv[7]; xv[7] = xv[8]; xv[8] = xv[9];

xv[9] = in / GAIN;

yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; yv[3] = yv[4]; yv[4] = yv[5]; yv[5] = yv[6]; yv[6] = yv[7]; yv[7] = yv[8]; yv[8] = yv[9];

yv[9] = (xv[0] + xv[9]) + 9 * (xv[1] + xv[8]) + 36 * (xv[2] + xv[7])

+ 84 * (xv[3] + xv[6]) + 126 * (xv[4] + xv[5])

+ ( -0.1845474211 * yv[0]) + ( -1.9712441162 * yv[1])

+ ( -9.3917143883 * yv[2]) + (-26.2001880020 * yv[3])

+ (-47.1747279540 * yv[4]) + (-56.8666310080 * yv[5])

+ (-45.9055074420 * yv[6]) + (-23.9369366310 * yv[7])

+ ( -7.3184954634 * yv[8]);

 

*s1 = yv[9];

*s2=in;

 

return yv[9];

}

 

 

 

void main( void )

{

float angle=0.0,delta=0.0,sample;

float sample_rate=44100.0,freq=10000.0;

float s1,s2,s3,s4;

int loop;

FILE * res_file;

 

res_file = fopen( "C:\iir.csv" , "w" );

delta = (freq/sample_rate)*2*PI;

for( loop = 0; loop < 200; loop++ )

{

sample = sin( angle );

filterx2_1( sample , &s1 , &s2 );

filterx2_2( s1 , &s3 , &s4 );

if( loop > 100 )

fprintf( res_file , "%.6f,%.6fn%.6f,%.6fn" , sample , s3 , sample , s4 );

filterx2_2( s2 , &s3 , &s4 );

if( loop > 100 )

fprintf( res_file , "%.6f,%.6fn%.6f,%.6fn" , sample , s3 , sample , s4 );

 

angle+=delta;

}

fclose( res_file );

}

 

 

Link to comment

Right,

 

having seemingly scared some people on the forum with my scary graphs and whatnot, some people may be saying "But I've got a NOS, filterless DAC, and it sounds great!"

Well, in this case, we have to consider that everything I've said involves why we need a filter, and what happens without it.

Now consider this. The human auditory system does not have infinite bandwidth! So, NOS DACs can work because your amplifier, and speakers and ears will not have infinite bandwidth - can you hear the alias at 43.1kHz? No!

 

Unfortunately, you will have all this HF stuff that is bizarrely related to the signal, in places where the designers of your amp and speakers are definitely not expecting it. This will make a filterless DAC extremely sensitive to other things in your system ( including you! ), and the characteristics of the source material.

 

Additionally ( and bizarrely ) a properly implemented filtered DAC will have a less droopy output in frequency response terms...

 

so, there, in a nutshell, is why ( I think ) filterless DACs are not for everyone...

 

your friendly neighbourhood idiot

 

Link to comment

 

"so, there, in a nutshell, is why ( I think ) filterless DACs are not for everyone..."

 

Thanks I_S, great stuff!

 

One of the things I love about this site, is that meaningful online discussions don't devolve into "you're wrong, I'm right" typical alpha male nonsense.

 

I'm guessing that overshoot would be the equivalent of those 'spinning rims' that spin after the wheel stops. :)

 

 

clay

 

 

 

 

 

Link to comment

One of the things I love about this site, is that meaningful online discussions don't devolve into "you're wrong, I'm right" typical alpha male nonsense.

 

You're wrong! :)

 

Echo that thanks, I_S. Fantastic run through the basics. Hope you don't mind me clipping what you've written for my personal digital audio reference scrapbook.

 

Link to comment

Am I the only one not having access to the second spreadsheet ( http://spreadsheets.google.com/pub?key=tqe1JKKO8uUrFitBlXUHn7g&single=true&gid=1&output=html ) or was it not intended to play with maybe ?

 

Thanks,

Peter

 

Lush^3-e      Lush^2      Blaxius^2.5      Ethernet^3     HDMI^2     XLR^2

XXHighEnd (developer)

Phasure NOS1 24/768 Async USB DAC (manufacturer)

Phasure Mach III Audio PC with Linear PSU (manufacturer)

Orelino & Orelo MKII Speakers (designer/supplier)

Link to comment

Hi Peter,

 

I just published the graph - I'll publish the rest of it later ( google docs it a bit of a bodge )

 

I hope that this has been informative to at least one person, and I reckon there's a good chance of at least one fact being right!

 

your friendly neighbourhood idiot

 

Link to comment

@i_s

 

If you wouldn't mind fielding a question from a fellow idiot :)

 

I get the sampling (a wave represented by a number of discrete points) and I get that there are an infinite (I presume) number of waves that could be re-generated from those discrete samples but what I don't get is why.

 

What I have always assumed is that the DAC will generate an output based on one of these samples - will hold this output and then generate the next output from the next sample. Naively one would assume that this would then by default generate the lowest frequency wave that matches the sample set. Who or what generates all these other waves.

 

Alternatively that the DAC would have an inbuilt assumption that nothing weird went on between the two samples or that nothing weird could have gone on and that the interpolation between the two points is therefore smooth.

 

Obviously I am missing or mis-understanding something - do you have a simple enlightenment for a simple man :)

 

Link to comment

Hi Harry,

 

the best way to visualise it ( which I've only alluded to in my posts ), is if you imagine a perfect filterless DAC, you feed it a sample it, holds it perfectly for the width of the sample, the next sample comes along and it switches to it instantly before holding it again. The "instantly" bit represents infinite bandwidth, and the width of the samples gives you the link to the sample clock...

 

However, top question that I should have addressed!

 

your friendly neightbourhood idiot

 

Link to comment

@Peter,

 

the graph is just the output from the source I posted. I noticed that the magic of HTML has removed my #includes, which are stdio.h and math.h ( or is it maths.h? I can never get it right )

 

The filter is a bit poor, but illustrates the point, I hope

 

your friendly neighbourhood idiot

 

Link to comment

@i_s

 

In my tortured mind, this would produce a stepped output but still a single wave (assuming a perfect sine curve is input). Unfortunately I am trying to learn a particularly complex bit on the guitar at present (complex for me anyways) and I have no place left in my brain to park this to ferment :)

 

Link to comment

I think the problem is people are used to seeing "stair step" outputs at frequencies which are low, to illustrate sampling. In this case ( say 1kHz sine sampled at 44k ), it is easy to imagine that the stair steps are innocuous, which they probably are. However, the "step" does represent infinite bandwdith - think of your tweeter attempting to move from one "step" to the next instantly. It can't, because it is a bit of paper stuck to a magnet moving air, which acts as a filter. Unfortunately an amp with a high enough slew rate will reproduce these steps ( to some degree ), which do represent significant energy at HF.

As I most peoples model of sampling is this stair step, they really do get surprised seeing the representation of a 20k sinewave sampled at 44k.

What I'm trying to say is a stepped sine is a sine modulated with higher frequency stuff ( so your perfect DAC will present a stepped sine wave on it's analogue out ).

 

I don't think I'm being very clear, not your fault :(

 

your friendly neighbourhood idiot

 

Link to comment

Either I'm brilliant ( extremely unlikely ) and have explained everything everyone wants to know about sampling theory, DACs, and the finest wine to accompany a medium rare bit of lamb, or...

 

nobody cares ( actually quite likely )

people are overwhelmed

I'm completely wrong, and people are shuffling their feet, no-one quite knowing how to tell me...

people are quickly dusting off their vinyl, as digital is far more evil than they had imagined?

 

what do you think?

 

your friendly neighbourhood idiot

 

 

 

Link to comment

What i_s possibly assumes to be known amongst us all, is

 

a. a perfect sine has no harmonics hence no "higher frequency stuff";

 

b. anything containing steps hence more squary waves just bears those harmonics. Why ? squares just do.

 

To keep in mind :

 

1. where digital bears steps (the higher the frequency the more profound opposed to a sine) the more weight the harmonics will bring in. Not to forget : false harmonics because the stepping is false in the first place.

 

2. a square (hence step) comprises of many small sines (aha, high frequency ones) because electrically it works like that (added to that : I think it is allowed to say that a pure square consists of an infinit number of small sines, and while a pure square electrically cannot exist, the "infinit" number of sines is mathematically solved by not being inifit in amount).

 

Additionally : (at least that is what I get from it, and should represent i_s' words from more in the beginning) : since the harmonics are known from each "size" of step hence square size, the wave comprising those particular steps can be reconstructed (due to the analogue side) just by analysing the harmonics.

When this has been taken care of, the thing left is to remove those harmonics, because remember, these are false and sprung from the stepping which by now has been removed, and by consistency with the now ready sine, they don't belong in the picture anymore.

 

If I am correct in the first place, we are not done with this ... :-)

 

I hope that this has been informative to at least one person

 

I am not ashamed that if one only, it must be me.

Maybe this is a good time to state that I sure don't know everything.

I must say though, that these kind of posts - at least I never ran into thus far, don't help by keeping that up. :-))

 

Cheers,

Peter

 

Edit, PS: are stdio.h and math.h ( or is it maths.h?

it is math.h

 

Lush^3-e      Lush^2      Blaxius^2.5      Ethernet^3     HDMI^2     XLR^2

XXHighEnd (developer)

Phasure NOS1 24/768 Async USB DAC (manufacturer)

Phasure Mach III Audio PC with Linear PSU (manufacturer)

Orelino & Orelo MKII Speakers (designer/supplier)

Link to comment

people are quickly dusting off their vinyl, as digital is far more evil than they had imagined?

 

That one, I'm sure.

The being brilliant is not mutually exclusive btw.

 

Oh, don't mind the title. Had to put something there.

 

Lush^3-e      Lush^2      Blaxius^2.5      Ethernet^3     HDMI^2     XLR^2

XXHighEnd (developer)

Phasure NOS1 24/768 Async USB DAC (manufacturer)

Phasure Mach III Audio PC with Linear PSU (manufacturer)

Orelino & Orelo MKII Speakers (designer/supplier)

Link to comment

the magic of crossposting,

 

our posts have crossed, and I am finished for the day, but your initial response is helpful, I think!

 

Additionally, I think it says volumes that you are willing to post that you can enhance your knowledge through others - this is a good thing! The day I am expert in everything is the day I die. Although I'll be dead long before that :)

 

your friendly neighbourhood idiot

 

Link to comment

Allright.

 

Those who follow me a bit, will understand that the answers to the next questions may destroy my day. Here they are :

 

1. Oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling and oversampling

... which is 64 times only which seems to be enough to make the point clear, will round squares.

That is, if indeed the type of oversampling is allowed to be seen as applying it to a square, which thus rounds.

 

Is it ?

 

2. The reconstruction of a perceived stepping or square otherwise will do the same, or IOW, it rounds the square (or step) to a sine.

 

Does it ?

 

3. Now, never mind the reconstruction filter being a necessity to remove those ugly shapes we will hear through our speakers otherwise, assuming our amps can follow - where is the mechanism to differentiate between squares, steps or transients - that leaves those as intended, instead of, well, killing them ?

 

(somehow I have the hunch it is getting more complex now ... but then I may have been shot per my one but last previous post and all is over and done with)

 

Lush^3-e      Lush^2      Blaxius^2.5      Ethernet^3     HDMI^2     XLR^2

XXHighEnd (developer)

Phasure NOS1 24/768 Async USB DAC (manufacturer)

Phasure Mach III Audio PC with Linear PSU (manufacturer)

Orelino & Orelo MKII Speakers (designer/supplier)

Link to comment

As the great Oscar Wilde said... I'm not young enough to know everything...

 

Great work i_s (thats aost as bad as calling you idiot- makes me think you're promoting ixs) ... really enjoyed reading though I don't entirely understand I'm sure (not your fault). I feel like when I was at Uni sitting at the back of the lecture theatre too baffled to ask anything!

 

Eloise

 

Eloise

---

...in my opinion / experience...

While I agree "Everything may matter" working out what actually affects the sound is a trickier thing.

And I agree "Trust your ears" but equally don't allow them to fool you - trust them with a bit of skepticism.

keep your mind open... But mind your brain doesn't fall out.

Link to comment

IS wonderful stuff really , are there any conclusions to be drawn, I have never personally been a fan of NOS dacs, but as you state every design has it's compromises, trimmed resistors, or delta sigma, do you have a preference. In my limited experience the entire implementation of the dac, appears to ave more effect than the 'character' of the converter .

Do you have any opinion regarding high sampling rates, I have some fine sounding 'hi-res' files , are they just particularly good recordings or does the sampling rate make a difference? Regards and thanks Keith.

 

Link to comment

Righty ho

 

Peter has been asking about transients, and the issues of high sample rates has come up, which kind of link together. You may remember I said earlier in the thread, about how in a band-limited system you can represent everything with a combination of sinewaves?

Well, the ADC has to produce band limited output, as otherwise, how can the DAC know what to reconstruct? As an example of this, imagine you had some spurious tone in your recording studio, like say a TV whistling away at 30k - no one can hear it, and if we sample it at 44.1k using our ADC, it is happily filtered out ( as it is above our half-sampling rate ). Now imagine we remove the filter from the ADC for some reason, and therefore remove our band-limited source. The 30k tone now aliases back down to 14.1k, which our DAC ( filtered or not ) happily recreates. ( a filterless DAC will, interestingly generate the 30k tone as well, and one at 48.2k as well.

Now, fortunately, every ADC in the world is band limited, so we'll take it as a given that the audio given to the DAC is band-limited.

OK, so what happens if we have something with a lot of transients? Imagine we have something with infinite bandwidth that we are sampling? Like a perfect square wave?

It so happens we can define a square wave as an infinite series, where we have the fundamental ( say 1kHz ) - we now add an infinite number of "odd" harmonics, each one smaller by the ratio - this means a full scale 1kHz square wave can be represented by :

1kHz full scale sine wave + 3kHz / 3 + 5kHz /5 + 7kHz / 7 + 9kHz / 9, ... 1001kHz /1001 etc.

Now, as we've seen, DACs and ADCs don't have infinite bandwidth, or resolution, so either the size of the nth harmonic is lost in the noise, or we run out of bandwidth.

 

So, let us, for example consider a 3kHz square wave sampled at 44.1k. This means we can only represent the first few harmonics - (3k , 3*3k, 5*3k , 7*3k ) before we hit our nyquist wall. However, those higher harmonics we have lost are by definition outside of our bandwidth, and hence ( in theory, anyway ) inaudible. Now, our filterless DAC in this scenario reproduces baseband tones correctly, but rather than recreate the series filtered out by the ADC, it adds ones linked to the sample rate!

So, if we imagine our perfect square wave as successively smaller sines at ( truncated for brevity )

3000,9000,15000,21000,27000,33000,39000

our filtered DAC will generate successively smaller sines at

3000,9000,15000,21000

our filterless DAC will generate successively smaller sines at

3000,9000,15000,21000 and then successively BIGGER tones at 23100, 29100 , 35100 and 41100

 

 

So, the upshot of all this is that not filtering doesn't improve actual transient response. Higher sample rates WILL improve transient response, but arguably by reproducing tones we can't hear...

 

I've attached another spreadsheet that basically represents what might come out of a filtered DAC with a filtered square wave input - you may need a fast(ish) PC for this one...

 

http://spreadsheets.google.com/pub?key=tlFKNX7j9BHt02dBRm-KNcg&single=true&gid=1&output=html

 

NB note the ringing on the tops and bottoms is NOT filtering - it's Gibbs phenomenon, which means that my spreadheet isn't infinitely big....

 

your friendly neighbourhood idiot

 

Link to comment

I_S,

 

Thanks for all this - it's really interesting stuff.

 

My question:

 

Is there any theoretical difference in performance between a multi-bit and delta-sigma DAC in how single, non-periodic transients are handled? E.g. the 'hard' striking of a cymbal.

 

Mani.

 

Main: SOtM sMS-200 -> Okto dac8PRO -> 6x Neurochrome 286 mono amps -> Tune Audio Anima horns + 2x Rotel RB-1590 amps -> 4 subs

Home Office: SOtM sMS-200 -> MOTU UltraLite-mk5 -> 6x Neurochrome 286 mono amps -> Impulse H2 speakers

Vinyl: Technics SP10 / London (Decca) Reference -> Trafomatic Luna -> RME ADI-2 Pro

Link to comment

Hi Mani,

 

the blunt answer : No.

 

Will there be differences in performance between DACs with source material with a lot of transients? Yes.

 

The ADC that does the bandlimiting will determine the distribution of the energy of that transient ( and don't forget, something hitting something may seemto be super quick, but is it in the microsecond range? doubtful ). The energy that is reproduced will vary by DAC, mostly due to the filtering in the DAC. In theory, a multibit DAC can have a higher slew rate than a delta sigma, assuming you do without a filter, but this slew rate would be utilised to build the wrong output - there is no higher frequency content in the original recording,

 

Don't forget that something like DSD can reproduce 100kHz sinewaves ( with lots of noise, right enough )...

 

Also, don't forget that most of the discussions here are talking about hypothetical systems - real ones will have different choices of compromises, but this is one area where the maths basically can't be fiddled...

 

your friendly neighbourhood idiot

 

 

Link to comment

@i_s @Peter

 

What I'm trying to say is a stepped sine is a sine modulated with higher frequency stuff

- i_s

 

a square (hence step) comprises of many small sines (aha, high frequency ones) because electrically it works like that (added to that : I think it is allowed to say that a pure square consists of an infinit number of small sines, and while a pure square electrically cannot exist, the "infinit" number of sines is mathematically solved by not being inifit in amount).

- PeterSt

 

Right - I get it now - I think. You get to find out some fascinating stuff. It seems the "fourier" transformation of the stepped sine into constituents is done in the ear - in the cochlea I believe. What comes out of the DAC, into the amplifiers and out of the speakers is the stepped sine. What the brain receives is the constituent sines unbundled by the cochlea.

 

Right?

 

Or back to the drawing board?

 

Link to comment

Ummmm

 

for an input to a DAC that represents a pure tone, (at say 1k), a properly filtered DAC will have no steps - the digital filter moves them up in frequency, and the analog filter removes them completely.

A filterless DAC relies on the ear not detecting the higher frequency tones ( but the electronics might ).

 

The filtered DAC doesn't "choose" which sine wave to output ( it knows how how much bandwidth there can be encoded ) - the stepped sinewave from an unfiltered DAC is a load of sinewaves,

 

does this help, or am I making things worse?

 

EDIT: I think I may be able to demonstrate this with another idiot spreadsheet?

 

your friendly neighbourhood idiot

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...