[ ? ] Continuously variable phase LFO?

Started by moosapotamus, December 06, 2008, 02:34:58 PM

Previous topic - Next topic

moosapotamus

Can this be easily done with a single control pot?



When the pot is fully CCW both LFO signals would be in phase with each other. When the pot is turned fully CW the second LFO signal (green line) would lag behind the main LFO (blue line) such that the two LFO signals would effectively be 360 degrees out of phase with each other. Turning the pot from fully CCW to CW and back would essentially do what the animated GIF above is showing, allowing the offset between the two LFO signals to be set anywhere you like.

Practically speaking, I think this would be similar in principle to having just one LFO with a main LFO output, followed by an inverting opamp to give a second LFO output that is 180 dgrees out of phase, exactly opposite (inverted), with the main LFO output, like would be done in a stereo ping-pong tremolo, for example (see the commonsound panneur). However, instead of the inverting opamp there would be something else, some kind of continuously variable lag circuit.

Anyone have any ideas about how to do this?

I've been looking for a way to do this for a while with no luck.

Thanks
~ Charlie
moosapotamus.net
"I tend to like anything that I think sounds good."

R.G.

Yes, maybe.   :icon_rolleyes:

The direct way is with a microcontroller having two outputs. Most sine generators in uCs are table look up things. You simply tell the second output to look up the value X degrees back from the main output.

The maybe way is with quadrature or three-phase  waves to start with, I believe it's possible to mix a little of phase A with a little of phase B and if the "a little" coefficients are correct you wind up with a third phase at selectable angles to the first two. We had to do something like that in my electrical power class to derive three phase from a Scott-T connection or something like that.

Mmmm. I think you could use a time delay chip as well. That gets complicated too.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

moosapotamus

Hmmm... Thanks for the ideas, RG. Yeah, none of that sounds "simple".

Instead of something that's continuously variable, maybe this would be the next best thing? ...



From this thread...
http://www.diystompboxes.com/smfforum/index.php?topic=59768.msg467785#msg467785

Looks way cool! But need to simultaneously adjust for resistors to change speed? What does P1 do? Is there enough voltage on each of those outputs to light one or two LEDs? Anyone tried it?

~ Charlie
moosapotamus.net
"I tend to like anything that I think sounds good."

R.G.

The Forty-Fiver is an interesting-looking thing, but has some problems. I put it into the simulator, which is a good first step. It verified some of my suspicions.

The outputs are indeed at 45 degree angles in phase, as advertised. But you have hit on the issues by asking about P1. P1 adjusts the loop gain. Any sine wave self-oscillator needs to have two things: a phase shift of 360 degrees (or an integral multiple of that) and a gain around the total loop of exactly one. You may have noticed that the circuit in question has four phase shift stages of the discrete "univibe" ilk plus one inverting stage. The inverting stage is 180 of the 360, so the thing will oscillate at a frequency where the phase shift per stage is 1/4 of the remaining 180, or 45 degrees per stage. OK so far. However, there's that gain thing. If each phase stage had a gain of perfectly one, then the final inverter stage would only need a gain of one, and the loop gain would be perfect. But P1 sets the final stage to a gain higher than one. That's because each of the imperfect phase stages has some signal loss. The signal is biggest at T5's collector, and gets smaller at each stage that follows, until it gets back to T5 to boost it up for another trip around.

If you set P1 too high, the sine wave is distorted. If you set it too low, the self-oscillation dies out. All, every single one of the RC phase shift sine oscillators in existence have these issues. They universally need some method of detecting the size of the output signal and changing the gain a little to keep it stable.

In this LFO, you set the frequency of oscillation by setting the frequency where there is 45 degrees of phase shift per stage - that is, you change all four of Rf simultaneously and with required tracking. If they don't track, the numbers of degrees of phase shift per stage are not equally distributed.

A simpler option might be to use opamp-style phase shift stages, which have true unity gain, along with some active gain sense and changing. That would produce what this seems to but does not offer, four equal sized, equal offset sine waves. The tracking problem still exists, but you could use PWM on switches in series with resistors to "servo" them all at the same time, and by the same amount.

Sadly, again it gets complicated.

You sure you wouldn't like to just have a $2 PIC read one pot and then spit out two sine waves with X phase difference between them?  :icon_wink:
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

moosapotamus

Thanks for that explanaition, RG!

Quote from: R.G. on December 06, 2008, 07:43:40 PM
You sure you wouldn't like to just have a $2 PIC read one pot and then spit out two sine waves with X phase difference between them?  :icon_wink:

