Jump to content
IGNORED

Digital Filtering


Recommended Posts

Hi Harry,

 

the filter as illustrated is a pure sinc function, which is arbitrarily truncated ( to 64 taps in the example ). In real-world filters, quite some time is taken optimising the sinc ( usually by using a window on the coefficients ) - this means that actually the filter illustrated isn't very good, and as it rolls off to be -6dB @ Fs/2, you will get quite a lot of imaging, which will be worse at high frequencies than lower ones. It's easier to see this in the frequency domain via an FFT, but will manifest itself as deviations from a pure tone in the time domain

 

As for pre-processing the data in a PC, the short answer is yes you have an arbitrarily long amount of time to do the processing. The drawbacks of this are:

(a) Better filtering means longer filters, which means longer pre and or post ringing, which is subject to some discussion

(b) You are limited to 24 bit resolution, as that's the most number of bits a DAC can receive via standard interfaces, whereas a filter internal to the DAC can have wordlengths as long as the designer wishes

© The output from your PC is at a higher sample rate, so jitter may become more of an issue.

(d) Most DACs will do some kind of filter, no matter what you input to them, so you are still to some extent at the mercy of that.

I believe that quadratic interpolation has been tried (Wadia?), and I'd be interested in your findings, (NB I'll nail my colours to the mast, and say I don't think it's a good idea..)

 

I can assure you that there are real filters in real DACs that output 20kHz sinewaves with images < -120dB down ( or 0.0001% ) - HiFi news do measurements on the website for this very thing ( stopband rejection )...

 

your friendly neighbourhood idiot

 

Link to comment

@i_s

 

Very pleased to hear about the better filters :)

 

This is becoming like a forum based degree course in DSP so I will allow myself the luxury of maybe one more post and then retire to a book!

 

One point: I don't see why software based interpolation should produce pre or post ringing. With software one need not use feedback loops as I would suppose there are many other ways of doing it. Maybe I am confused though.

 

Harry PhD DSP (distinction)

 

Link to comment

Hi Harry,

 

The long ringing just emerged from your own question

 

We could take as long as we wanted to to do this to get better results

 

