In phase tri generator from ramp/saw core…

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: Kent, Joe., analogdigital, infradead, lisa, parasitk, plord, sduck

Post Reply
thor.lucas
Common Wiggler
Posts: 54
Joined: Tue Dec 19, 2017 3:48 am

In phase tri generator from ramp/saw core…

Post by thor.lucas » Sun Nov 10, 2019 2:00 am

Hi,

So I'm building a VCO. It's a ramp/saw core. Currently it generates ramp, square, tri, and sine waves. However, I noticed one fatal flaw.

I was using ray's method of generating tris by rectifying ramp and saw, mixing them, then scaling. However, this generates out of phase tris and thus sines. This is not good for my module because it relies on waveshaping by mixing those four waves.

If you're wondering why this is considered out of phase, imagine this:

In one rotation, saw starts at -5V and goes up to 5V. Square starts at -5V and goes up to 5V. The sine and tri waves should start at 0, go negative at 1/4, go back to 0 at 1/2. then +5V at 3/4, and back to zero. This would be in phase.

With ray's method, the tris and sine start at +5V, go down to -5V at 1/2, and back to +5V at 1.

What sort of saw to tri generator stays in phase?

Thanks

User avatar
guest
Super Deluxe Wiggler
Posts: 3596
Joined: Mon Aug 19, 2013 11:49 am

Post by guest » Sun Nov 10, 2019 2:12 pm

there are a few ways of doing this, but they are all more complicated than the simple fulwave rectifier. you need breakpoints at +/-2.5V, so something like an odd harmonic wavefolder would work, but would round off the edges. otherwise you can cascade 2 fullwave rectifiers, and then invert one half of the cycles. the easier option, though, to get the phase relationship you want, is to shift the phase of the triangle wave. this can be done with a single comparator and and summing amp:

http://electronotes.netfirms.com/EN87Part.PDF

this is often referred to as a saw animator.
openmusiclabs.com

thor.lucas
Common Wiggler
Posts: 54
Joined: Tue Dec 19, 2017 3:48 am

Post by thor.lucas » Mon Nov 11, 2019 5:09 am

guest wrote:there are a few ways of doing this, but they are all more complicated than the simple fulwave rectifier. you need breakpoints at +/-2.5V, so something like an odd harmonic wavefolder would work, but would round off the edges. otherwise you can cascade 2 fullwave rectifiers, and then invert one half of the cycles. the easier option, though, to get the phase relationship you want, is to shift the phase of the triangle wave. this can be done with a single comparator and and summing amp:

http://electronotes.netfirms.com/EN87Part.PDF

this is often referred to as a saw animator.
So somebody suggested this on reddit and I tried it. However, it produces massive glitches that I can't seem to filter out no matter how hard I try (simulated on ngspice). Maybe the TL072 does not have a high enough slew rate for this application?

thor.lucas
Common Wiggler
Posts: 54
Joined: Tue Dec 19, 2017 3:48 am

Post by thor.lucas » Mon Nov 11, 2019 6:36 am

I've been looking around for ridiculously high slew rate comparators that function in a +-12V range in order to mitigate this glitch to such a high frequency that it can be filtered with ease… can't seem to find one. If anybody could help…

Seems the TL072 slew rate is too slow for this. I might try OP275 but I think the solution would be a true comparator. I think using a regular audio op amp isn't good because the open loop gain is also not high enough. When the voltage starts getting close to the threshold, the pulse starts bending a little which also doesn't help with the glitch. I need something that will go from -10V to 10V very quickly and stay at 10V.

User avatar
cygmu
Super Deluxe Wiggler
Posts: 1414
Joined: Mon Feb 15, 2016 3:33 pm
Location: UK

Post by cygmu » Mon Nov 11, 2019 6:42 am

thor.lucas wrote: So somebody suggested this on reddit and I tried it.
*waves* hello!
However, it produces massive glitches that I can't seem to filter out no matter how hard I try (simulated on ngspice).
Hmmm, that's interesting: I always found that this idea was more glitchy in practice than in any sim I could create. One thing you could try is adding a bit of hysteresis to the comparator, so that it doesn't oscillate at the crossover point. That was always a real-life need for me but not something that came up in simulations.

There will be glitches, but they should not be much different from what you always get with saw-to-tri conversions; the only thing is that you have more of them here: once when the input saw resets, and also when the phase shifter resets.

The oldest trick in the book for smoothing out those glitches is to make the final op amp in the chain be one with a low slew rate so that it can't keep up with the glitch.

thor.lucas
Common Wiggler
Posts: 54
Joined: Tue Dec 19, 2017 3:48 am

Post by thor.lucas » Mon Nov 11, 2019 4:47 pm

cygmu wrote: The oldest trick in the book for smoothing out those glitches is to make the final op amp in the chain be one with a low slew rate so that it can't keep up with the glitch.
Wow.... After spending hours trying various combinations of high order butterworth filters and making that glitch as small as possible by using high slew rate op amps… I just might try that. Any op amps you can recommend?

User avatar
guest
Super Deluxe Wiggler
Posts: 3596
Joined: Mon Aug 19, 2013 11:49 am

Post by guest » Mon Nov 11, 2019 7:39 pm

you can also try feeding back a bit of the glitch in opposite polarity to cancel it out.
openmusiclabs.com

User avatar
cygmu
Super Deluxe Wiggler
Posts: 1414
Joined: Mon Feb 15, 2016 3:33 pm
Location: UK

Post by cygmu » Tue Nov 12, 2019 4:02 am

I am not speaking from much experience here, but I seem to recall reading that a 741 did the trick here. It certainly slews very slowly :) Probably not ideal for producing a sawtooth, but for the triangle and sine stages it might just work.

nrrrd
Common Wiggler
Posts: 129
Joined: Wed May 23, 2018 2:47 pm
Location: Oxford

Post by nrrrd » Tue Nov 12, 2019 7:49 am

One method I've thought of trying, and have working in simulation is:

1. Use an inverting opamp to create an inverted version of the saw
2. Feed the original saw into a 40106 schmitt trigger inverter to get pulse 1
3. Feed the output of the inverter into another inverter to get pulse 2
4. Use pulse 1 to drive switch 1 on a 4066 quad switch
5. Use pulse 2 to drive switch 2 on the 4066
6. Feed the saw into switch1 of the 4066
7. Feed the inverted saw into switch2
8. Mix the two switch outputs

For step 2 you might have to add some dc offset to get the pulse width equal, especially if your wave crosses the zero line.

thor.lucas
Common Wiggler
Posts: 54
Joined: Tue Dec 19, 2017 3:48 am

Post by thor.lucas » Tue Nov 12, 2019 6:56 pm

nrrrd wrote:One method I've thought of trying, and have working in simulation is:

1. Use an inverting opamp to create an inverted version of the saw
2. Feed the original saw into a 40106 schmitt trigger inverter to get pulse 1
3. Feed the output of the inverter into another inverter to get pulse 2
4. Use pulse 1 to drive switch 1 on a 4066 quad switch
5. Use pulse 2 to drive switch 2 on the 4066
6. Feed the saw into switch1 of the 4066
7. Feed the inverted saw into switch2
8. Mix the two switch outputs

For step 2 you might have to add some dc offset to get the pulse width equal, especially if your wave crosses the zero line.
Interesting idea, but it wouldn't work well for Eurorack since the CD40106 has a maximum supply of 20V, and we operate on +-12V (24V).

Post Reply

Return to “Music Tech DIY”