# Understanding triangle generator circuit

#### thatoneguy

Joined Feb 19, 2009
6,359
This may generate some controversy:
I haven't done the math, but my gut tells me that the PWM from an exponential triangle generator will be as accurate as that from a linear triangle. This assumes that the rising and falling time constants are identical, and that the comparator's propagation delay is independent of input slew rate. I am referring to the comparator that generates the PWM, not the one involved in generating the triangle wave.
OTOH, maybe I'm the only one who thinks that this might be controversial. I am not implying that, with real-world parts, the exponential triangle is as good as the linear triangle for generating PWM.
I'm thinking of your statement, and comparing it to an amplified "shark-tooth" RC Charge/Discharge plot. The upper and lower points are a bit thicker than a regular triangle wave, but not by much, and the slope across the midpoint is greatly different than that of a triangle wave.

It would be interesting to hear the change in sound if one swapped out an RC waveform into a Class D amp, then switched between that and the triangle wave. When getting to nearly square waveforms, there will be a big problem, but the RC waveforms would only "mess up" the zero point, so to speak. I'm now curious to the human ear picking up the change, assuming the RC plot was very close to a prefect triangle wave.

#### Wendy

Joined Mar 24, 2008
22,368
This may generate some controversy:
I haven't done the math, but my gut tells me that the PWM from an exponential triangle generator will be as accurate as that from a linear triangle. This assumes that the rising and falling time constants are identical, and that the comparator's propagation delay is independent of input slew rate. I am referring to the comparator that generates the PWM, not the one involved in generating the triangle wave.
OTOH, maybe I'm the only one who thinks that this might be controversial. I am not implying that, with real-world parts, the exponential triangle is as good as the linear triangle for generating PWM.
Usable, but not linear. It would be interesting to find out, I suspect I can prove it with graphics. I've had the thought to try the exponential triangle (love the name) for a quick and dirty Class D amp for the book. I've always assumed it would introduce a minor degree of distortion, I still think it will.

#### Ron H

Joined Apr 14, 2005
7,014
Usable, but not linear. It would be interesting to find out, I suspect I can prove it with graphics. I've had the thought to try the exponential triangle (love the name) for a quick and dirty Class D amp for the book. I've always assumed it would introduce a minor degree of distortion, I still think it will.
My gut instinct failed me. Worse that that, my memory failed me. I had run a simulation in July, proving that the resulting harmonic distortion was pretty bad when using the RC triangle. I can post the sim later if anyone wants to see it. I'm pressed for time right now.

#### andy24691

Joined Nov 25, 2010
42
I've got some CA3140 OP-AMP's with a BW of 4.5 Mhz, I guess this is insufficient and in which case what sort of bandwidth would you reccommend? I will have a go at simulating crutschow's circuit and see what thats like. Is it a bad idea to use an op-amp as a comparator at high frequency?

#### Audioguru

Joined Dec 20, 2007
11,249
An opamp has a capacitor inside to reduce its gain at high frequencies so it doesn't oscillate when negative feedback is applied. It switches slowly.
A comparator DOES NOT have a capacitor to reduce its gain at high frequencies so it switches very fast.