TMI about square waves

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

JohnRoberts

Well-known member
Staff member
GDIY Supporter
Moderator
Joined
Nov 30, 2006
Messages
28,322
Location
Hickory, MS
Rather than feed the veer already in process I thought I would start a new thread about square waves. People probably think they know what square waves are but details matter. Ideal square waves are defined as having instantaneous transitions from baseline to full scale, and back down again. Spoiler alert, nothing in nature is instantaneous. There are two popular ways to characterize fast moving waveforms; slew rate and rise time. Audio slew rates are generally defined as X volts per microsecond. Rise time is defined as time it takes for the waveform to rise from 10% to 90% of its max voltage also typically microseconds for audio circuitry.

More audio folk are familiar with slew rate as a performance metric routinely used to compare how fast op amps, or even audio power amps are. Rise time is more obscure and while comparing similar behaviors not widely embraced in audio equipment specifications.

To connect a few recently discussed topics (like NF and square waves) lets try to visualize what happens inside a typical op amp using NF when we input an ideal square wave. We have to use out imagination because ideal square waves don't exist in nature but some are fast enough for my purposes here. The instantaneous square wave transition up or down creates an input step error voltage because the output can't move instantaneously. This step error voltage will tell the op amp output to slew like a mother up or down. As the output starts catching up to the input signal the error voltage is reduced and the output rate of change slows creating the familiar curve as edge reaches level. This phenomenon has been awkwardly described as the amplifier "losing" NF during this catch up time. Different circuit designs behave somewhat differently which is why IC makers published square wave results.

Back in the 70s(?) some people tried to name new distortions based on this phenomenon. I was not a fan nor were some old school guys who cut their teeth designing HF radar technology during WWII. The new kind of distortion crowd wanted to anoint some winners and losers for their new distortion metric so used a square wave that was actually possible to make. They rise-time limited it through a LPF so it was difficult but not impossible.

Revisiting how typical op amp input stages respond to input steps (like square waves) there will immediately be a step error voltage between the + and - input pins that reflects how badly the output is not where the input says it should be. The dominant pole compensation stage is generally a simple one pole integrator. This integrators rate of change is a simple function of how big is the compensation cap, and how much current is the input LTP steering towards that integrator. The smaller the compensation cap the less current it takes to move it quickly. As long as this step error across the input stage is only a few mV the input LTP will remain linear (both devices conducting) and recover from transient events quickly. However if the error voltage step size if large enough to cut off the lagging LTP transistor it won't start conducting again smoothly. This is a bit of an oversimplification but explains the weirdness in some op amps recovering from (slew limiting) transients. Note: a simlar loss of NF occurs when outputs saturate into one rail or the other, this too can result in recovery related artifacts.

Back around the same time the one crowd was trying to invent new kinds of distortion, Dr. Marshall Leach (RIP) published a input topology that could not be slew limited. His design involved degenerating the input LTP with resistors such that a valid level input step signal (i.e. would not saturate the output stage) the overall response would be a well behaved rise time. (IIRC I linked to this Prof Leach AES paper here years ago, it was only a few pages long but iconic, IMO). Of course this "better" design created a conundrum for amplifier manufacturers who were saddled with customers who wanted to read slew rate specs with faster always being better. As I recall one manufacturer even had to footnote their amp data sheets with the reality that they defeated their rise time circuit to allow for data sheet slew rate measurements.

One thing I like about properly rise time limited signals a 1V square wave, and 10V square wave will look exactly the same only taller.

Mo later

JR
 
What I found fascinating back in university days was learning about square waves in frequency domain rather than time domain. It helped me understand a lot of these kinds of issues in a different way. A 'perfect' square wave has infinite bandwidth and we all know things get weird up in the radio frquencies, which is why audio equipment is usually designed to block or roll it off. Therefore audio equipment can never pass a perfect square wave (even if we could generate one). How gracefully it fails to pass that wave is the question at hand I believe.
 
