Non-ideal square waves

Discussions about anything analog, digital, MIDI, synth technology, techniques, theories and more.

Non-ideal square waves

Postby joeboy » Tue Feb 19, 2019 5:35 am

To implement square waves, I'm using a wavetable that literally jumps between -1.0 and 1.0.

I know this isn't how squares work in the physical world, and it certainly doesn't sound very good. I'm wondering how un-ideal the typical square wave is in an analog synth. I know you can approach a square by adding odd integer harmonics, but how many of them would you add? Should their amplitudes be different? Are there any other subtleties that distinguish actual square waves from their textbook definition?
User avatar
joeboy
Junior Member
Junior Member
 
Posts: 102
Joined: Tue Jul 17, 2012 1:22 am
Location: 熊本
Gear: ax-80, jx-8p, v-synth, monotribe, ПИФ, tx81z, sy35, tg77

Re: Non-ideal square waves

Postby Weirdofromouterspace » Tue Feb 19, 2019 8:37 am

The 'corners' may be rounded a little bit, or have 'spikes' (note the difference between the SoundLab Ultimate and the other two). The vertical parts pf the curve may in fact not be exactly vertical (see the third picture in particular!), and so on.

I have added three pictures that should give you an idea, all of which were taken on my SDIY workbench:

1) MFOS SoundLab Ultimate
Image

2) TTSH, VCO 2
Image

3) MFOS SoundLab Mini
Image

Hope that helps a bit :)
Don't forget to TURN ON THE SYNTHESIZER. Often this is the reason why you get no sound out of it. - ARP 2600 manual, 1971
User avatar
Weirdofromouterspace
Active Member
Active Member
 
Posts: 310
Joined: Wed Mar 26, 2014 10:30 pm
Location: Germany
Real name: Bodo
Gear: MFOS SLMS+ & Ultimate, TTSH, DX7IID, DX21, Minibrute, Poly-800, microKORG, microSAMPLER, Volca Beats & Bass, JX-03, Tr-8, Kawai K1, Jasper

Re: Non-ideal square waves

Postby commodorejohn » Tue Feb 19, 2019 3:25 pm

My cheapo solution for implementing non-ideal square waves (modeled loosely on what I've seen of traces from Moog oscillators) is as follows:
  1. If the comparator state has flipped (i.e. the ideal pulse wave goes from 1 to -1 or vice-versa,) set the new output value to the ideal.
  2. If the comparator state has not flipped, set the new output value to a fraction of the current output value, where the fraction is nearly 1 but not quite (this requires playing around with, I can't remember what I have it set to in my code.)
This gives a gentle inward curve to the peaks like what's shown in Weirdofromouterspace's first image. Maybe apply a simple slew on top of that to reduce the angle of the upward/downward transitions as well.
Computers: Amiga 1200, DEC VAXStation 4000/60, DEC MicroPDP-11/73
commodorejohn
Synth Explorer
Synth Explorer
 
Posts: 1556
Joined: Mon Aug 12, 2013 2:39 am
Location: Sacramento, CA
Real name: John
Gear: Roland JX-10/SH-09/MT-32/D-50, Yamaha DX7-II/V50/TX7/TG33/FB-01, Korg MS-20 Mini/ARP Odyssey/DW-8000/X5DR, Ensoniq SQ-80, Oberheim SEM

Re: Non-ideal square waves

Postby Zamise » Tue Feb 19, 2019 10:52 pm

Not sure this applies to your questions, but I tried to do some sampled PWM a while back using sampled squares, and I noticed even the "perfect" digitally generated tone was not perfect, then looks pretty perfect imported tho, played back analog outs the end result could barely be seen as anything useful or recognizable really. Anyhow here are the screen grabs if it does anything for you or not. The original squares were generated in CoolEdit2000.

Image
Last edited by Zamise on Tue Feb 19, 2019 11:01 pm, edited 1 time in total.
<ZQS> [....<OII>.....soundcloud player v2.42.....................link]
User avatar
Zamise
Supporting Member!
Supporting Member!
 
Posts: 2351
Joined: Wed Oct 20, 2004 2:41 am
Location: DenverMetroUSA, Quantum-Source.com
Gear: Rollhand P00
Band: Quantum-Source

Re: Non-ideal square waves

Postby Mooger5 » Tue Feb 19, 2019 11:01 pm

What about the typical Roland square wave? And by others too. You can see how they are derived from the saw core oscillator. They aren´t flat, that´s the portion of the saw wave that passes through before the comparator goes into saturation. Note how both the positive and the negative portions point towards the zero crossing.

Image
Herrare umanum est.
Mooger5
Expert Member
Expert Member
 
Posts: 1409
Joined: Tue May 06, 2008 5:11 pm
Location: Lisbon

Re: Non-ideal square waves

Postby Mooger5 » Tue Feb 19, 2019 11:25 pm

Even if a square wave looks perfect on screen, there´s always the slew rate of the amplification and the speaker driver itself. The lower mass and inertia the better, but it always takes time to "travel" from one "state" to another, so we are never able to hear how an ideal square wave sounds. What we hear is distortion produced by non ideal playback devices. Anyway, all classic waveforms when viewed on screen, if they´re not the simple geometric figures then they´re just distortions of the ideal waves. So we can use distortion to make the wave sound subjectively nicer.

There is a very informative article by Nelson Pass on the subject of distortion. It´s important to distinguish between linear and non linear distortion.
There is a good example of non linear distorion applied to a sinewave. It generates even harmonics. The same principle apllied to a square wave would at least look interesting I think. By making the square non symmetrical where the positive portion is different from the negative, and not a mirror image of.

I´ll see if I can find that article.
Herrare umanum est.
Mooger5
Expert Member
Expert Member
 
Posts: 1409
Joined: Tue May 06, 2008 5:11 pm
Location: Lisbon

Re: Non-ideal square waves

Postby Mooger5 » Tue Feb 19, 2019 11:33 pm

Here it is. Don´t be put off by the word "audiophile". The man knows his stuff. :)

https://www.passlabs.com/sites/default/ ... edback.pdf
Herrare umanum est.
Mooger5
Expert Member
Expert Member
 
Posts: 1409
Joined: Tue May 06, 2008 5:11 pm
Location: Lisbon


Return to General Synthesizers

Who is online

Users browsing this forum: CosmicSurfer and 11 guests