# Square Waves and Sound

Discussion in 'General Electronics Chat' started by Austin Clark, Sep 11, 2012.

1. ### Austin Clark Thread Starter Active Member

Dec 28, 2011
413
47
Ok, as many of you know, a square wave can be thought of as a wave with the sum of an infinite series of odd-order harmonics of the fundamental. However, my question is, if you were to grab these harmonics and change their phase, what would the wave potentially look like, and would it SOUND the same? This is something I've always been pretty curious about. A mathematical and/or physiological explanation would be awesome, if possible.

Also, what are the relative amplitudes of the nth harmonics?

Last edited: Sep 11, 2012
2. ### ramancini8 Active Member

Jul 18, 2012
473
145
Eliminate all harmonics and it sounds like a sine wave! Sound is pressure moving air, and different waveforms create different pressure waves. The process of creating the pressure waves in the speaker can act like an integrator.

3. ### Austin Clark Thread Starter Active Member

Dec 28, 2011
413
47
I was curious what would happen if the harmonics changed PHASE, not if they were eliminated. However, I really like your note about speakers acting as pressure "integrators". That is, it outputs the CHANGE in pressure, not the actual pressure, because of how the diagram is moved and how it induces current in the voice-coil. A sudden drop in pressure will jerk the diagram out, induce a spike, but once it's pulled out fully it can't move anymore and the induced voltage drops back to zero. It's an interesting insight, one in which ought to be mentioned more.

4. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
675
That sounds like a differentiator to me.

Here is what appears to be a pretty good treatise on your original topic.

Last edited: Sep 12, 2012
5. ### vk6zgo Active Member

Jul 21, 2012
677
85
(1)
The harmonics fall away in level,so there is not a lot to hear,anyway,after about the 5th harmonic.

(2)
Ears are not very sensitive to phase when both ears hear a mono signal,so I doubt you will hear any difference.
Possibly,if you introduce the normal signal to one ear,then the phase shifted one to the other,you may be able to hear it as "faux stereo".

(3)
Loudspeakers & headphones will have trouble with a square wave,& will introduce their own phase error.

Austin Clark likes this.
6. ### Harborbreeze New Member

Aug 31, 2012
4
1
Sound Waves are vibrations that travel through the air. While they travel in the electronic and digital worlds they are commonly shown on a two-dimensional graph with the y-axis defines the amplitude
(or loudness) of a signal and the x-axis defines the frequency (or pitch). The sinewave that is seen above is the most basic waveform in audio.

7. ### Wendy Moderator

Mar 24, 2008
21,437
2,958
I've always thought a square wave sounded like bag pipes myself. I prefer sine waves or triangle waves, they are smoother.

Sorry Sparkie.

Sparky49 likes this.
8. ### Audioguru Expert

Dec 20, 2007
10,667
1,190
Hee, hee.
Remember when there were home appliance stores that demo'd and sold stereos?
They ALWAYS had the speakers wired out-of-phase then they cranked up the bass to try to make up for the low frequency cancellation.

When I passed by I quickly wired one speaker in phase with the other. Then the sound was much better.

9. ### Austin Clark Thread Starter Active Member

Dec 28, 2011
413
47
It outputs the integral,I mean.

10. ### Austin Clark Thread Starter Active Member

Dec 28, 2011
413
47
Interesting responses, guys!
I have a comment to make, though.
The reason I suspected that you'd be able to notice a change in the sound is that, if the frequencies were "out of sync" then they wouldn't necessarily be creating constructive and destructive interference at the right times. As was mentioned earlier, if sound is fully out of phase, they completely cancel, which is a pretty big change.
I think I'll try and produce a sample to experiment with. If I can get it right, I'll share my findings! SCIENCE!

Oh, well, before I even finished typing this up, I read into Ron's link, and I found that my suspicions had merit.

I'll still try my own experiments, and I'll further explain my hypothesis at that time

11. ### Audioguru Expert

