Apodizing filter
Feb 28, 2024 at 4:22 AM Post #166 of 221
It is entirely the wrong type of test for that! Firstly, you are not initially causing clipping, your EQ will almost certainly be operating at 32 or 64bit float, so effectively there is no clipping point. However, you’re then writing a 16bit file so at some stage the 32/64bit signal has to be converted back to 16bit fixed and at that point all bets are off. In theory you’d get a whole slew of ultrasonic odd harmonics, plus a bunch of harmonic distortion in the audible band but what you really end up with is entirely down to the coding. For example the coding may employ some sort of gain reduction to scale the 32/64bit output back to the clipping limit of a fixed point format, it might apply a limiter to do that, it may apply dither, an anti-alias filter, any or all of these things in combination, do something different or do nothing at all and just truncate the result (although that would be pretty incompetent), in which case you’d get aliasing along with truncation, harmonic and probably every other type of distortion. So it’s useless for “identifying the type of distortion” because it could be almost any type of distortion or even pretty much every type of distortion at the same time!

G
Ok, so in the recordings I took, distortion is still present in the 16x oversampled file, so given that oversampling heavily mitigates aliasing by moving the nyquist frequency higher (705.6kHz in this instance), the remaining distortion would be therefore not aliasing and be another type of distortion.

If you listen to the file, the non oversampled file has very audible and prominent spikes at 12k, 8k, and 4k dominating over the other types of distortion, which I interpreted as aliasing and we have now confirmed to be the case by removing it via oversampling. What is left is some non-linear distortion that sounds like much quieter static, and this is what I assume to be IMD because it is audible, whereas harmonic distortion using 16k as the principle frequency would begin occurring at 32k, thus well beyond the theoretical limit of human hearing.

Which part of this reasoning is incorrect?
 
Last edited:
Feb 28, 2024 at 4:40 AM Post #167 of 221
I was mistaken in thinking the DAC filter had anything to do with this, so thank you for that.
Just for clarification. In the above scenario, then the freqs above Nyquist caused by clipping are already aliased back into the file (below Nyquist) before it gets to the DAC (assuming no anti-alias filter is applied), along with harmonic and any other distortion in the sub-Nyquist freq band. So the only effect the DAC filter will have is on distortion (inc. aliases) in the filter’s transition band, say above 19kHz or so.
Which part of this reasoning is incorrect?
There maybe no part of that reasoning is incorrect, certainly the aliasing “interpretation” is indicated and the rest of it could be correct as well, or it might not be. Ultimately, we can say your reasoning is incorrect because you’re using an illegal clipped signal and there’s no way of knowing exactly what’s going on without considerable detail provided by whoever coded the plugin/processor, a level of detail they’re unlikely to provide even if asked. You’re using the wrong test/signal for the task and the best you’re going to get is “interpretations”, assumptions or guesses, with varying probabilities of being correct and none of them 100% certain.

G
 
Feb 28, 2024 at 5:27 AM Post #169 of 221
For reference, I heard aliasing explained in this video.
The 144dB range of 24bit ADCs isn’t the case in reality/practice but as an oversimplification to explain why 24bit is useful when recording, it’s fine. The information in rest of the video seems entirely accurate. You just have to be very careful about how you interpret and apply the information, a potential pitfall that all of us fall into at some stage because digital audio is not always intuitive and the tendency is to interpret information according to how we conceptualise digital audio to work, rather than how it actually works.

G
 
Feb 28, 2024 at 5:31 AM Post #170 of 221
The 144dB range of 24bit ADCs isn’t the case in reality/practice but as an oversimplification to explain why 24bit is useful when recording, it’s fine. The information in rest of the video seems entirely accurate. You just have to be very careful about how you interpret and apply the information, a potential pitfall that all of us fall into at some stage because digital audio is not always intuitive and the tendency is to interpret information according to how we conceptualise digital audio to work, rather than how it actually works.

G
I am sorry, that video briefly explained aliasing among other things, but I forgot that it referenced another video by fabfilter going in depth about sample rates as it affects production. I'm still trying to understand this stuff bit by bit. I totally agree, so thank you for humoring me.
 
Feb 28, 2024 at 11:23 AM Post #171 of 221
This thread moves further and further away from the original topic.
Ok, so in the recordings I took, distortion is still present in the 16x oversampled file, so given that oversampling heavily mitigates aliasing by moving the nyquist frequency higher (705.6kHz in this instance), the remaining distortion would be therefore not aliasing and be another type of distortion.
There's no way to guarantee that you have no aliasing present due to clipping if you clip the signal. Oversampling doesn't completely remove aliasing, it just reduces it. In practice, it can be reduced so much that it just disappears into the noise floor but x16 might not be enough for that, especially if you clip it by 10dB. Maybe you still have some of the aliasing left in the signal. It would be best to do a proper test without the clipping present, which I suspect would eliminate the spikes you see in the spectrum as they are most likely caused by aliasing, not by IMD.

