• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. 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!

Understanding Upsampling/Interpolation

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,282
Likes
4,790
Location
My kitchen or my listening room.
Assuming Procession Power, Storage and Bandwidth (in the PC) is basically free and unlimited. It's not inherently stupid or worse to up sample first and then send the data to the DAC, instead of sending "bit perfect" unchanged data to the DAC and relaying on its internal up sampler?

Well, I'm not sure how you would get that data path out of the chip. Delta sigma chips remodulate the signal in addition to upsampling. You need quite a bit of information about what else would be going on to get that right. It's still PCM, but knowing how the demodulator works is fairly important.
 

Lambda

Major Contributor
Joined
Mar 22, 2020
Messages
1,792
Likes
1,530
j_j
Let me rephrase this question.
Most modern High performance DACs today seem to have internal Oversampling and filter.
So even if the input is 44.1khz the DAC (or a DSP chip before the actual DAC IC) converts this to a multiple of it
For example:
https://www.ti.com/lit/ds/symlink/pcm1789-q1.pdf?ts=1614303757394
Screenshot_2021-02-27_00-42-12.png


Most Audiophiles are of the opinion sending unchanged 44.1Khz data to the "DAC"(the device not the chip) Gives the best possible quality and that every software up sampling inevitably degrades the quality.

I on the other hand think (if done right) software upsampling 44.1kHz to 192kHz does not degrade the quality
(guess you agree on this? but i would like to get this confirmed from someone who actually knows what he is talking about)

if at all software up sampling can be better because the filters implementet without real time needs and almost unlimeted processing power can be better?
 
Last edited:

Lambda

Major Contributor
Joined
Mar 22, 2020
Messages
1,792
Likes
1,530
By the way, check this out, if you can:
Thanks a lot this is awesome!

It answers a lot of my of questions but it raises new questions.


What about binaural issues?

Binaurally, with broadband signals, we
can distinguish 10 microsecond shifts in
left vs. right stimulii of the right
characteristics. While this has implications
in block-processed algorithms with
pre-echo, it does not generally relate
substantially to ADC and DAC hardware
that is properly clocked.
So is pre-echo a real "problem" with modern oversampling DACs?
About a year ago i was totally amazed by the fact that i can hear 1 sample delay at 96kHz and mad some experiments.
My tests led me to the conclusion that i can hear ~10µ delay between my ears.
certainly difficult to understand but for me the fact i can undoubtedly resolve a view µs with my ears was mind blowing.
I later learned its called interaural time delay and that 10µs is the accepted value made me proud because i came so close to this valeu with my test
btw. I have read study's claiming some trained listeners can resolve ~3µs in ABX with abut 70% confidence (i can't)

That’s a good question. Since we are stuck, in
general, with the filters our ADC’s and DAC’s
use, it’s dreadfully hard to actually run this
listening test.

How would I do that?

Get a DAC with a SLOW rolloff running at 4x (192K).

Make a DC to 20 K Gaussian pulse at 192kHz.

Downsample by zeroing 3 of every 4 samples and
multiplying the others by 4.

Generate a third signal with a TIGHT filter.
Compare the three signals in a listening test.

i think this this comes close to my idea of of up sampling ins software with a "better" filter and using the 192kHz of the DAC?

This suggests that for higher sampling rates, we do
not want the ‘fastest’ filter, rather a filter with a wider
transition band, and narrower time response.
This was my intuition that higher sampling rates and filter with a wider transition band can perform better


One could do another 2 hours on how to test
converters. Is there a demand?
Yes please :D
 
Last edited:

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,282
Likes
4,790
Location
My kitchen or my listening room.
Thanks a lot this is awesome!

It answers a lot of my of questions but it raises new questions.



So is pre-echo a real "problem" with modern oversampling DACs?

The irony of pre-echo is that it's worse with crappier filters. It's also worse with steeper filters.

All I can say is "I hope not".

The problem remains that when you upsample you have to remove images, so you still need a sharp filter to start with. Crochiere and Rabiner's "Multirate Digital Signal Processing" book has a lot of useful information on that. If I can find the book in a box downstairs I'll give you page numbers, but despite the fact it's an old book, it's still extremely useful.