What I found fascinating back in university days was learning about square waves in frequency domain rather than time domain. It helped me understand a lot of these kinds of issues in a different way. A 'perfect' square wave has infinite bandwidth and we all know things get weird up in the radio frequencies, which is why audio equipment is usually designed to block or roll it off. Therefore audio equipment can never pass a perfect square wave (even if we could generate one). How gracefully it fails to pass that wave is the question at hand I believe.
I know I am being pedantic but a perfect square requires an infinite bandwidth to pass it unchanged, it does not of itself posses a bandwidth. However, its Fourier expansion is an infinite number of sine waves. Slew rate applies to any network, even passive ones; it is not necessary to add an op amp or any active component. Audio circuits do not need a very high slew rate to be able to pass a 20KHz bandwidth. The fastest you need to go is from the top to the bottom of a 20KHz sine wave which is a period of 25uS. So if you want to output +20dBu = 21.917V peak to peak at 20KHz you only need to be able to slew 22V in 25uS which is less than 1V per uS.

Cheers

Ian
 
I know I am being pedantic but a perfect square requires an infinite bandwidth to pass it unchanged, it does not of itself posses a bandwidth. However, its Fourier expansion is an infinite number of sine waves. Slew rate applies to any network, even passive ones; it is not necessary to add an op amp or any active component. Audio circuits do not need a very high slew rate to be able to pass a 20KHz bandwidth. The fastest you need to go is from the top to the bottom of a 20KHz sine wave which is a period of 25uS. So if you want to output +20dBu = 21.917V peak to peak at 20KHz you only need to be able to slew 22V in 25uS which is less than 1V per uS.

Cheers

Ian
SR=2Pi x f x Vpeak (sine wave)
 
One thing I like about properly rise time limited signals a 1V square wave, and 10V square wave will look exactly the same only taller.

Sorry to nitpick, but I don't think taller is a good word choice here as it implies height only. So not fully conveying the point you are making. Perhaps magnified, or proportionally bigger would be better descriptors.
 
I was wondering , could a spark from a piezo click lighter ,coupled through a small acoustic horn and into a microphone be used as some kind of qualitative measure of performance . I have a vague recolection about this being used ,but the sands of time have eroded my memory . Of course Kilo-volts applied directly to transistor audio circuitry of any kind would most likely kill it dead instantly , a tube would probably handle it ok though .
 
What I found fascinating back in university days was learning about square waves in frequency domain rather than time domain. It helped me understand a lot of these kinds of issues in a different way. A 'perfect' square wave has infinite bandwidth and we all know things get weird up in the radio frquencies, which is why audio equipment is usually designed to block or roll it off. Therefore audio equipment can never pass a perfect square wave (even if we could generate one). How gracefully it fails to pass that wave is the question at hand I believe.
Check out "Gibbs phenomenon", the appearance of ringing when you cleanly scrape off the upper harmonics. In the early days of digital audio, these actually more accurate digital filters were criticized because they didn't look like people expected.
400px-Gibbs_phenomenon_50.svg.png


JR
 
Sorry to nitpick, but I don't think taller is a good word choice here as it implies height only. So not fully conveying the point you are making. Perhaps magnified, or proportionally bigger would be better descriptors.
is that all I got wrong? The waveform looks pretty much the same only bigger?

JR
 
I was wondering , could a spark from a piezo click lighter ,coupled through a small acoustic horn and into a microphone be used as some kind of qualitative measure of performance . I have a vague recolection about this being used ,but the sands of time have eroded my memory . Of course Kilo-volts applied directly to transistor audio circuitry of any kind would most likely kill it dead instantly , a tube would probably handle it ok though .
The sound generated by a spark would be from the air being heated and expanding outward. Maybe use it for slating sci-fi movies.

JR
 
isn't a square wave all the odd harmonics?
It is a weighted sum of odd harmonics. Begin with sin(x)+sin(3x)/3+sin(5x)/5 + ... The more odd overtones we add the smaller each one is and the more like a square wave the combined sum looks. The Gibbs phenomenon was caused by filtering out the HF sin(Nx)/N components above the audio passband.