There is considerable amount of aliasing below ~22kHz I still get when I use x8 oversampling with a ~17kHz tone clipped by 10dB. This definitely would not disappear to the noise floor of a DAC.
clip spectrum.jpg

If you listen to the file, the non oversampled file has very audible and prominent spikes at 12k, 8k, and 4k dominating over the other types of distortion, which I interpreted as aliasing and we have now confirmed to be the case by removing it via oversampling. What is left is some non-linear distortion that sounds like much quieter static, and this is what I assume to be IMD because it is audible, whereas harmonic distortion using 16k as the principle frequency would begin occurring at 32k, thus well beyond the theoretical limit of human hearing.
The clipping generates an infinite amount of harmonics that gets wrapped around/bounced between the nyquist frequency and 0Hz. The clipping also only generates odd harmonics. So a 16kHz sine wave getting clipped would generate harmonics at 48kHz, 80kHz, 112kHz and so on... You could verify that yourself by clipping a 100Hz sine wave. The harmonics would be at 100Hz 300Hz 500Hz etc... The reason you do not see an infinite amount of harmonics is mainly because as the frequency gets higher, the amplitude gets lower and lower so all the higher harmonics eventually disappear into the noise floor. I think what is left in your case is not IMD but still some aliasing from the higher harmonics. Don't try to oversample a file to get rid of aliasing, make a new recording that has no clipping and thus, no aliasing as that test would not be as ambiguous as this one.

You could calculate where the harmonics are supposed to show up based on the fundamental's frequency and the sampling rate.
Let's look at a simple example. Take a 15kHz tone with a sampling rate of 48kHz. If you clip it, the harmonics present are the following: 15kHz, 45kHz, 75kHz, 105kHz, 135kHz...
The generated frequencies get reflected back and forth between 24kHz and 0Hz. In this case, the infinte number of harmonics only generate a few due to how they get wrapped around nyquist and 0Hz.

So the first harmonic (15k) is going to be at 15kHz.

The third (45k) harmonic is over 24kHz by 21kHz. Thus, it gets reflected back from 24kHz by 21kHz, making it appear at 3kHz (24k-21k).

It's starting to get more convoluted for the fifth (75kHz) harmonic. It is over 24kHz by 51kHz. So it would reflected back to "-27kHz" (24k-51k), however, it wraps around 0Hz as well so it actually gets reflected to 27kHz. This is still above nyquist by 3k so it gets reflected from nyquist by 3kHz, putting it at 21kHz (24k-3k).

105kHz is over nyquist by 81kHz. It gets reflected to -57kHz so it wraps back at 57kHz. 57kHz is over nyquist by 33kHz. It gets reflected to -9kHz so it will appear at 9kHz.

It gets more interesting at 135kHz. It's over nyquist by 111kHz. so it's reflected to 87kHz. That's over nyquist by 63kHz, so it's reflected to 39kHz. That's over nyquist by 15kHz so it gets reflected to 9kHz. But we already had a harmonic at 9kHz, so it just piles up on top of that, changing that harmonic's amplitude. In fact, if you did the math for the rest of the harmonics, they would all just add on top of an already existing one. It's even possible to craft a rigorous proof for that but I would honestly spend my time on literally anything else.

Here's the spectrum of that example. Note that the first harmonic has the highest amplitude, the third one wrapped to 3kHz has the second highest, the fifth one wrapped to 21kHz has the third highest amplitude and the seventh one wrapped to 9kHz is the lowest amplitude so it all checks out:
clip special_2.jpg

However, this example is a special case. In general, you get a lot of harmonics placed at different frequencies in a way they don't overlap with each other. The aliasing would spread the harmonics way more randomly due to the chaotic bouncing between 0Hz and the nyquist frequency. Perhaps this is the static you're left with in your clipped file.
 
Last edited:
Feb 28, 2024 at 11:30 AM Post #172 of 221
This thread moves further and further away from the original topic.

There's no way to guarantee that you have no aliasing present due to clipping if you clip the signal. Oversampling doesn't completely remove aliasing, it just reduces it. In practice, it can be reduced so much that it just disappears into the noise floor but x16 might not be enough for that, especially if you clip it by 10dB. Maybe you still have some of the aliasing left in the signal. It would be best to do a proper test without the clipping present, which I suspect would eliminate the spikes you see in the spectrum as they are most likely caused by aliasing, not by IMD.

There is considerable amount of aliasing below ~22kHz I still get when I use x8 oversampling with a ~17kHz tone clipped by 10dB. This definitely would not disappear to the noise floor of a DAC.
clip spectrum.jpg


The clipping generates an infinite amount of harmonics that gets wrapped around/bounced between the nyquist frequency and 0Hz. The clipping also only generates odd harmonics. So a 16kHz sine wave getting clipped would generate harmonics at 48kHz, 80kHz, 112kHz and so on... You could verify that yourself by clipping a 100Hz sine wave. The harmonics would be at 100Hz 300Hz 500Hz etc... The reason you do not see an infinite amount of harmonics is mainly because as the frequency gets higher, the amplitude gets lower and lower so all the higher harmonics eventually disappear into the noise floor. I think what is left in your case is not IMD but still some aliasing from the higher harmonics. Don't try to oversample a file to get rid of aliasing, make a new recording that has no clipping and thus, no aliasing as that test would not be as ambiguous as this one.

