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

Why can we hear phase distortion?

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
I did a small experiment with a little python code. I generated two pairs of signals, for each of them the first being a square signal, and the second signal with the same absolute frequency spectrum but with different phase. I did the first one in a non linear way, by adding a phase delay of pi/2 for every other harmonics. I did the second pair in a linear way, by adding a delay of pi/2*(i mod 4), with i being the order of the harmonics.

The result is that non-linear phase distortion is clearly audible for a square wave, while linear phase delay is absolutely not audible. Why is it so? By what mechanism could human ear hear non-linear phase shift but not linear phase shift?

Here are a graph for both of them, each of them showing both a regular square wave and a phase delayed square wave.

Here are the respective audio files for both of them : audible phase, inaudible phase.
 

Attachments

  • phase_audible.png
    phase_audible.png
    25.7 KB · Views: 78
  • phase_inaudible.png
    phase_inaudible.png
    24.5 KB · Views: 79

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,235
Those both have audible “features”, seems to me - beat frequencies.

Post your script please.

May also want to take a look at the signals in the frequency domain (spectrogram).
 

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,661
Likes
5,821
Location
US East
May also want to take a look at the signals in the frequency domain (spectrogram).
@dc655321 Good idea!

Here are the spectrograms using Audacity (using default parameters, but with grayscale colormap to better show the magnitude differences).

The "phase audible" (top plot) does show different spectral compositions between the shifted and unshifted sections. The "phase inaudible" doesn't.

spectrograms.png
 
OP
J

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
@dc655321 Good idea!

Here are the spectrograms using Audacity (using default parameters, but with grayscale colormap to better show the magnitude differences).

The "phase audible" (top plot) does show different spectral compositions between the shifted and unshifted sections. The "phase inaudible" doesn't.

View attachment 212515
Does your plot only show the magnitude and not the argument (phase) of the Fourier Transform? If so, that's very strange, because they should be equal by design. I will send the script soon.
Those both have audible “features”, seems to me - beat frequencies.

Post your script please.

May also want to take a look at the signals in the frequency domain (spectrogram).
Those "beats" are only discontinuities when switching each seconds between the square wave and the phase shifted version, not an inherent part of the signal I want to compare.
 
OP
J

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
There must have been an error in my original script. Here is a corrected version. Here are the corresponding corrected audio files (and 16-bit instead of 32-bit because 32-bit messed with my phone :facepalm:): audible phase shift (or non-linear), inaudible phase shift (or linear). We can still hear the difference in the non-linear phase shift, yet this time, the spectrum is strictly identical (in its magnitude, the phase is obviously different).

EDIT: I've updated the script to show the Fourier transform. Here are both spectra compared, and their difference, to show that the are really the same.
Spectra_compared.png
Difference between both spectra.png
 
Last edited:

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,235
There must have been an error in my original script. Here is a corrected version. Here are the corresponding corrected audio files (and 16-bit instead of 32-bit because 32-bit messed with my phone :facepalm:): audible phase shift (or non-linear), inaudible phase shift (or linear). We can still hear the difference in the non-linear phase shift, yet this time, the spectrum is strictly identical (in its magnitude, the phase is obviously different).

Am I missing something?
I'm not sure what the mystery is - I think you simply produced two different waveforms.
Something like (ignoring harmonic scaling):

sin(nwt + (n mod 4)pi/2) = sin(wt + pi/2) + sin(3wt + 3pi/2) + sin(5wt + pi/2) + sin(7wt + 3pi/2) + ...

vs

sin(nwt + kpi/2) = sin(wt + pi/2) + sin(3wt) + sin(5wt + pi/2) + sin(7wt) + ...


Screen Shot 2022-06-13 at 10.42.39 AM.png
 
OP
J

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
Am I missing something?
I'm not sure what the mystery is - I think you simply produced two different waveforms.
Something like (ignoring harmonic scaling):

sin(nwt + (n mod 4)pi/2) = sin(wt + pi/2) + sin(3wt + 3pi/2) + sin(5wt + pi/2) + sin(7wt + 3pi/2) + ...

vs

sin(nwt + kpi/2) = sin(wt + pi/2) + sin(3wt) + sin(5wt + pi/2) + sin(7wt) + ...


View attachment 212562

I agree I've produced two differents wave forms. My question is why I can hear a difference, while I can't hear any difference in the second example where there cleary are two different waveforms too.