JR
 
I was wondering , could a spark from a piezo click lighter ,coupled through a small acoustic horn and into a microphone be used as some kind of qualitative measure of performance .
For microphones and acoustic measurements, yes. Alternatives are a starter gun, or a ballon exploding. Because they all produce a very sharp positive pressure and a relatively slower release.
 
Hmmm guns and microphones ,
Course its common nowadays for military units to use microphone arrays along with time of arrival measurements to get a bearing on enemy snipers , modern DSP techniques have probably made this technology orders of magnitude more accurate , the technology itself probably goes back to the second war though .I wouldnt be at all surprised if Alan Blumleins work was the key to these techniques .
 
Some large US cities use microphones located in different neighborhoods to help ID where gun fire is coming from.

====

Back on topic... I shared about the AES paper that Marshal Leach published proposing degenerating input stage LTP with resistors to prevent slew limiting. The ancients must have been reading over his shoulder. The old LM108/308 series op amp used 2kOhm emitter degeneration resistors. Of course there is no free lunch, these op amps while well respected for their high speed behavior, were not very low noise (around 30nV/rt Hz) because of the added resistance effectively in series with the inputs, contributing Johnson (thermal) noise. This noise level was usable for line level applications. I think I used the LM308 in my home brew (4x250W) audio power amp I built back in the early 70s (I borrowed that part of the design from BGW).

The closest we get to free lunch is Bifet op amps. Using JFET devices in the input stage LTP takes advantage of the natural lower transconductance of JFETs, for improved slew performance. I vaguely recall RCA making MOSFET input op amps but they didn't gain any traction back then. More recently CMOS processes have improved to the point that companies are now making CMOS op amps that don't suck. The target market pursued by these new CMOS op amps are low supply current, rail to rail outputs.

I am not a big fan of DOAs. The only time I made one was back in the late 70s for one socket when we couldn't buy 1nV/rt Hz op amps off the shelf. Of course since then technology has kept moving forward. I haven't kept track of modern JFET technology but I recall 1nV JFETs back decades ago. If I was rolling a DOA today starting from a blank sheet, a Bifet DOA might be an interesting project.

The parameter describing this max input voltage for linear slew operation is called Vth. A simple non-degenerated bipolar LTP will saturate or cut off from only tens of mV voltage difference across the inputs. IIRC the Vth for Bifet op amps is in the order of single digit volts (3V?). For an anecdote that drives home the benefit of more Vth, back in the mid 80s when I started working at Peavey I inherited responsibility for several small mixers (and a bunch more SKUs). One of these small mixers was experiencing field service complaints about "rectification". If you hit a bipolar input op amp with RF larger than the Vth, it will decode that RF into radio station music. Since the subject mixer didn't have many channels feeding its bus I did a running engineering change order to swap in a Bifet op amp for the bipolar, problem solved.

mo lata

JR
 
Some large US cities use microphones located in different neighborhoods to help ID where gun fire is coming from.

====

Back on topic... I shared about the AES paper that Marshal Leach published proposing degenerating input stage LTP with resistors to prevent slew limiting. The ancients must have been reading over his shoulder. The old LM108/308 series op amp used 2kOhm emitter degeneration resistors. Of course there is no free lunch, these op amps while well respected for their high speed behavior, were not very low noise (around 30nV/rt Hz) because of the added resistance effectively in series with the inputs, contributing Johnson (thermal) noise. This noise level was usable for line level applications. I think I used the LM308 in my home brew (4x250W) audio power amp I built back in the early 70s (I borrowed that part of the design from BGW).

The closest we get to free lunch is Bifet op amps. Using JFET devices in the input stage LTP takes advantage of the natural lower transconductance of JFETs, for improved slew performance. I vaguely recall RCA making MOSFET input op amps but they didn't gain any traction back then. More recently CMOS processes have improved to the point that companies are now making CMOS op amps that don't suck. The target market pursued by these new CMOS op amps are low supply current, rail to rail outputs.