You could calculate where the harmonics are supposed to show up based on the fundamental's frequency and the sampling rate.
Let's look at a simple example. Take a 15kHz tone with a sampling rate of 48kHz. If you clip it, the harmonics present are the following: 15kHz, 45kHz, 75kHz, 105kHz, 135kHz...
The generated frequencies get reflected back and forth between 24kHz and 0Hz. In this case, the infinte number of harmonics only generate a few due to how they get wrapped around nyquist and 0Hz.

So the first harmonic (15k) is going to be at 15kHz.

The third (45k) harmonic is over 24kHz by 21kHz. Thus, it gets reflected back from 24kHz by 21kHz, making it appear at 3kHz (24k-21k).

It's starting to get more convoluted for the fifth (75kHz) harmonic. It is over 24kHz by 51kHz. So it would reflected back to "-27kHz" (24k-51k), however, it wraps around 0Hz as well so it actually gets reflected to 27kHz. This is still above nyquist by 3k so it gets reflected from nyquist by 3kHz, putting it at 21kHz (24k-3k).

105kHz is over nyquist by 81kHz. It gets reflected to -57kHz so it wraps back at 57kHz. 57kHz is over nyquist by 33kHz. It gets reflected to -9kHz so it will appear at 9kHz.

It gets more interesting at 135kHz. It's over nyquist by 111kHz. so it's reflected to 87kHz. That's over nyquist by 63kHz, so it's reflected to 39kHz. That's over nyquist by 15kHz so it gets reflected to 9kHz. But we already had a harmonic at 9kHz, so it just piles up on top of that, changing that harmonic's amplitude. In fact, if you did the math for the rest of the harmonics, they would all just add on top of an already existing one. It's even possible to craft a rigorous proof for that but I would honestly spend my time on literally anything else.

Here's the spectrum of that example. Note that the first harmonic has the highest amplitude, the third one wrapped to 3kHz has the second highest, the fifth one wrapped to 21kHz has the third highest amplitude and the seventh one wrapped to 9kHz is the lowest amplitude so it all checks out:
clip special_2.jpg

However, this example is a special case. In general, you get a lot of harmonics placed at different frequencies in a way they don't overlap with each other. The aliasing would spread the harmonics way more randomly due to the chaotic bouncing between 0Hz and the nyquist frequency. Perhaps this is the static you're left with in your clipped file.
That is a great and clear explanation, thank you! I will remember this.
 
Feb 28, 2024 at 5:19 PM Post #175 of 221
However, this example is a special case. In general, you get a lot of harmonics placed at different frequencies in a way they don't overlap with each other.
To that point, here's a spectrogram of a few different frequencies clipped by 3 dB (at 48k sampling rate). It starts with 3'000 Hz, where aliased harmonics overlap. Then the frequency of the tone is reduced, doubling the difference at each step (see the labels at the bottom) and the aliases are spread more and more. 2'833.3 Hz is the midpoint between 3'000 and 2'666.7. At 2'666.7 Hz the aliases overlap again.

If nothing else, it looks pretty :)

spectrogram_of_different_freqs_clipped.png
 
Last edited:
Mar 1, 2024 at 1:41 PM Post #176 of 221
Best answer of course would be to just use MQA and have completely 'deblurred'/perfect output
/s
 
Mar 1, 2024 at 4:26 PM Post #177 of 221
MQA has good synergy with Magic Pebbles.
 
Mar 2, 2024 at 10:04 AM Post #178 of 221
The HI-Player I developed has 23 kinds of pcm filters. Nearly half of them are -3db non-apodizing filters, and the rest are almost Apodizing filters. Apodizing filters can solve the artifacts caused by poor recordings. However, it also leads to a small loss of high frequency. The hearing sense will feel that the sound is far away, and some Apodizing filters will feel that the high frequency is slightly dark;

HI-Player is a dsd/pcm up-frequency software for mac platform, available from mac app store;

doc: https://github.com/sunhuino1/HI-Player
 
Mar 2, 2024 at 11:16 AM Post #179 of 221
The HI-Player I developed has 23 kinds of pcm filters. Nearly half of them are -3db non-apodizing filters, and the rest are almost Apodizing filters. Apodizing filters can solve the artifacts caused by poor recordings. However, it also leads to a small loss of high frequency. The hearing sense will feel that the sound is far away, and some Apodizing filters will feel that the high frequency is slightly dark;

HI-Player is a dsd/pcm up-frequency software for mac platform, available from mac app store;

doc: https://github.com/sunhuino1/HI-Player
Payed for and downloaded your app only to find out that it works for no more than 30 minutes at a time. Turns out that it is subscription based. I would have liked to know that before my purchase, not after. I have already uninstalled Hi-Player as I much prefer Audirvana Origin that comes with no secret costs. Pay once and be done with it.
 

Users who are viewing this thread

Back
Top