# Waveshaper: Amplitude changing as frequency changes

#### Jack Tranckle

Joined Jan 20, 2016
73

I have designed a Sawtooth to triangular waveshaper using a precision full wave rectifier.I added C1 to stop clipping and the parallel resistors R7 and R5 to get the triangle's ampitude the same as the sawtooth (5V). But as the frequency gets higher, the amplitude is decreasing. Any ideas of how this can be prevented?

This design is for a music synthesiser, so the input sawtooth will vary from 30Hz to 1Khz while wanting to keep the amplitude about the same. It is also important that the triangle wave has an average offset of 0. So that it can be again converted into a sin wave later

EDIT: Here is the circuit without C1. Maybe the word clipping is incorrect, but as you can see there is a vertical line continuously throughout the simulation without the capacitor

Last edited:

#### OBW0549

Joined Mar 2, 2015
3,566
I have designed a Sawtooth to triangular waveshaper using a precision full wave rectifier. I added C1 to stop clipping and the parallel resistors R7 and R5 to get the triangle's ampitude the same as the sawtooth (5V).
Try as I might, drawing on my 40+ years in circuit design, I cannot for the life of me figure out how adding C1 is supposed to stop clipping. If you want to stop clipping, reduce the value of R4 to lower the gain of the last stage, or reduce your input signal amplitude.

But as the frequency gets higher, the amplitude is decreasing. Any ideas of how this can be prevented?
Yes: eliminate C1.

C1, together with R4, form a low-pass filter with a cutoff frequency (that is, a -3db point) of 800 Hz. That's what's causing your amplitude to decrease at high frequencies.

#### AnalogKid

Joined Aug 1, 2013
10,778
C1-R4 form a corner frequency of 800 Hz. I'd start by removing C1, and seeing if reducing the input amplitude eliminates the clipping. If it does, we move on to other ways to get the amplitude you want without clipping. If it doesn't, we move on to other causes.

Edit: OBW types faster than I do.

ak

#### Alec_t

Joined Sep 17, 2013
14,005
If you're trying to convert a sawtooth into a triangle methinks integration is going to be involved at some point. In the circuit shown, R3C1 plus the opamp perform an integration, but have a fixed time constant. As a consequence, if the input frequency increases the integration occurs over a shorter period and so the integrated result will inevitably have a lower amplitude.
To get a frequency-independent integration result the time constant would need to be reduced in proportion to the frequency increase.

#### Dodgydave

Joined Jun 22, 2012
11,149
C1= Xc at 1Khz is 15K ohms , this is acting as a variable attenuator , remove it and try again...

#### MrChips

Joined Oct 2, 2009
29,825
Your integrator has a fixed time-constant. Hence your signal slew is fixed and this would cause the signal amplitude to be linearly proportional to cycle period.

You cannot achieve what you want with an integrator with fixed time-constant.

Joined Mar 10, 2018
4,057
One approach is to use an agc loop, detecting peak to peak V,
using that to control a variable gain amp. jfet controlled OpAmp
gain one method, R2R DAC controlling fdbk loop of OpAmp
another.

Or use a JFET, or light sensitive CDS photo cell as variable R.
In OpAmp G set circuit.

Regards, Dana.

#### OBW0549

Joined Mar 2, 2015
3,566
If you're trying to convert a sawtooth into a triangle methinks integration is going to be involved at some point.
Integrating a square wave that is symmetrical about zero volts (e.g., square wave which alternates between +1 volt and -1 volt) yields a triangle wave. Integrating a sawtooth wave that is symmetrical about zero volts yields a parabolic wave, NOT a triangle wave.

C1, R4 and the op amp aren't functioning as an integrator; they form an unwanted, single-pole lowpass filter with a corner frequency of 800 Hz. C1 should be deleted.

#### Alec_t

Joined Sep 17, 2013
14,005
Integrating a square wave that is symmetrical about zero volts (e.g., square wave which alternates between +1 volt and -1 volt) yields a triangle wave.
Exactly. The first step is to convert the sawtooth to a square, then integrate that.
C1, R4 and the op amp aren't functioning as an integrator
No, but C1, R3 are.

#### crutschow

Joined Mar 14, 2008
33,343
I have designed a Sawtooth to triangular waveshaper using a precision full wave rectifier.
I'm confused.
How can running a sawtooth through a full wave rectifier generate a triangle wave?

#### AnalogKid

Joined Aug 1, 2013
10,778
How can running a sawtooth through a full wave rectifier generate a triangle wave?
Sketch it out. It works on paper, but I think the vertical transition will not be infinitely fast through the opamp, leading to a full height dip or bounce at the beginning of each cycle.

ak

#### Alec_t

Joined Sep 17, 2013
14,005
Sketch it out. It works on paper
Spice doesn't think so. Going from triangle to sawtooth doesn't work either.

#### AnalogKid

Joined Aug 1, 2013
10,778

#### crutschow

Joined Mar 14, 2008
33,343
Sketch it out. It works on paper
Okay, I see that if the sawtooth is symmetrical around zero than, theoretically, a full-wave rectifier would convert it to a sawtooth.
It's the symmetrical around zero that I was missing.

#### Alec_t

Joined Sep 17, 2013
14,005
Here's the outline of one way of doing the conversion, not involving integration. It relies on switching the polarity of the first opamp gain when the sawtooth ramp gets halfway. The second opamp has a gain of ~-2 to bring the triangle up to the level of the sawtooth.

#### Attachments

• 2.6 KB Views: 1

#### crutschow

Joined Mar 14, 2008
33,343
C2 will reduce the spike produced during the flyback of the sawtooth through the precision rectifier but it should have a time-constant of no more than about 10μs to avoid significantly degrading the triangle shape and amplitude. Thus C2 should be no more than 50pF for R4 = 200kΩ.

#### crutschow

Joined Mar 14, 2008
33,343
Below is the LTspice simulation of Alec's basic circuit with an opamp to perform the switch function to invert the polarity of the input op amp.

Due to finite response times of the op amps, there is a glitch during the sawtooth flyback.
This is reduced by the R6-C2 filter.

#### Attachments

• 2.2 KB Views: 0

#### Jack Tranckle

Joined Jan 20, 2016
73
Try as I might, drawing on my 40+ years in circuit design, I cannot for the life of me figure out how adding C1 is supposed to stop clipping. If you want to stop clipping, reduce the value of R4 to lower the gain of the last stage, or reduce your input signal amplitude.

Yes: eliminate C1.

C1, together with R4, form a low-pass filter with a cutoff frequency (that is, a -3db point) of 800 Hz. That's what's causing your amplitude to decrease at high frequencies.
Maybe the word clipping is used wrongly, I have uploaded the resultant wave of the circuit without C1

#### OBW0549

Joined Mar 2, 2015
3,566
EDIT: Here is the circuit without C1. Maybe the word clipping is incorrect, but as you can see there is a vertical line continuously throughout the simulation without the capacitor
That vertical line glitch is exactly what @crutschow has been talking about. Read his posts here to see why this occurs.