As to testing DAC's, I recall doing a presentation on that. Somewhere. Somehow. Look at the PNW site. It might have been a subset of the talk on sample rate conversion, but I'm not sure, sorry.
 

Head_Unit

Major Contributor
Forum Donor
Joined
Aug 27, 2018
Messages
1,361
Likes
721
At 44.1 kS/s (CD rate) a signal at 20 kHz has an image at 24.1 kHz as shown in Amir's picture.
Actually the picture is not rendering at least in Safari on this MacBook Air. I'll fill in the other part where a 34.1 kHz signal would produce an aliased tone at...10?? kHz. But anyway, what would happen if you DIDN'T suppress that stuff?

What if there was no antialiasing filter, no analog output filter? Never mind the theory, in real life where there is little very high frequency musical content, and microphones roll off up there as well, what would really happen? I have often wondered this but never seen any discussion.
 

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,282
Likes
4,790
Location
My kitchen or my listening room.
Actually the picture is not rendering at least in Safari on this MacBook Air. I'll fill in the other part where a 34.1 kHz signal would produce an aliased tone at...10?? kHz. But anyway, what would happen if you DIDN'T suppress that stuff?

What if there was no antialiasing filter, no analog output filter? Never mind the theory, in real life where there is little very high frequency musical content, and microphones roll off up there as well, what would really happen? I have often wondered this but never seen any discussion.

Then the first time someone hits a glockenspiel, bell, crash cymbal, etc, you'll run screaming, is the answer.
 

Head_Unit

Major Contributor
Forum Donor
Joined
Aug 27, 2018
Messages
1,361
Likes
721
Then the first time someone hits a glockenspiel, bell, crash cymbal, etc, you'll run screaming, is the answer.
Not necessarily. While I remember from engineering school that a cymbal has an almost shockingly wide response though the shock is more at how low they go. Here we can see even the cymbal decreasing in intensity at the highest frequencies: https://www.audiorecording.me/drum-...s-drum-hi-hats-snare-and-crash-cymbals.html/2

It would be really interesting to have a DAC with a "remove the filters" option...well OK actually I was wondering also what would happen if you didn't antialias filter at the A/D end. I'm doubting there is enough ultrasonic content to say slew rate limit the A/D inputs.
 

Lambda

Major Contributor
Joined
Mar 22, 2020
Messages
1,792
Likes
1,530
The irony of pre-echo is that it's worse with crappier filters. It's also worse with steeper filters.

All I can say is "I hope not".
I was hoping you can say it surly is not an real world issue
Howcan we identify and measure crappier filters?

Looking at impulse responses? what to look out for?


Crochiere and Rabiner's "Multirate Digital Signal Processing" book has a lot of useful information on that. If I can find the book in a box downstairs I'll give you page numbers, but despite the fact it's an old book, it's still extremely useful.
Thanks, i try to find that book.
 

DonH56

Master Contributor
Technical Expert
Forum Donor
Joined
Mar 15, 2016
Messages
7,905
Likes
16,728
Location
Monument, CO
Actually the picture is not rendering at least in Safari on this MacBook Air. I'll fill in the other part where a 34.1 kHz signal would produce an aliased tone at...10?? kHz. But anyway, what would happen if you DIDN'T suppress that stuff?

What if there was no antialiasing filter, no analog output filter? Never mind the theory, in real life where there is little very high frequency musical content, and microphones roll off up there as well, what would really happen? I have often wondered this but never seen any discussion.

What is with this idea that theory does not work in real life? In real life you'll be adding high-frequency content not in the original source just as the theory says. The DAC does this via sampling theory. Note when sampled and reproduced at 44.2 kS/s, everything in the baseband from DC to 22.1 kHz is imaged, creating a cacophony of new sounds unrelated to what was in the original. That is, they are not harmonics such as might be find in music, but tones unrelated to the original music now attacking your tweeters and ears. Some of that will be modulated (distorted) back to much lower frequencies by nonlinearities in your electronics and speakers, adding to the mess. Basically what @j_j said (of course).

On the ADC (recording) side you can look at this thread for a look at aliasing: https://www.audiosciencereview.com/forum/index.php?threads/digital-audio-aliasing.1920/