I think you might be talking me into it! But I don't really have any practical experience with PICs or programmable microcontrollers in general. Would this be an application that I might be able to dive right into? Can you maybe point me in the right direction?

Thanks
~ Charlie
moosapotamus.net
"I tend to like anything that I think sounds good."

R.G.

OK.
1. You will need some understanding of programming.
2. You will need a PIC programmer. This can be quite inexpensive, or self-made.
3. You will need some software as an environment to program in.

There is a huge body of information on the net about these three things. There is a lot over in the DSP forum here. Item 1 is the biggie; and the three together is the hump to get over to do your own custom controllers. After you get those done, You can whip out pretty much any custom logic widgie you want. If you have zero understanding of programming and/or don't want to get into it, bag this approach right now. If it sounds like fun to play with, you may find it as seductive as building effects.

Where do you stand?
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

moosapotamus

Well it's been a while, but I'm not a complete stranger to programming. I was into chaos theory back in the 80s and used to play with writing programs that would output graphics of strange attractors and fractals for fun. So I think I'm up for tackling that hump. More recently I briefly tinkered with an AVR that did a persistance of vision kind of thing. So I suppose I could transfer some of that to working with a PIC. Guess I just need to start searching, gathering info and dig in. 8)

~ Charlie
moosapotamus.net
"I tend to like anything that I think sounds good."

Nasse

Been thinkin that electromechanical wheel I should buy parts before christmas. And for years I have been thinkin about those analog circuits build from digital chips, like this http://www.elektor-electronics.co.uk/magazines/2001/december/digital-three-phase-sinewave-generator.54870.lynkx?

Dunno if something like this could be done: If analog lfo can be made to start/stop (I know they can) make two similar or more, press the stop button, and make start time continuously variable on one or more, so the lfos start with phase difference. Of course this is complicated and gives other problem, and perhaps you can not do it while playing
  • SUPPORTER

TELEFUNKON

#8

