Perfect square wave sounds

Started by ThinkingMan, August 06, 2019, 11:21:22 AM

Previous topic - Next topic

ThinkingMan

What would perfect square waves with four equal sides and angles (not irregular rectangular waves) sound like? For example, the pictures below show the waveforms from Zvex Fuzz Factory through a Tektronix 2445 o'scope. This is so far the closest representation and example of perfect square waves. Are there any sound examples of what perfect square waves sound like other than what the video shows below? Maybe perfect square waves that are produced from silicon fuzz pedals?








Anyway, we just hear the noise coming from the o'scope. Not from the guitar and fuzzpedal themselves. I wonder how would perfect square waves sound like. Anyone have ever achieved perfect square waves on o'scope?

anotherjim

It sounds the same whatever the amplitude, so "square" is only a handy name that people use, not a definite description. What you actually have is a "rectangular" or "pulse" waveform with 50% duty (high cycle time eqUal to the low cycle time).

The important shape that makes it square is that it has those equal high and low periods together with the vertical rise and fall "sides" and level top and bottom of a rectangular wave. These actually can never happen perfectly in the real world. There is always some slope to the sides even if it can only be measured in nanoseconds and the amplitude limits will have some overshoot, ringing and ripple even if it's hard to see on the 'scope.


ThinkingMan

#2
Quote from: anotherjim on August 06, 2019, 12:18:50 PM
It sounds the same whatever the amplitude, so "square" is only a handy name that people use, not a definite description. What you actually have is a "rectangular" or "pulse" waveform with 50% duty (high cycle time eqUal to the low cycle time).

The important shape that makes it square is that it has those equal high and low periods together with the vertical rise and fall "sides" and level top and bottom of a rectangular wave. These actually can never happen perfectly in the real world. There is always some slope to the sides even if it can only be measured in nanoseconds and the amplitude limits will have some overshoot, ringing and ripple even if it's hard to see on the 'scope.

Thanks for responding. So even what the picture shows below are not perfect square waves?




This is the link to the video https://youtu.be/wwiQ8vM5kOY

Sorry but what do you mean it sounds the same regardless of amplitude, because different fuzzboxes seem to have different qualities to their tone. Some smooth, some too buzzy, etc. In general, fuzzboxes with germanium transistors sound more smooth and have rounder square waves compared to fuzzboxes with silicon transistors which have sharper square waves thus producing almost "perfect" square waves. But I know there are many exceptions, such as Lovepedal silicon fuzzboxes. I wanna know if there are silicon fuzzboxes that can produced the same "perfect" square waves like what those pics show through an o'scope such as Tektronix 2445.

ThinkingMan

One of other reasons why I'm asking is according to this video https://youtu.be/C1GppYLkoT4 , not all fuzzboxes actually produced square waves.

PRR

#4
Do you want a wave to look at?

Or to listen to?

A Square has all {EDIT: all odd} harmonics to infinity. Or at least as high as your 'scope/ear can hear.

This is very nasty. (Some people like that.)

Distortion boxes usually tone-shape both the input and output in various ways to modify the "nasty".

I don't think there is a universal recipe.
  • SUPPORTER

ThinkingMan

Quote from: PRR on August 06, 2019, 12:49:48 PM
Do you want a wave to look at?

Or to listen to?

A Square has all harmonics to infinity. Or at least as high as your 'scope/ear can hear.

This is very nasty. (Some people like that.)

Distortion boxes usually tone-shape both the input and output in various ways to modify the "nasty".

I don't think there is a universal recipe.

Both. I wanna look at the wave and listen to the sound that it produced. So, a 100% perfect square wave is only hypothetical then. But from those pictures, at least nearly (yes nearly but not 100%) "perfect" square waves can be achieved and can be seen through o'scopes. But the video from where the pictures are from doesn't display the sound of the fuzzbox played together with a geetar.

ElectricDruid

Check out the wikipedia article. It has a couple of sound samples, but the best one (just a 1KHz square wave) is too high to really hear the character of it.

https://en.wikipedia.org/wiki/Square_wave