On the DAC (playback) side, this thread touches upon images: https://www.audiosciencereview.com/...ital-audio-converters-dacs-fundamentals.1927/

Aliasing and imaging absolutely happens in real life, and it sounds bad. It creates new signals (sounds) not related harmonically to the original sounds, sort of like adding an out-of-tune instrument or singer to the mix. Dissonant, harsh, etc.

This is a different issue from the pre-echo issue that @j_j and others are discussing, though related because to get rid of images, you must filter the DAC's output, and some filters are worse for that than others.
 

Lambda

Major Contributor
Joined
Mar 22, 2020
Messages
1,792
Likes
1,530
Screenshot_2021-02-27_17-28-58.png


First to second track is going from 44.1--> 384khz (with what ever filter audacity is using for up sampling)
It shows a lot of pre echo but its mathematical correct?

Third track is "stupid" upsampling to 192khz without any anti aliasing or filtering just sample doubling.
If i understand it right this would add imaging outside the audible band over 192/2 kHz?

So if we now remove everything over for example 40kHz with a "noarmal" 48dB per octave filter (fourth track)

Now there is almost no pre-echo if we go to the final 384khz output format but i have not changed anything in the audible band?
 

Attachments

  • 1614439582068.png
    1614439582068.png
    114.8 KB · Views: 89

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,282
Likes
4,790
Location
My kitchen or my listening room.

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,282
Likes
4,790
Location
My kitchen or my listening room.
Now there is almost no pre-echo if we go to the final 384khz output format but i have not changed anything in the audible band?

However, now you have a bunch of ultrasonics hitting your electronics and your tweeter, and from experience, they are likely to do "something".

What that is depends entirely on the specific unit. Sometimes it's ok. Often it's more "interesting". It's hard to characterize such things, except to say that IM brings stuff out of the band down into the band sometimes, in, how to put this, "disturbing" ways.
 

Lambda

Major Contributor
Joined
Mar 22, 2020
Messages
1,792
Likes
1,530
However, now you have a bunch of ultrasonics hitting your electronics and your tweeter, and from experience, they are likely to do "something".
looks like "There is no free lunch"?
I thought 40kHz with a "noarmal" 48dB per octave filter will take care of it... what if the filter would be at 22khz?
Btw. what i reference to as normal analog like filter is called "minimum phase filter" or iir?

Is there a way to completely avoid pre echo and if so whats the compromise?

This paper sounds like a good reference for this topic? (i have not bought it)
https://www.aes.org/e-lib/browse.cfm?elib=17497
 

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,282
Likes
4,790
Location
My kitchen or my listening room.
looks like "There is no free lunch"?
I thought 40kHz with a "noarmal" 48dB per octave filter will take care of it... what if the filter would be at 22khz?
Btw. what i reference to as normal analog like filter is called "minimum phase filter" or iir?

Is there a way to completely avoid pre echo and if so whats the compromise?

This paper sounds like a good reference for this topic? (i have not bought it)
https://www.aes.org/e-lib/browse.cfm?elib=17497

I'm not going to comment on that paper.