QuoteCan this be easily done with a single control pot?
Nothing simpler than that: just take to 2 phaseshift stages like from your average phaser
which shifts your average 1kHz signal from o° to 180° each, which results in  0° to 360°.
Replace the shiftcap by one that`s 1.000x the average value,
and get your average 1Hz LFO signal shifted from 0° to 360°.

Control those 2 phaseshift with a single stereopot (1 knob), with your average LDRs,
or your average FET control.
(the latter two voltage controlled by a true single pot-to-LEDs or FETgate).

Or mod above circuit: http://img.photobucket.com/albums/v437/latronax/FortyFiver2132.jpg
take T1 and T2 with their associated resistors, where RF1 and RF2 become the stereopot
for shifting from 0° to 360°. Make CF1 and CF2 something like 1µF to adapt it to the low LFO rates.
Disconnect Cc (also ~1µF) from the collector of T5 and now feed your average LFO into Cc.
use the collector and emitter of T3 as your two new antiphase outputs (via large caps for DC-blocking)
which can be set from 0° to 360° compared to your old LFO at the emitter, and offset 180° degrees
at the collector.
(throw out CF3 and RF3 and T4 and T5 with their associated Rs `n`Cs completely!)

If  LDRs for RF1 and RF2 are used, you can control the phase with a single pot-to-LED or another LFO
or envelope control, or seekwencer  :icon_wink:

Paul Perry (Frostwave)

Isn't there some way to manipulate two triangle waves to give a phase varying triangle?
If so, this could then go through a triangle to sine converter & there you have it.

TELEFUNKON

Quote from: Paul Perry (Frostwave) on December 07, 2008, 05:44:52 AM
Isn't there some way to manipulate two triangle waves to give a phase varying triangle?
If so, this could then go through a triangle to sine converter & there you have it.

Aah: the old "add a voltage to the threshold of a sawtooth oscillator" thing?  :icon_smile:

R.G.

Quote from: moosapotamus on December 06, 2008, 10:48:08 PM
Well it's been a while, but I'm not a complete stranger to programming. I was into chaos theory back in the 80s and used to play with writing programs that would output graphics of strange attractors and fractals for fun. So I think I'm up for tackling that hump. More recently I briefly tinkered with an AVR that did a persistance of vision kind of thing. So I suppose I could transfer some of that to working with a PIC. Guess I just need to start searching, gathering info and dig in.
OK, you're a prime candidate. If you did a POV and have programmed, you can do it.

I am most conversant with PICs. I have messed a bit with Atmel stuff, but I keep missing the robust pin specs of the PIC when I do it, even if the ATT stuff is faster. There are others here who are more familiar with Atmel. I can point you to a huge set of resources on the PIC. For instance, the archive of the MIT PICLIST email list:
The PIC List: http://piclist.com
Beginner's Checklist:   http://piclist.com/techref/piclist/begin.htm
Source Code Library (huge, really... the code you need is here) : http://piclist.com/techref/microchip/routines.htm
and for your particular issue:
Implementing the sine function on the PIC: http://www.brouhaha.com/~eric/pic/sine.html

I can sketch out your program for you.
- define and initialize the chip
- enter the main loop
- GOSUB read the pots
- store the pot value
- GOTO main loop
- SUBROUTINE read the pots
- RETURN
- ON INTERRUPT
- timer interrupts every X milliseconds, set by speed pot
- update the timer timing based on any new speed pot setting
- see if any output to do
- if so, get last phase value, increment it by the phase step
- calculate second phase value from phase delay pot
- get output value 1 and value 2 from the sine table for the two phase values
- output value 1 on output 1
- output value 2 on output 2
- RETURN

The pseudocode program is the same for any variety of uController you pick. In fact, if you get a compiled language like BASIC or C, the actual program will be 99% the same, only the initialization will be different. Assembler is, of course, very unique per hardware.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

gez

#12
There is a hack way to do this, that might be good enough for something like a trem circuit.  Low parts count, though the chips take up a bit of board space.

If you wire together the trig and thresh inputs of a 555 they form the input of a Schmidt trigger.  Wire it up as a Schmidt oscillator using a stop resistor and control pot in series from output to this new input, and stick a cap from input to ground.  This is your LFO, with a 50:50 duty cycle.  By varying the voltage on the control pin, you can PW modulate the square to go from slither to fat block (you'd need a scope to set this up).  If you use a 7556, the other half can be wired up as another Schmidt trigger and used to invert the output of this oscillator.  The inversion is freqency modulated as well as PWMed.  Feed both outputs to separate flip-flops in a 4013 to divide down, and you end up with two square waves of 50:50 duty cycle with one square that can be shifted from almost in sync to almost 360 degrees phase shift with the other.  Set up a couple of unbuffered inverters as unity gain amps (1M input and feedback resistors) and they'll distort the squares into sinusoidal wave forms. 

OK, not perfect as you end up with slightly choppy sine waves, but it could possibly work for a trem.  I used something similar to the above in a guitar synth that never got built: got a mild flange-distortion effect from my guitar.

Well, I did say it was hack.  Low parts count, though: 3 ICs, one cap and a few resistors.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

zyxwyvu

Quote from: moosapotamus on December 06, 2008, 10:48:08 PM
Well it's been a while, but I'm not a complete stranger to programming. I was into chaos theory back in the 80s and used to play with writing programs that would output graphics of strange attractors and fractals for fun. So I think I'm up for tackling that hump. More recently I briefly tinkered with an AVR that did a persistance of vision kind of thing. So I suppose I could transfer some of that to working with a PIC. Guess I just need to start searching, gathering info and dig in. 8)

~ Charlie

If you want to stick with AVRs, check out http://www.avrfreaks.net/. There should be enough info in the tutorials in the forum to do this project.

moosapotamus

Oh man... the eternal PIC vs AVR question. Hmmm...

RG - Thanks for all the PIC info. That's going to keep me quiet (busy) for a while.

Cool ideas everybody. Thanks! Compared to using a PIC, though, everything seems pretty cumbersome from a build perspective. Of course, from an implementation perspective, using a PIC would be cumbersome for me (since I'm a uC newbie), but it would not consume nearly as much PCB real estate as the other ideas. Ultimately I would, of course, like to be able to fit all of this into a standard sized stompbox.

So, while I would still totally love to find a "simple" way to to do this in the analog realm ('cause that's my comfort zone), I think I might take my original question over to the Digital & DSP forum. Still open to more analog ideas, tho. 8)

Thanks
~ Charlie
moosapotamus.net
"I tend to like anything that I think sounds good."

Eb7+9

#15
Take two phase shift oscillators with closely matched passives, use a design that has a grounded speed setting resistor in it ... something like grounded Rx in this circuit:

http://www.discovercircuits.com/Andy/WienBridgeOscillator1.pdf

how you negotiate global speed control is another matter, more below ... what you can do is take a couple of photocells to alternately tie a variable resistance across the grounded speed resistor on each LFO ... by tying the same resistor across the matched speed resistors you'll get the same offset and therefore traverse at the same rate across in both directions ... even though there might be two speed setting resistors in each LFO you only one need to tweak one of the resistors to produce the slight frequency offsets you're looking for ...

when a comparator senses (close-enough) when the two crests line up you feed a toggle or flop circuit to hold one photcell on and when they line up again you get the flop to turn on the other cell on and the current one off ... you'll be getting a back and forth between your waveforms by alternately producing a slight slowing down and resuming of each LFO in alternate fashion ... or you can also wire it so one side is stable and the other goes between a possitive and negative offset, but you might not really perceive a difference depending on what your final application is about ...

if you want to make all Rx variable and have LFO's tracking speed wise you can use matched photocells for accurate speed control and have both LFO continuously speed variable - you do this by driving LED's with a singular current and matching cells using a two point method ... then you can take a fifth matched photocell and have its LED driven by a current mirror (wich trackes the speed control current) in which you can ratio under or above using a "offset speed" pot - you do this by varying the smallish leg resistance on one side at the base of the mirror ...

the fifth photocell is the variable resistor that shunts the speed Rx resistors via the two switching photo-cells ... as your speed control cells go up and down so will the offset resistor by the same ratio - and therefore the ratio of shunting resistor to speed resistor will be compatible in value and not produce a gross mismatch in equivalent LFO speed resistances ...

there are several other ways of doing this ...

one is to use current controlled LFOs to produce tracking triangle wave oscillators with tri-sine converters at the ouput ... do a similar thing with a comparator-flop combo to toggle to produce slight offsets in the LFO control currents when crests get close to lining up ... in this case photocells are used to switch resistance in the control part of a mirror ... it's easier to have one LFO stable and the other go under and over using this approach ...


moosapotamus

Hi JC! Long time... :D
Thanks for weighing in on my question. If I'm interpreting correctly you are talking about a circuit that moves the offset or phase of LFO2, like in my little animated gif above, automatically back and forth, all by itself? Smack me if I've got that wrong. :icon_redface: I'm looking for a way to manually set the (static) offset with a pot.

Also, sounds like a lot of components, too. A uController still seems like the way to go... unless someone can convince me otherwise. ;)

Thanks
~ Charlie
moosapotamus.net
"I tend to like anything that I think sounds good."

Franky

PWM is the key. You might not be able to get a full phased signal (cause you can't use PWM on full range, often 10 to 90%)..

the frequency of the square wave would be the same as the sine, then the pot controls the pulse width, which integrated gives you a control voltage for a phasing stage. And no µC.. (AVR is really cool btw)...
42

R.G.

Quote from: Eb7+9 on December 07, 2008, 10:06:54 PM
... closely matched passives
...how you negotiate global speed control is another matter
... a couple of photocells to alternately tie a variable resistance across the grounded speed resistor
... a comparator senses (close-enough)
... you feed a toggle or flop circuit
... you get the flop to turn on the other cell on and the current one off
... you'll be getting a back and forth between your waveforms by alternately producing a slight slowing down and resuming of each LFO in alternate fashion
... or you can also wire it so one side is stable and the other goes between a possitive and negative offset, but you might not really perceive a difference depending on what your final application is about
...make all Rx variable
... matched photocells
...take a fifth matched photocell and have its LED driven by a current mirror
...ratio under or above using a "offset speed" pot
... smallish leg resistance on one side at the base of the mirror
... fifth photocell is the variable resistor that shunts the speed Rx resistors via the two switching photo-cells
... as your speed control cells go up and down so will the offset resistor by the same ratio - and therefore the ratio of shunting resistor to speed resistor will be compatible in value and not
... produce a gross mismatch in equivalent LFO speed resistances ...
... current controlled LFOs to produce tracking triangle wave oscillators with tri-sine converters at the ouput
... a comparator-flop combo to toggle to produce slight offsets in the LFO control currents when crests get close to lining up
I'm in. Can you sketch up a schematic for that? About how many ICs is that?
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Eb7+9

Quote from: moosapotamus on December 08, 2008, 04:34:01 PM
I'm looking for a way to manually set the (static) offset with a pot.

Also, sounds like a lot of components, too.

hey Charlie, good to be back ...
just survived my third motorbike accident ... dang !!

sorry, I was going by your gif and thought you wanted something automatic

if you want static control then you'll have to go with something like RG's approach since you can't perfectly null out offsets between phase-shift oscillators and keep them running in sync - unless you play with the amplitude control elements and make them electronically controllable - in the vibe that would be the diodes across the center phase shift cap ... what I'm saying here is you could have photocells across the center cap instead of diodes and delay the squeezing of the center cap on a second oscillator through a control circuit - but that's very iffy right off the bat ...

in the automatic version the built-in frequency offsets can be swamped by other residuals which you'd control ...

best regards ...