For recap: we have three different wave form : waveform A, a square wave, waveform B, a square wave with phase shift (n mod 2)pi/2, and waveform C, a square wave with phase shift (n mod 4)pi/2. Waveform A and C sound exactly the same. Waveform B sounds different. They all have the same spectrum magnitude (by definition).

The first audio (audible phase), plays alternatively waveform A and B. The second one (inaudible phase) plays alternativley waveform A and C.

The question is: as we apparently can detect nonlinear phase shift, but we can't detect hear linear phase shift, why is it so?
 

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,235
My question is why I can hear a difference, while I can't hear any difference in the second example where there cleary are two different waveforms too.

Bad ears or gear? :D

Waveform A and C sound exactly the same.

They don't
The first audio (audible phase), plays alternatively waveform A and B. The second one (inaudible phase) plays alternativley waveform A and C.

Look at the amplitude alone in the A,C combination.

Screen Shot 2022-06-13 at 11.20.04 AM.png

They all have the same spectrum magnitude (by definition).

But very different phase spectra.
F(w) = A(w)* exp(j*phi(w))

Two knobs in that expression...
 
OP
J

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
Look at the amplitude alone in the A,C combination.
The amplitude doesn't matter for quantifying volume, it's the RMS value that does matter, and both are strictly equal.

Bad ears or gear? :D



They don't
Are you sure you listened to the right file? This is this one. It's not my ear as I've tested it on ten different people. I've got no reason to suspect my gear (HD800S and RME UFX II). Even if only 0.1% of the population could detect the difference, your explanation still gives no clue on why all people hear the difference between A and B (reminder), but only you seem to hear the difference between A and C (here again).

But very different phase spectra.
Which is exactly what I asked, and which makes me ask my question again: why do we (maybe not you, but at least all of my surrounding) sometimes hear two vastly different phase spectra (A and C) as exactly the same sound, but sometimes (A and B) we all can clearly hear the difference.

(again, the bad gear doesn't explain why A and B are clearly different but A and C not, the bad ear argument doesn't explain it any better)
 

NTK

Major Contributor
Forum Donor
Joined
Aug 11, 2019
Messages
2,661
Likes
5,821
Location
US East
"Phase distortions" can indeed be audible. Please refer to this article in Audioholics.

However, the conditions under which it is audible don't usually happen in typical sound reproduction systems. The test signals you used aren't too far from those used by Lipshitz (see article), which demonstrated the audibility of phase. Quoting Dr Toole:
It turns out that, within very generous tolerances, humans are insensitive to phase shifts. Under carefully contrived circumstances, special signals auditioned in anechoic conditions, or through headphones, people have heard slight differences. However, even these limited results have failed to provide clear evidence of a 'preference' for a lack of phase shift. When auditioned in real rooms, these differences disappear...

From what I've gathered (which I believe is why you started this thread), audibility of phase is related to the smoothness and monotonicity of the phase response vs frequency curve. The more jagged this curve is, the more audible the phase.

In your example, the phase vs frequency curve for the "linear shift" case is a sloped straight line when we unwrap the phase: π/2, π, 3π/2, 0, π/2, π, 3π/2, 0, ...

In the case of the "non-linear shift", the phase of the harmonics are: π/2, 0, π/2, 0, ... , and the phase vs frequency curve is an asymmetric triangular wave when we linearly interpolate the points.

I experimented with adjusting the phase of the harmonics to: α*π, 0, α*π, 0, ...

With α close to 1 (linear shift), phase is not audible. Phase becomes progressively more audible as I decrease α, most audible when α is 1/2 (your test case), and then becomes less audible as α decreases further. This sort of matched my hypothesis.

Dr Toole noted in his 1986 paper that there appeared to be a correlation between the smoothness of the phase vs frequency curve and speaker sound quality (please see this post).
 

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,235
The amplitude doesn't matter for quantifying volume, it's the RMS value that does matter, and both are strictly equal.


I did check that the rms is equivalent between waveforms in Python.
Maybe it's Audacity doing something odd, but I see this for the square wave portion (note amplitude meter):
Screen Shot 2022-06-14 at 9.37.10 AM.png
and this for the non-linear phase portion:
Screen Shot 2022-06-14 at 9.34.42 AM.png

Similarly for the "linear" phase distortion signals.
I cannot seem to get past a loudness difference, whether that is actual or prompted.
Not sure what is going on here - I'm fairly sure I had the latest versions of your scripts and WAVs...

Maybe a crossfade between signals would help illustrate the effect(s) without the (for me) distracting transitions?
c.f. here.

Thanks for posting the spectral differences plot.
I had done something similar using ratios of amplitude spectra from your script:
Figure_2.png