When you set a transition band on a filter, that determines, effectively, the impulse response length (even if it's an analog filter, via storage in the filter components). What you don't determine immediately is the phase characteristics.

Now, by going from minimum phase (all poles and zeros inside the unit circle/left half plane) you can trade off phase shift and/or group delay (same thing expressed in different ways) for total delay (flat delay at all frequencies) which gets you to "linear phase" (better described as "constant delay"). Such filters are FIR only. There is no "constant delay" filter in any IIR design, that would require infinite delay and poles outside the unit circle. Good luck with all that. Now, one can approach that (with a lot of effort) by using allpass sections to correct for the delay, but you're still bound by the issue that a precise elimination of phase shift (in favor of delay) requires infinite time.

A constant delay filter is either symmetric or (if it has a zero at DC) antisymmetric. So it has substantial pre-ringing, but the magnitude of that is controlled by the length of the filter, the in-band ripple, and the width of the transition band.

So, what's better? Good question. Some people go for a "partially minimum phase filter", some insist in constant delay, a few insist on minimum phase.

There needs to be more work done on the testing of audibilty of such. This is an absolute (*&(*&(*&&* of a test to run. Pretty much, you need 10 year old trained listeners to have any hope of hearing anything.

IIR filters by definition have minimum phase poles, otherwise they would be either uncontrollable (on the unit circle) or unstable (outside the unit circle). (For analog filters substitute "wrong half-plane". IIR filters by nature can never be perfect constant delay.

FIR filters can be anything. They are usually designed as 'constant delay' but there is absolutely no reason that they can ONLY be constant delay. You can make one minimum phase, maximum phase, whatever you want, since they only have zeros.

(Sorry, just noticed you also asked that question.)

So, here's another slide deck to peruse:

https://www.aes-media.org/sections/pnw/ppt/jj/filtutv1.ppt

That is very, very old. Maybe it's time I do that again, and have the talk recorded?
 
Last edited:

Lambda

Major Contributor
Joined
Mar 22, 2020
Messages
1,792
Likes
1,530
@j_j Again, Thanks a lot for sharing this knowledge.

Looks like Dunning Kruger example

Typical un experienced user:
"192kHz/24bit > 44.1kHz so its maybe better."

Self proclaimed expert who once heard about Nyquist–Shannon sampling theorem:
"44.1/1 is already perfect! it's mathematically proven.. your have fallen for pure snake oil marketing.hahah"

Then you learn about ITDs, filter response, asliasing, pre eco, up/over-sampling, noise shaping... and it looks like its not not that easy...

And the real experts say: "well, it's complicated"
There needs to be more work done on the testing of audibilty of such. This is an absolute (*&(*&(*&&* of a test to run

and:
FIR filters that emulate downsampling for sam-ple rates of 44.1 kHz and 48 kHz can have a dele-terious effect on the listening experience in awideband playback system.2. 16-bit quantization with and without RPDFdither can have a deleterious effect on the listen-ing experience in a wideband playback system.
 

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,282
Likes
4,790
Location
My kitchen or my listening room.
@j_j Again, Thanks a lot for sharing this knowledge.

Looks like Dunning Kruger example

Typical un experienced user:
"192kHz/24bit > 44.1kHz so its maybe better."

Self proclaimed expert who once heard about Nyquist–Shannon sampling theorem:
"44.1/1 is already perfect! it's mathematically proven.. your have fallen for pure snake oil marketing.hahah"

Then you learn about ITDs, filter response, asliasing, pre eco, up/over-sampling, noise shaping... and it looks like its not not that easy...

And the real experts say: "well, it's complicated"


and:

Where is that second quote from? The hyphenation seems odd.

As to the sampling theorem, the sampling theorem is correct, but there are, at least hypothetically, nonlinear issues that could create problems. Pre-echo is an example of something that can create nonlinear effects.
 

Lambda

Major Contributor
Joined
Mar 22, 2020
Messages
1,792
Likes
1,530
Where is that second quote from? The hyphenation seems odd.
its from this paper:
https://www.aes.org/e-lib/browse.cfm?elib=17497
I have nave not read it completely nor do i claim to fully understand everything, that's just from the conclusions.
someone with access over university library "showed" it to me.

Nothing wrong with the sampling theorem. But it makes Somme assumptions that are not necessarily true in the real world.
Perfectly band limited and ideal filters for example.

By the way all this theoretical nonsense aside im still perfectly able to listening and enjoy 192kbit/s MP3s from youtube streamed over Bluetooth...
nevertheless i find this interesting to know about the theoretical limits and and then apply a safety factor like in Civil engineering :)
 
Last edited:

j_j

Major Contributor
Audio Luminary
Technical Expert
Joined
Oct 10, 2017
Messages
2,282
Likes
4,790
Location
My kitchen or my listening room.
Nothing wrong with the sampling theorem. But it makes Somme assumptions that are not necessarily true in the real world.
Perfectly band limited and ideal filters for example.

Actually, there are no assumptions. It's a proven theorem, mathematically.

Where the problem arises is when a theorem regarding LINEAR systems runs into a system that is time-varying, signal-varying, and substantially nonlinear, which is to say human hearing.
 
Top Bottom