I had a hunt around on YouTube for a good example, but they're not easy to find. Several are plagued by aliasing, which is not a good sign, and one or two didn't have their facts straight.

Also, I have to clarify what PRR said. A square wave doesn't have *all* harmonics to infinity. It has all *odd* harmonics to infinity (1,3,5,7,9 etc). That's what makes it square - most general "pulse" waves where the high/low ratio is not 50/50% have some even harmonic components too, but when you hit exactly 50/50, those harmonics drop out and you're left with only the odd ones.

Find a friend with a synthesiser and get them to play you a simple square wave with no frills. Pretty much any synth can do it - they're called "basic waveforms" for a reason, and they've become part of synth history that every synth has to cover.

Josh?

Quote from: ThinkingMan on August 06, 2019, 12:41:25 PM
Sorry but what do you mean it sounds the same regardless of amplitude

We hear the amplitude and frequency of a sound wave independently of each other. We hear amplitude (how wide or "tall" the wave swings) as the volume of a sound wave, and we hear the frequency (how fast the wave swings from a peak, down, and back again) as pitch, with higher frequencies sounding higher in pitch. (On a side note, for light waves, we see amplitude as brightness and frequency as color, and this is where white, pink, blue, and other "colors" of noise get their names.)

You can see what I'm talking about visually with a sine wave by plugging this really basic equation into desmos, or your graphing calculator of choice:

y=a * sin(f * x)