which (I'm sure) i_s interpreted as more looking ahead (FIR) or more looking back (IIR). So, the more this happens, the longer the ringing will be.

 

I guess this is not exactly what *you* meant by your question, and I'd say possibly there are more "smart" ways to do it (I may start off with a randomizer myself hehe).

 

Anyway, and FYI (and if you didn't know already), this (preprocessing) is exactly what I am doing currently.

 

Btw, the higher frequencies are more troublesome, because we don't have enough samples to form the nice shape. Thus, an 11025 Hz frequency only allows for 4 "dots" so to say, and with 4 dots only, how to create a nice looking sine. Go to half that frequency, and you already have 8 (wow). And so on.

To my own experience (but you can check that in the spradsheets now) things get to start problematic (looking upwards) towards 5000Hz for 44.1. Now all is simple : at double the sample rate, things will get problematic at 10000Hz, right ? Double it again, and we're all out of problems (almost).

 

Of course the above is a strange angle to look at this, but it is just my empirical finding by looking at THD, NOS-Unfiltered and where it really starts to go bananas. For fun :

 

I can assure you that there are real filters in real DACs that output 20kHz sinewaves with images < -120dB down ( or 0.0001% )

 

And I can assure you that with really nothing filtered and nothing upsampled, figures start to be 12-15% rather soon after 1000Hz ...

 

Peter

 

PS: ... But I can also assure you that those 0.0001 whatever % DACs kill the transients which are real steep thingies which should stay like that.

Oh my. :-)

 

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

 

This seems to be exactly what I have found. The higher the frequency the less dots or samples you have the more etch-a-sketch the reconstructed wave becomes. Around 10KHz or below this seems to happen. O have a question about transients later when at a computer.

 

@i_s

 

I was being stupid. Quadratic will not work you need at least third order polynomial for higher frequencies as dots or samples can cover more than one maxima/minima. May try it But may run out of patience!

 

Link to comment

It doesn't matter - as long as there are more than 2 per cycle, and the source is band-limited.

The 20kHz sinewave is represented as perfectly as a 1kHz sinewave - the reconstruction filter is not easy, and 20kHz is the top end where we're striving for "perfectness" - the problem is because the image is very close to the fundamental in frequency, and of equal(ish) size.

The reconstruction filter ( as a whole ) doesn't "join the dots" - it outputs what the original signal must have been knowing that it was band-limited.

This is why the idea of less filtering leads to sharper transients is flawed - the signal already has been filtered by the ADC so cannot have "steeper" transients. Less filtering will lead to less ringing, but the steepness is unchanged.

 

I don't think I'm explaining things very well here, I'll try again later,

 

your friendly neighbourhood idiot

 

Link to comment

I don't think I'm explaining things very well here, I'll try again later,

 

Hmm ... maybe it is easier if people just skip my post about this ?

 

I guess it is the combination of the digital and the analogue part where it goes wrong with me.

 

The reconstruction filter ( as a whole ) doesn't "join the dots" - it outputs what the original signal must have been knowing that it was band-limited.

 

I understood that until someone came along and said it is the analogue part of the filter doing this all. How ?

And to keep in mind : until some stage everything seemed solved by a spreadsheet (so to say), but down to the real merits it's worth nothing ? I for one am not helped by some virtualization in order to understand better. Not if it is not the truth.

 

the signal already has been filtered by the ADC so cannot have "steeper" transients

 

This looks upside down to me. Nobody (at least not me) wants steeper transients than how the actual data (CD) is. Some though (me, and I am not saying this is what everybody should want !) like to preserve that. Thus, if you had said "More filtering will lead to more ringing but the transients will remain the same" then at least I would have understood that (which is different from believing it, which for me is only about understanding it first).

 

Keep on going, and try to ignore my ignorancy ! (I mean that; I will get it some day I suppose)

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

This is from the product information for the Chord 64

 

However, 44.1 kHz sampling can be capable of accurately resolving transients by the use of digital filtering. Digital filtering can go some way towards improving resolution without the need for higher sampling rates. However in order to do this the filters need to have infinite long tap lengths. Currently all reconstruction filters have relatively short tap lengths - the largest commercial device is only about 256 taps. It is due to this short tap length and the filter algorithm employed that generates the transient timing errors. These errors turned out to be very audible. Going from 256 taps to 1024 taps gave a massive improvement in sound quality - much smoother, more focused sound quality, with an incredibly deep and precise sound stage.

 

and

 

At this stage, a new type of algorithm was developed - the WTA filter. This was designed to minimise transient timing errors from the outset, thereby reducing the need for extremely long tap lengths. The WTA algorithm was a success - a 256 tap WTA filter sounded better than all other conventional filters, even with 1024 taps. WTA filters still benefit from long tap lengths; there is a large difference going from 256 taps to 1024 taps.

 

I don't believe that transients have to be high frequency - I think they have lower frequency components but that last (natch) for only very short time periods. So they should get through the ADC filtering ... ?

 

But are they then "smoothed" away by the filtering because that tap lengths are (according to Chord) too short?

 

Are Chord talking marketing foo or is there some truth there wrt tap length/type and transients?

 

This is how threads like this are extremely useful for me as they can help separate the science from the marketing foo.

 

 

Link to comment

Peter,

 

you need the analogue filter because everything in a sampled system has images - so, imagine we are going to oversample by 4:

Your data @ 44.1k has a mirror image reflected around 22.05k ( and smaller ones repeated at 22.05k multiples later on ), and an audioband of DC-20kHz

Your oversamped, filtered data @ 176.4k has a mirror image reflected around 88.2k ( and smaller ones repeated at 88.2k multiples later on ) and an audioband of DC-20kHz.

 

So, to prevent stuff that isn't in the original sampled data you need a low pass analogue filter that is effective over the final sample rate - it may happen that with an oversampled DAC, the downstream output stages naturally have say a 40kHz bandwidth which acts as a filter - the point is that in a well designed DAC, the digital filter and analogue filters work together to remove all the images

 

your friendly neighbourhood idiot

 

 

Link to comment

Harry,

 

Firstly, I have no idea how a WTA filter works - very thin on detail!

 

Secondly, a transient has, by definition a lot HF - it's a sudden change - frequency is, after all a rate of change... that's not to say it's entirely HF, but there will be some...

If you have NO filter, counter-intuitively you get less "real" HF energy, but more imaging - there is an something called the "aperture" effect, where if the DAC output changes at the original sample rate, you get a slow sinc type response - I think it's a few dB down at 20kHz. Longer filters mean you can have a flatter response in the high frequency area whilst still avoiding imaging. I'll try and do some graphs at some point, but in the meantime:

A longer filter is "steeper" - the more attenuation it can achieve in the transition band ( 20k->22.05k )

A longer filter also rings more, which may or may not be important.

 

So, the choices a filter designer has are as follows:

Where does my filter start to roll off?

How quickly does it roll off?

Where should it reach full attenuation?

How long can my filter be?

And all of these things are linked together....

 

The example in the spreadsheet is known as a half-band filter, which is the most common hardware implementation. The maths work out such that every other coefficient is 0, ( or as close to it as to be irrelevant ). This means that you know that the multiplier result is 0, so you don't have to do it ( hence good efficiency ). The drawback is that it will only offer 6dB of attenuation at 22.05kHz, and what happens is that the more taps you have the flatter the filter is to 22.05kHz, and the quicker it rolls off afterwards. This, again, may be important...

 

your friendly neighbourhood idiot

 

 

 

Link to comment

Hehe, as always, thanks i_s. I guess we will be getting there. I say "we" because it may be a matter of understanding (eachother).

 

Allright. So what am I doing wrong - or do not understand - when I don't have any images and I don't have any (formal) analogue filter. So, I worked explicitly on a digital filter to remove the images, and you will recall the pictures of it. And, only because my noise floor showed wrongly we have seen them, but since they now are officiallly under the noise floor they as officially can't be measured.

 

So, now you will understand better why I stopped understanding it all when the analogue filtering came into play, since I don't see any images in the first place, so where does the analogue filter come in to remove something that isn't there (to my eyes and brain), ok ?

And I say it before you ask it : my I/V stage is as lean as can be, so that won't filter much BUT I measure at the end of the interlink (to keep it honest).

 

And FYI : I let the transition start at 19.8KHz and at 22.05 it is 125dB down *and* I upsample 4 times ...

(and again, I'll have a nice pile of ringing which so far I don't care about (nice subject eh ?)).

 

Is this dead wrong ? Do I overlook something ?

 

One other thing to clear things up : when I say transients are killed, I say this only because I perceive this (audibly) from heavy oversampling, and not from filtering or because I just think it does from filtering. I only think it does from heavy oversampling which also is not difficult to reason out. Never mind this please, and I only say this to let know there is no disagreement on this subject, as long as the heavy oversamplers stay out of the picture (and this is not the subject here I think).

 

Once again, thanks for your time.

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,

 

if you're oversampling 4x, then a 1kHz tone will have an image at 175.4kHz - you'll only be able to see this with a analyzer sampling at over 400k or so...

I've looked up the PCM1704 datasheet ( I seem to recall that's the one you're using ), to see if maybe it has an internal filter, and apparently it doesn't, but it does say ( page 9 )

"The suggested DAC post filter is a second-order lowpass

active filter, using the multiple feedback (MFB) circuit

technique. The OPA2134 is an excellent choice for the op

amp in this circuit, since it is designed for high performance

audio applications. The post filter is used to reconstruct and

band limit the DAC output signal."

 

I guess you've replaced that linear interpolate you had as a filter?

 

your friendly neighbourhood idiot

 

Link to comment

Yes, of course I can't see anything above 96KHz ! and yes, of course images will be there, above 96KHz !

I am sorry I have been misleading here ... it was not on purpose (and at the time of writing my before post I didn't even think about that :-(

 

Then, I am not sure what the quote of the PCM1704 datasheet is for, but no, I don't use anything there (this is not a bought thing, but an own design).

 

And Yes, the current XXHighEnd version (not public yet) now applies filtering instead of (stupid) L.I. explicitly anticipating on DACs without filter (and that only), for those who may think filterless (and NOS) is better -> they can easily try now). But where does this leave me ?

 

Am I doing (very) wrong by leaving in the images above 96KHz (or 88.2, which would be more realistically because 44.1 is assumed to be the base and I only use "even" upsampling) ?

My own amps do 200KHz "flat" and no spurs of "flair" are left to my ears. Of course the speakers will filter out what is left behind the amps, and my only concern would be people with amps *not* doing 200KHz (but say 100KHz), and then the amp may go bananas.

 

Ok, I think I got it all now (and once again : thanks a bunch !). What do you think about this idea :

 

Upsample 8 times (which I think is still reasonable regarding "flattening of transients" (and that assumed to be true)), filter as usual, and then downsample to 4 times so we don't need a 384 capable DAC ...

This may look "useless" to you, but remember, all has to be done in software - before everything goes into the DAC, and we (99.9999 % of people) don't have a 384 connection from the PC ...

 

I guess that works for removing the images up to 192 (176.4) ... but what will have happened to the data (assuming I apply a proper filter for downsampling again) ?

Or maybe you know another way/route than applying a filter two times (not wanting an analogue filter hehe) ? Please keep in mind I can't measure this anymore, so the theory must just be good ...

 

Foolish P.

 

(PS: The good cause of this all is the best DAC in the world, and not for myself only ...)

 

 

 

 

 

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,

 

glad to be of help!

 

The problem you have with the downsampling is that the imaging occurs mirrored around whatever the output sample rate is - so, you interpolate 8 times to give you 352.8k.

You then decimate x 4, and the images will come back down as well - so the DAC output will still have images around 44.1k....

 

your friendly neighbourhood idiot

 

Link to comment

You don't mean around 88.2K, do you ?

 

Anyway, I suppose you are not going to tell me that an analogue filter is just needed.

 

... because you already did that a few times. Hahaha

 

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

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...