I am not a big fan of DOAs. The only time I made one was back in the late 70s for one socket when we couldn't buy 1nV/rt Hz op amps off the shelf. Of course since then technology has kept moving forward. I haven't kept track of modern JFET technology but I recall 1nV JFETs back decades ago. If I was rolling a DOA today starting from a blank sheet, a Bifet DOA might be an interesting project.

The parameter describing this max input voltage for linear slew operation is called Vth. A simple non-degenerated bipolar LTP will saturate or cut off from only tens of mV voltage difference across the inputs. IIRC the Vth for Bifet op amps is in the order of single digit volts (3V?). For an anecdote that drives home the benefit of more Vth, back in the mid 80s when I started working at Peavey I inherited responsibility for several small mixers (and a bunch more SKUs). One of these small mixers was experiencing field service complaints about "rectification". If you hit a bipolar input op amp with RF larger than the Vth, it will decode that RF into radio station music. Since the subject mixer didn't have many channels feeding its bus I did a running engineering change order to swap in a Bifet op amp for the bipolar, problem solved.

mo lata

JR
Sorry, what is "DOA" (apart from a non-recoverable fail state) - "Dual Op Amp"?
 
Back on topic... I shared about the AES paper that Marshal Leach published proposing degenerating input stage LTP with resistors to prevent slew limiting. The ancients must have been reading over his shoulder. The old LM108/308 series op amp used 2kOhm emitter degeneration resistors. Of course there is no free lunch, these op amps while well respected for their high speed behavior, were not very low noise (around 30nV/rt Hz) because of the added resistance effectively in series with the inputs, contributing Johnson (thermal) noise. This noise level was usable for line level applications. I think I used the LM308 in my home brew (4x250W) audio power amp I built back in the early 70s (I borrowed that part of the design from BGW).
The genius feature of Deane Jensen's 990 circuit (which he patented and then gave away in a published article) is that putting a pair of small inductors degenerates the HF gain of the input pair without incurring the noise penalty of resistors! Therefore, it makes an outstanding low-noise mic preamp as well as a powerful line driver. A lot of "990" knock-offs miss this not-so-obvious difference.
 
Yup, sorry by DOA I was referring to discrete op amps that are pretty popular around here.

+1 to Abbey's share about combining IC op amps with discrete active devices in front of or behind for sundry benefits. IC op amps are incredibly convenient and inexpensive sources of 100 dB of stable well behaved gain. In front devices can provide low noise gain without the complexity of a full scratch design. Immediately behind IC op amps power devices can provide significant drive capability, again without the struggle of a full scratch design. These hybrid designs are actually pretty mature. I have even made some exotic high performance rectifiers wrapping a transistor array around a common op amp (used inside TS-1).

My point about a JFET DOA is why limit ourselves to bipolar devices when JFETs have improved so much..? I just did a search and found at least one JFET DOA for sale only $38, but the description sounds a little weird.
====

For a little more square wave trivia, my last vinyl phono preamp ever, designed back in the 1980s was over engineered to handle extreme rise times. The input stage was effectively an open loop common source JFET gain stage. The drain current output of that input gain stage fed directly into a capacitor to ground defining the 75uSec pole in the RIAA EQ creating a passive LPF. There was a DC servo wrapped around that input stage to stabilize DC output. A current source increased the current density of the input JFET for increased linearity (lower distortion). Arguably over engineered for that one parameter, input edge rate, it was competent at everything else. It could handle any several volt square wave input signal that didn't clip the output from normal RIAA voltage gain.
===
While I have mainly focussed on the HF content in square waves they are popular in old school audio path troubleshooting for quick assessment of frequency response. The tilt of the square wave top and bottom flats reflects LF response. Overshoot of rising and falling edges can reflect HF response and even instability.

JR
 

Latest posts

Back
Top