• 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!

The effects of lossy encoding on phase and impulse response

Fluffy

Addicted to Fun and Learning
Joined
Sep 14, 2019
Messages
856
Likes
1,423
Since many lossy encoding algorithms (MP3 and AAC for example) involve a sharp low pass filter at around 20khz, does this has any effect on phase and impulse response? I don't really understand the effect of low pass filters on ringing phase shifts, but I suppose that a really sharp one would have some extreme effect.

(I request in advance to not make this thread a discussion about pros and cons of lossy formats, it's purely a technical question about this specific topic. Thanks)
 

ElNino

Addicted to Fun and Learning
Joined
Sep 26, 2019
Messages
557
Likes
722
It doesn't affect phase response -- both MP3 and AAC use linear phase filterbanks. However, it does affect impulse response. MP3 and AAC make different tradeoffs in that respect, by design (pre-ringing in AAC tends to be louder than MP3 but shorter in duration).
 
OP
Fluffy

Fluffy

Addicted to Fun and Learning
Joined
Sep 14, 2019
Messages
856
Likes
1,423
It doesn't affect phase response -- both MP3 and AAC use linear phase filterbanks. However, it does affect impulse response. MP3 and AAC make different tradeoffs in that respect, by design (pre-ringing in AAC tends to be louder than MP3 but shorter in duration).
How do they achieve those different pre-ringing results?
 

amirm

Founder/Admin
Staff Member
CFO (Chief Fun Officer)
Joined
Feb 13, 2016
Messages
44,368
Likes
234,386
Location
Seattle Area
How do they achieve those different pre-ringing results?
Shorter windows (frames of audio) are used for transients and longer ones for more steady-state signals. Shorter windows are less efficient but better preserve transient response (i.e. pre-echo).
 

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,235
What would be the difference in impulse response between an MP3 encoded file and a lossless file? Is there a measurement of what MP3 compression does to impulse response?

Not sure your questions make sense (to me) - files don't have an impulse response.
 

RayDunzl

Grand Contributor
Central Scrutinizer
Joined
Mar 9, 2016
Messages
13,200
Likes
16,981
Location
Riverview FL
What would be the difference in impulse response between an MP3 encoded file and a lossless file? Is there a measurement of what MP3 compression does to impulse response?

Experiment:

Five seconds of silence, with one sample set at 2.5 seconds. "Lossless" on top, encoded with MP3/saved as a file/imported on the bottom, using Audacity.

Note: The MP3 impulse came 47ms later in the converted file.

1572994758424.png
 
Last edited:
OP
Fluffy

Fluffy

Addicted to Fun and Learning
Joined
Sep 14, 2019
Messages
856
Likes
1,423
@RayDunzl
I repeated the experiment and got the same result in Audacity. Note that this is how it shows in the spectrogram view (zoomed in to about 15k-22k):
1.png


The bottom one is the mp3 file, and it applies a sharp filter at 20khz.

When applying the same sharp filter (with the Equalization effect) without exporting as mp3, I get this impulse:

2.png


Which is pretty much identical to the mp3. My conclusion is that it's the brick-wall low pass filter that causes this to show like that.

Curiously, I took the same WAV and MP3 file and looked at them in Adobe Audition:

WAV:
3.png


MP3:
4.png


In audition it automatically extrapolates the analog waveform in relation to the sample rate (ahile audacity is basically just doing connect-the-dots) so it's displaying supposed ringing at both times. But it's clear that in the WAV file the pre-ringing exists only as the program interpolates it out of the samples, while in the MP3 there are samples that actually deviates from the line where they aren't supposed to.

Not sure what to make of all of this…
 

RayDunzl

Grand Contributor
Central Scrutinizer
Joined
Mar 9, 2016
Messages
13,200
Likes
16,981
Location
Riverview FL
My conclusion is that it's the brick-wall low pass filter that causes this to show like that.

Audacity one sample impulse with 20kHz low pass -48dB/octave (no mp3 no export)

1572997549730.png
 
Last edited:

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,656
Likes
5,819
Location
US East
...
Not sure what to make of all of this…
The waveform of the WAV file you showed with Audition is reconstructed by sinc filtering (ideal linear phase brickwall) to Nyquist (22.05 kHz). You can see that (for the WAV file) the zero-crossing points all happen exactly at the sampling points (i.e. half a wave for every sampling period), which means the frequency of the sinc waveform is equal to Nyquist.

From the spectrogram, the low pass cutoff for the MP3 file was 20 kHz. It's sinc filtered to a lower frequency than the WAV file.

Audacity one sample impulse with 20kHz low pass -48dB/octave (no mp3 no export)

View attachment 37967
The low pass filter used is not the sinc filter. Since you said it is -48 dB/octave, it would mostly likely be an 8th order analog filter implemented digitally.
 

RayDunzl

Grand Contributor
Central Scrutinizer
Joined
Mar 9, 2016
Messages
13,200
Likes
16,981
Location
Riverview FL
The low pass filter used is not the sinc filter. Since you said it is -48 dB/octave, it would mostly likely be an 8th order analog filter implemented digitally.

Found a sinc plugin.

1573006005502.png
 
OP
Fluffy

Fluffy

Addicted to Fun and Learning
Joined
Sep 14, 2019
Messages
856
Likes
1,423
So from what I understand, regarding impulse response, lossy compression is basically just limited to what frequency does the brick-wall filter cut off at. The ringing artifacts exists anyway when applying a normal linear phase filter at the nyquist frequency, but the lower cut-off shifts them down in frequency. At what point do these artifacts become audible? Surely most people can't hear ringing at 20khz (I certainly can't).
 

RayDunzl

Grand Contributor
Central Scrutinizer
Joined
Mar 9, 2016
Messages
13,200
Likes
16,981
Location
Riverview FL
@RayDunzl what does MP3 do to a real transient like your coffee spoons recording?

Don't know.

Don't have the files, would have to repeat th experiment.
 
Top Bottom