On all-pass filters, relative phase shifting and sound

A thread escalated into an off-topic discussion, so I decided to open a separate thread for this, to not hijack the OC thread.
The original is found here: Using "Voltage controlled capacitors" aka cool stuff using X5R caps - #4 by Synthlurker

The OP posted a photo of the displayed sound wave, to show something about the sound changed. I didn’t doubt the fact something changed about the sound, but I did challenge the proof provided.

I think there is no unique waveform to a particular perceived sound. For example, a square wave can be constructed from an infinite series of sine waves. One could phase shift 1 or more of those sine waves, and there would be no change in the perception of the sound. But adding up these sine waves again, will not produce a square waveform.
Filters will introduce a phase shift. All-pass filters will have a frequency dependent phase shift. In other words, and ideal all-pass filter produces the effect I described just now. The output off an all-pass filter will have a different waveform, but the same sound.
Again: I think is this true. I am not sure. @Farabide disagreed with me, which led to a wonderful opportunity to do some science :slight_smile:

I don’t have the right equipment on hand to test this, but I did mix some sine waves in audacity.
I created 5 sine waveforms, 110 Hz 0.9 dB, 330 Hz 0.3 dB, 550 Hz 0.18 dB and so on. Then I mixed those to get a very crude approximation of a square wave.
Then I phase shifted some of the sine waves by different amounts. Then I mixed again. Because the waves are too much out of phase, the peaks are too large, and the sound gets distorted. To solve this, I amplified both waves by a factor of 0.7.
Here is a screenshot of the two mixes before amplification:

Again, these waveforms are constructed by the same sine waves with the same amplitudes. The only change is some relative phase shift.

Here you can find the audio exports. I welcome you to import the audio into audacity or similar to inspect the waveforms.

I’d be very happy to hear anyone’s input on this, like any theory, or if I did anything wrong with my experiment, or if anyone replicates this with different results, or…

1 Like

I agree with you that the relative phase of the harmonics doesn’t affect the perceived sound. I first became aware of this a few years ago when I was experimenting with wavetables for my ‘ondes framboise’ digital ondes Martenot emulator. That uses Pure Data as the sound generation engine and I found that mixing either sine or cosine waves together made no difference to the sound I heard, regardless of their phases. I’ve also repeated your Audacity experiments with a slight modification (I started with lower amplitude sine waves so there was no possibility of clipping in the mixes) with exactly the same result.

The behaviour of a real-world filter is a different matter though, as it isn’t built with ‘ideal ‘ components and so is very likely to introduce some colouration into the sound which may not be directly associated with the phase shift. That certainly seems to be the case with my Yusynth Steiner-Parker filter in all-pass mode. It would be interesting to know if there’s any audible effect from an instrumentation-grade all-pass filter, and whether the ear can detect the filter frequency being swept, even if there is no audible difference between different static frequency settings.