where a is amplitude and f is frequency. You can add sliders for a and f to see what happens when they change. (Don't worry about negative numbers, though. They just change the phase of the wave by 180 degrees, which doesn't change the sound of a wave if it's a single sine wave.)

So, to answer your original question, a "perfectly square" wave, with frequency equal to amplitude, will sound close enough to the square wave in this (strangely 15 minute long) video, but at low pitches (frequency is low, meaning the horizontal parts of the wave are longer, so the vertical parts will have to be longer, giving a larger amplitude) it will be really loud, and at high pitches it will be the opposite, really quiet:



So, moral of the story: be really thankful frequency and amplitude are independent of each other.

anotherjim

Use an audio file editor - even the free Audacity and play with the waveform generation tools. A computer can produce a near-perfect square, but it won't be by the time it comes out the speaker, because the highest harmonics which make it look square won't make it to the ear.

In fuzz box design, there are circuits that produce symmetrical clip distortion and they are placed in the general area of square wave generators because the distortion artefacts are mainly odd-order harmonics and square waves are made of odd order frequencies. They may appear anything but square on the oscilloscope. The sound can have a hollow-reedy quality.
Some circuits produce an asymmetrical wave with even-order harmonics. This puts it in the Sawtooth wave class. This can sound thick and brassy.

All of these geometric wave shapes can be distorted visually by shifting the relative phase of the harmonics. They can then look very different on the 'scope - but still sound exactly the same. There is still the same mix of frequencies so why would it sound different? Our hearing cannot detect any effect from fixed phase shifts.



mac

555 Timer
or
https://www.electronics-tutorials.ws/opamp/op-amp-multivibrator.html

Some free software for win, mac or linux can generate square waves.

mac
mac@mac-pc:~$ sudo apt-get install ECC83 EL84

mac

QuoteUse an audio file editor - even the free Audacity...

GRUB2 init tune is pretty "nasty" too  :icon_mrgreen:

mac
mac@mac-pc:~$ sudo apt-get install ECC83 EL84

Josh?

Quote from: mac on August 06, 2019, 04:33:44 PM
Some free software for win, mac or linux can generate square waves.

mac

The learning curve for this one is kinda big, but it's basically like having an infinite modular synth made out of code so that you can better understand and control what's going on inside all your modules:

https://supercollider.github.io/

A bit off topic from just square waves, but it's also free and think it's fun ;D

ThinkingMan

#12
Quote from: ElectricDruid on August 06, 2019, 01:45:06 PM
Check out the wikipedia article. It has a couple of sound samples, but the best one (just a 1KHz square wave) is too high to really hear the character of it.

https://en.wikipedia.org/wiki/Square_wave

I had a hunt around on YouTube for a good example, but they're not easy to find. Several are plagued by aliasing, which is not a good sign, and one or two didn't have their facts straight.

Also, I have to clarify what PRR said. A square wave doesn't have *all* harmonics to infinity. It has all *odd* harmonics to infinity (1,3,5,7,9 etc). That's what makes it square - most general "pulse" waves where the high/low ratio is not 50/50% have some even harmonic components too, but when you hit exactly 50/50, those harmonics drop out and you're left with only the odd ones.

Find a friend with a synthesiser and get them to play you a simple square wave with no frills. Pretty much any synth can do it - they're called "basic waveforms" for a reason, and they've become part of synth history that every synth has to cover.

Thank you so the hypothetical perfect square wave I assume if we can hear it like if we try to listen to an ultrasound by bone conduction, it would be mostly noises. Correct me if I'm wrong. Yeah, a really high pitch sine wave and square wave almost sound the same. The difference tend to show only in the lower range frequency.

ThinkingMan

Quote from: Josh? on August 06, 2019, 02:27:05 PM
Quote from: ThinkingMan on August 06, 2019, 12:41:25 PM
Sorry but what do you mean it sounds the same regardless of amplitude

We hear the amplitude and frequency of a sound wave independently of each other. We hear amplitude (how wide or "tall" the wave swings) as the volume of a sound wave, and we hear the frequency (how fast the wave swings from a peak, down, and back again) as pitch, with higher frequencies sounding higher in pitch. (On a side note, for light waves, we see amplitude as brightness and frequency as color, and this is where white, pink, blue, and other "colors" of noise get their names.)

You can see what I'm talking about visually with a sine wave by plugging this really basic equation into desmos, or your graphing calculator of choice:

y=a * sin(f * x)

where a is amplitude and f is frequency. You can add sliders for a and f to see what happens when they change. (Don't worry about negative numbers, though. They just change the phase of the wave by 180 degrees, which doesn't change the sound of a wave if it's a single sine wave.)

So, to answer your original question, a "perfectly square" wave, with frequency equal to amplitude, will sound close enough to the square wave in this (strangely 15 minute long) video, but at low pitches (frequency is low, meaning the horizontal parts of the wave are longer, so the vertical parts will have to be longer, giving a larger amplitude) it will be really loud, and at high pitches it will be the opposite, really quiet:



So, moral of the story: be really thankful frequency and amplitude are independent of each other.

I hope I can see a nearly perfect square wave like what the pictures I uploaded show on the o'scope and listen what it would sound like if someone plug his or her guitar directly through the fuzzbox and o'scope and play it.

Rob Strand

FYI, one thing that might come as a surprise is if you create square-waves in a sound editor you actually create a waveform that has some spectral folding which sounds nastier than sampling a square-wave.  You will find info on band-limited square-waves on the web.

Go here, for some sound samples,

https://www.nayuki.io/page/band-limited-square-waves

It's kind of obscure but it's interesting nonetheless as it's something only DSP audio geeks think about.  The band-limited thing actually applies to any waveform.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

antonis

Quote from: ThinkingMan on August 06, 2019, 11:21:22 AM
Are there any sound examples of what perfect square waves sound like other than what the video shows below?
.....................
Anyway, we just hear the noise coming from the o'scope. Not from the guitar and fuzzpedal themselves. I wonder how would perfect square waves sound like.

Plug into your amp any general purpose op-amp wired as asymmetrical inverting Smitt trigger and listen.. :icon_wink:

https://www.electronics-tutorial.net/analog-integrated-circuits/schmitt-trigger/asymmetrical-inverting-schmitt-trigger/
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

ThinkingMan

Too bad I don't have any amp with me right now, just an acoustic guitar...  :(

I'm still searching for any videos on Youtube to see any fuzzbox that is connected to an o'scope and then producing "perfect" square wave. And I only found this https://www.youtube.com/watch?v=v-gxPzpKjOQ. He demonstrated the fuzz sound at 0:35 and many of the resulting waveforms on the Tektronix 465B are almost perfectly square. In comparison with the earlier video https://www.youtube.com/watch?v=wwiQ8vM5kOY especially at 0:45, the ZVex Fuzz Factory also produced almost perfect square waves. Square wave tones from synths and softwares sound different from square wave sounds from fuzzboxes that are connected to an amplifier and then played with a guitar.

amptramp

Square waves should sound like pressure-modulated woodwind instruments with a reed like the clarinet.  Velocity-modulated woodwinds with no reed (like a flute) sound like a sine wave.  There are some variances but that is the gist of it.  Sawtooth waves sound like brass instruments.

The Thomas organ and several others used square wave generators with various levels of filtering to get approximations of instrument sounds and the least filtering was used with the clarinet stop.  The instrument voices were really quite poor in fidelity to the original instrument because secondary effects tend to give an instrument a particular flavour but they were good enough for a lot of customers.

ElectricDruid

Quote from: ThinkingMan on August 07, 2019, 11:50:05 AM
Square wave tones from synths and softwares sound different from square wave sounds from fuzzboxes that are connected to an amplifier and then played with a guitar.

Yeah, I can think of two reasons why that might be the case. If we assume that our fuzz box is really doing a good job and what comes out is just 'high' or 'low' (e.g. like a comparator-style fuzz) and the original guitar signal is completely gone, then there's still a couple of differences remaining:

1) Pitch. Synths or software will produce a solid, steady pitch. I don't know much about the physics of guitars, but it's possible that the note starts a bit sharp as it is plucked and then drops a bit as it plays - or some other similar "pitch envelope" effect that is still recognisable as a guitar not a synth.

2) Pulse Width Modulation. This is highly likely to be significant. The guitar's waveform is not likely to have exactly the same amount of time spent above and below the threshold, so the output from our fuzz won't be an exact 50%/50% waveform. This will affect the harmonic content - it'll be a pulse wave instead. It's even possible that the guitar signal might have more than one zero-crossing in a waveform period, giving a "double-pulse" type waveform. I've never analysed the harmonics of these. Furthermore, as the note decays, the guitar waveform will change and there will be corresponding changes in the pulse width of the fuzzed output. On a synth this is known as "pulse width modulation" and you can often dial it as an effect in its own right.

