ThinkDSP
This notebook contains
Copyright 2015 Allen Downey
Do we hear phase?
This notebook investigates what effect, if any, changes in phase have on our perception of sound.
I'll start with a simple waveform, a sawtooth, and move on to more natural sounds.
The following function plots the angle part of the spectrum.
At most frequencies, the amplitude is small and the angle is pretty much a random number. So if we plot all of the angles, it's a bit of a mess.
But if we select only the frequencies where the magnitude exceeds a threshold, we see that there is a structure in the angles. Each harmonic is offset from the previous one by a fraction of a radian.
The following function plots the amplitudes, angles, and waveform for a given spectrum.
So we can visualize the unmodified spectrum:
Now let's see what happens if we set all the angles to zero.
The amplitudes are unchanged, the angles are all zero, and the waveform looks very different. But the wave sounds pretty much the same.
You might notice that the volume is lower, but that's because of the way the wave gets normalized; that's not because of the changes in the phase structure.
If we multiply the complex components by , it has the effect of adding to the angles:
We can see the effect in the figure below. Again, the wave form is different, but it sounds pretty much the same.
Finally, let's see what happens if we set the angles to random values.
The effect on the waveform is profound, but the perceived sound is the same.
Oboe
Let's see what happens with more natural sounds. Here's recording of an oboe.
I'll select a segment where the pitch is constant.
Here's what the original looks like.
Here it is with all angles set to zero.
Changing the phase structure seems to create a "ringing" effect, where volume varies over time.
Here it is with the angles rotated by 1 radian.
Rotating the angles doesn't seem to cause ringing.
And here it is with randomized angles.
Randomizing the angles seems to cause some ringing, and adds a breathy quality to the sound.
Saxophone
Let's try the same thing with a segment from a recording of a saxophone.
The original:
Set angles to 0.
Rotate angles by 1 radian.
Randomize the angles.
Again, zeroing seems to create ringing, rotating has little effect, and randomizing adds a breathy quality.
One way the saxophone differs from the other sounds is that the fundamental component is not dominant. For sounds like that, I conjecture that the ear uses something like autocorrelation in addition to spectral analysis, and it's possible that this secondary mode of analysis is more sensitive to phase structure.
If so, the effect should be more profound when the fundamental is missing altogether.
Saxophone with missing fundamental
Let's run these steps one more time after filtering out the fundamental.
Zeroing
Rotating
Randomizing
In summary:
At least for sounds that have simple harmonic structure, it seems like we are mostly "phase blind"; that is, we don't hear changes in the phase structure, provided that the harmonic structure is unchanged.
A possible exception is sounds with low amplitude at the fundamental frequency. In that case we might use something autocorrelation-like to perceive pitch, and there are hints that this analysis might be more sensitive to the phase structure.