"Phase distortions" can indeed be audible. Please refer to this article in Audioholics.
However, the conditions under which it is audible don't usually happen in typical sound reproduction systems.

Thanks for posting that article. Had not read that one before. Good stuff!
 
OP
J

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
Maybe it's Audacity doing something odd, but I see this for the square wave portio n (note amplitude meter):
View attachment 212724
and this for the non-linear phase portion:
View attachment 212725
Audacity seem to show the maximum absoute peak value instead of the RMS value. I think it does so to help detect saturation, and this meter should not be used to estimate subjective volume.

Maybe a crossfade between signals would help illustrate the effect(s) without the (for me) distracting transitions?
I did think about that, but the problem with cross fade is that we are playing with phase here, which will lead to constructive and distructive interference depending on the frequency. The fading portion will thus have a different frequency magnitude spectrum (the magnitude of the sum of complex numbers is not the sum of the magnitudes).

I could instead add a silence inbetween, but it will inform you unconsciously that we'll have switch between A and C anyway.

By the way, do you still hear a difference between A and C? And if you do, is it as noticeable as the difference between A and B? NTK's citation seems to indicate the opposite.

From what I've gathered (which I believe is why you started this thread), audibility of phase is related to the smoothness and monotonicity of the phase response vs frequency curve. The more jagged this curve is, the more audible the phase.
Do you have any explanation on what physical mechanism in the ear could explane such a strange behavior?
 
Last edited:

jlo

Active Member
Joined
Aug 3, 2018
Messages
100
Likes
177
Do you have any explanation on what physical mechanism in the ear could explane such a strange behavior?
Because group delay is simply the derivative of phase, a jagged phase gives higher group delay. And group delay distortion is what the ear perceives.
 
OP
J

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
Because group delay is simply the derivative of phase, a jagged phase gives higher group delay. And group delay distortion is what the ear perceives.
I feel like you just told me ear can detect non linear phase distortion because non linear phase distortion is what the ear perceives. Why is it so?
 

dc655321

Major Contributor
Joined
Mar 4, 2018
Messages
1,597
Likes
2,235
Audacity seem to show the maximum absoute peak value instead of the RMS value. I think it does so to help detect saturation, and this meter should not be used to estimate subjective volume.

Do you think crest-factor may play a role in differentiation?
I would have naively thought CF to be more important for perceptual volume matching.

I did think about that, but the problem with cross fade is that we are playing with phase here, which will lead to constructive and distructive interference depending on the frequency. The fading portion will thus have a different frequency magnitude spectrum (the magnitude of the sum of complex numbers is not the sum of the magnitudes).

I see what you mean. But I still think xfade would help, at least for me personally.
Maybe the simplest thing is just separate tracks for AB or ABX'ing. Easy enough to do.
 
OP
J

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
Do you think crest-factor may play a role in differentiation?
I would have naively thought CF to be more important for perceptual volume matching.
I guess the real important thing that ears have to measure is the acoustic power emitted by the source, and that power depend on the RMS value. I guess there is no real reason to use the peak to peak value to determine any volume related quantity. CF would inform you in a very undirect way of the high frequency content and the phase content, but in a pretty unusable way. The peak to peak value seem only useful to detect saturation.
I see what you mean. But I still think xfade would help, at least for me personally.
Maybe the simplest thing is just separate tracks for AB or ABX'ing. Easy enough to do.
I'll let you decide but I don't think it works any better: have a listen.
 

jlo

Active Member
Joined
Aug 3, 2018
Messages
100
Likes
177
I feel like you just told me ear can detect non linear phase distortion because non linear phase distortion is what the ear perceives. Why is it so?
Monoral phase distortion is related to the inner ear structure (basilar membrane and cells) and function.
Differential phase matters only for frequencies that are near one from another (within an ERB or bark).
This means that phase distortion is only audible when the phase slope is high or in other words, when group delay is high.
When you read papers about phase audibility in AES, JASA, IEEE,... it is allways related to group delay.
 
Last edited:
OP
J

jdav

Member
Joined
Oct 28, 2021
Messages
48
Likes
14
Monoral phase distortion is related to the inner ear structure (basilar membrane and cells) and function.
Differential phase matters only for frequencies that are near one from another (within an ERB).
This means that phase distortion is only audible when the phase slope is high or in other words, when group delay is high.
When you read papers about phase audibility in AES, JASA, IEEE,... it is allways related to group delay.
Very interesting, thank you!
 
Top Bottom