I wrote an article about this which includes pulse width modulation and the way that changing the pulse width alters the harmonic content. You might find (some of it) interesting:

https://electricdruid.net/timbral-evolution-harmonic-analysis-of-classic-synth-sounds/

Rob Strand

QuoteYeah, I can think of two reasons why that might be the case. If we assume that our fuzz box is really doing a good job and what comes out is just 'high' or 'low' (e.g. like a comparator-style fuzz) and the original guitar signal is completely gone, then there's still a couple of differences remaining:
One thing about opamps the transition region from low to high occurs in finite time during that time the opamp is passing through a linear region and the signal can leak through.  That's one reason why slower opamps sound different.

When an opamp saturates there a lot going on inside the opamp.  Different parts of the opamps are in different degrees of saturation.  Coming out of saturation involves storage mechanisms in the transistors and compensation caps.  Usually the behaviour is different for positive and negative swings.    People who design power amps often show overload recovery behaviour waveforms.

There's another effect I which only edges on being audible.  If you have a square-wave with ramped sides the act of ramping the sides acts like passing the square-wave filter through a low-pass filter.  That rolls-off the spectrum.   The filter is not quite an RC filter it's more of an FIR filter hence the linear sides as opposed to exponential charge/discharge curves.    For an opamp it could be either since slew-rate limiting would be linear and gain bandwidth limits.   Slew-rate limiting would tend to be blocking (but perhaps not 100% for a complex signal) and the amount of filtering due the sloped sides doesn't contribute much to filtering of audio for all-but the slowest opamps.  Gain bandwidth limits would cause a similar behaviour to RC filtering that would slow down the edges and allow the signal to leak through.

For transistor amps it gets more complicate since it's non-linear and the caps charge-up.  For a guitar signal the waveform might not even wave 50% duty cycle when it is overloaded.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.