Dec 20, 2007
10,667
1,190
Due to the speed of sound, only low frequencies cancel when the speakers are out-of-phase.
Did you know that when a speaker is on a pedestal in front of you and the floor is reflective then some mid-range frequencies cancel due to the different distances (the reflection's distance is longer) affecting the phasing? Other frequencies add making a peak.

Austin Clark likes this.
12. ### Audioguru Expert

Dec 20, 2007
10,667
1,190
That is why I hate the BUZZ of bagpipes.
My hearing is still good.

Many deaf people think bagpipes sound like the sinewave from a flute because they can't hear the buzzing harmonics.

EDIT: Like Acid Rock noise. The listeners and the "musicians" are deaf to the huge amounts of "fuzz" (distortion).
EDIT again: My favourite radio station suddenly changed from POP music to RAP crap!
Rap is not music. It is a ***** guy with a ***** accent talking while the beat goes on.

Last edited: Sep 13, 2012
atferrari and Sparky49 like this.
13. ### Austin Clark Thread Starter Active Member

Dec 28, 2011
413
47
I'm going to assume that only lower frequencies are canceled out because their WAVELENGTH is longer, meaning it's really the speed AND FREQUENCY of sound that gives it this property, not just the speed. Longer wavelengths have bigger areas of cancellation and areas of combination. Eventually they get so small that our ears won't notice it. Is this assumption correct, or is there some other reason?

14. ### Audioguru Expert

Dec 20, 2007
10,667
1,190
Low frequencies cancel when the speakers are out of phase. but your ears are never out-of-phase.

High frequencies with different path lengths cancel some frequencies but add other frequencies when they are in-phase but are separated.
Your ears do the same so it sounds normal.

15. ### PaulEE Member

Dec 23, 2011
423
32
To the O.P (hello to everyone else as well!):

Suppose you did write out, by hand, an expression with the first five harmonics. It'd look like a rough square wave with ringing - I do believe.

Now, suppose you take each harmonic and, as you said, introduce variability in the phases. What the sum sounds like will be different and directly affected by which phases change, by how much, and in what direction.

If you tip-toe through frequency domain and time domain analysis, you can calculate exactly what the wave would look like - or, you could even use "Audacity", a free and open-source audio editing program, to generate the waves you speak of as a sum of separate tracks. Just add a brief delay before laying more waveforms out in parallel to the others and you've got your phase delay.

Do update us!

Austin Clark likes this.
16. ### Ron H AAC Fanatic!

Apr 14, 2005
7,049
675
Here's a little simulation that allows you to play with phase shifting the harmonics, saving the waves to .WAV files, and trying to hear differences when you play them back. The left side is the reference square wave. On the right side, you can scramble the phase shift or delay of each harmonic as much as you want.
I couldn't hear any differences with the few examples that I tried, but it might become noticeable if you had music, instead of a constant frequency.

I did it monaurally, but I suppose you could record them as two channels and listen to them simultaneously with stereo headphones.
You might have to create a folder to store your WAV files.

File size:
68 KB
Views:
28
• ###### Square wave with harmonic phase shifting to WAV file.asc
File size:
2.2 KB
Views:
28
Austin Clark likes this.
17. ### Sparky49 Well-Known Member

Jul 16, 2011
836
422
You guys are Heathens.

18. ### #12 Expert

Nov 30, 2010
18,093
9,683
True. Humans are not able to detect absolute phase. There must be a reference sound to interpret phase from. This is why it doesn't matter where a Leslie brand speaker stops. About 2 seconds after it stops, people can't tell where in the rotation it stopped. I suspect this also accounts for me failing to interpret the first sound when people speak to me in a language or a strong accent other than what I am expecting. In familiar ground, the brain supplies the first sound after interpreting the rest of the word. When I don't know the word that was spoken first, I never recover the information about the starting sound.

19. ### Audioguru Expert

Dec 20, 2007
10,667
1,190
I am getting used to strong British accents. When they say "wotah" then I know the word is water.

But I am not getting used to my local TV station hiding the mic of the news person in thick clothing then additionally electronically cutting away all high frequencies and most mid frequencies. But commercials have normal sounds.

20. ### russ_hensel Distinguished Member

Jan 11, 2009
825
57
Back to the original question: Human hearing is generally considered to be insensitive to phase so phase distortion is usually not audible.

aside: "absolute phase" is a term that means close to absolutely nothing, there is really no 0 point reference ( the time of the big bang? ).