[ ? ] Continuously variable phase LFO?

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

Previous topic - Next topic

ashcat_lt

You guys are way above my head, but I don't think anybody's mentioned this in this thread.

According to this (right around the first graph) "any phase-shifted sine wave can be expressed as the combination of its sine and cosine components with a specific amplitude relationship".  This should mean that if you've got a way to consistently shift the LFO 90 degrees, you'd ought to be able to make the rest happen with some form of mixer.  You'll split the LFO three ways.  Leave the first alone.  Take the second, shift 90 degrees and mix it with the third.  Your "relative phase knob" controls the proportions of this mix.

TELEFUNKON

Quote from: R.G. on December 11, 2008, 08:01:28 PM
I also had a run at the straighforward thing - simple phase shift stages. I had thought they'd run out of shift, and two stages was marginal for a 1Hz to a 5Hz range of LFO, but you can indeed get close to 180 degrees over that range with the allpass stages. I used Rf=Rin=10K, Cp=1uF and Rphase =100K.

A quad pot would just about sew that one up  :icon_biggrin: if you could find one. A dual 100K works OK-ish. Probably a variable duty cycle switched-resistor would be best, but then you gotta do a PWM and three or four resistor switches.

The phase shifts as the frequency changes, of course. But at a single frequency it's maybe OK for tinkering.

see reply#8.

TELEFUNKON

Quote from: ashcat_lt on December 13, 2008, 12:43:23 AM
You guys are way above my head, but I don't think anybody's mentioned this in this thread.

According to this (right around the first graph) "any phase-shifted sine wave can be expressed as the combination of its sine and cosine components with a specific amplitude relationship".  This should mean that if you've got a way to consistently shift the LFO 90 degrees, you'd ought to be able to make the rest happen with some form of mixer.  You'll split the LFO three ways.  Leave the first alone.  Take the second, shift 90 degrees and mix it with the third.  Your "relative phase knob" controls the proportions of this mix.

see replies #21, #24

gez

#43
Quote from: R.G. on December 12, 2008, 07:24:56 PM
Hey, I think you could do the same PWM thing on the duty cycling resistors. Imagine:

(1) a PWM setup using two inverters. This is set to run at, say 32kHz, and give a duty cycle between 1% and 99%. It's fixed frequency and only provides a pwm signal.
(2) a second PWM setup with the other three inverters. This is the low speed one. It's the same as the high speed one except that there are two CD4066 gates in series with the diodes. The 4066 gates are run from the high speed PWM; they are in series with each end of the PWM pot on the low speed setup.

The high speed PWM makes a "resistor multiplier" out of the 4066 gates and the ends of the low speed PWM pot. The high speed PWM pot is then a frequency control - it smoothly varies the apparent resistance of the low speed PWM pot. The output of the low speed PWM is the same as it was, two antiphase, inverse-duty-cycle rectangle waves. These drive the flipflops you mentioned and now you have one-pot variation of speed and one-pot variation of phase angle.

From there, you can PLL a sine/triangle generator to the two outputs and have your single pot, 0-360 phase slide on a sine LFO.

Chip count:
1 - CD4049
1 - CD4066
1 - CD4013

That's clever, RG, and would have a reasonably low component count.

There are a number of ways of doing the PWM.  It all seems to be swings and roundabouts, though.  I was thinking of doing a variation of the Andy Flind circuit found in Practical Oscillator Circuits.  Use half a 7556 as a Schmidt trigger and use an op-amp integrator in conjunction with it to form a triangle oscillator.  The bias on the + input of the op-amp could be shifted up/down using a pot (and stop resistors either side) across the rails.  This would vary duty cycle, but frequency remains the same as the Schmidt's trigger thresholds remain fixed.  I think Telefunkon was alluding to something like this in an earlier post (adding a voltage to the 'threshold' of the integrator?)  The other half of the 7556 inverts the PWM square and both squares are sent to the flip-flops.  Would be trickier getting the full range of PWM without latching the LFO, though.  Would either have to put up with latching in extreme positions of the pot, or pull in the range of PWM slightly.  All swings and roundabouts...

Anyway, total parts count would be:

1 - op-amp (if dual, the other half could be used as a ref voltage to divide down the square for more linear freqency control)
2 - 7556
3 - 4013

Slightly less PCB space taken up and not much in the way of resistors and caps.

From there, your idea of PLLs and wave generators could be used.  Surely some form of divider/counter chip would have to be used in conjunction with the PLL, though?  low parts count, but a lot of the 'parts' are chips (board space is growing by the minute!)  :icon_smile:
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

TELEFUNKON

#44
No, Gez, it was not about PWM, but rather about some synth sawtooth VCO
and deriving varying phaseshifted triangles therefrom by mirroring part of the saw 
across a controllable DC voltage "line".
It does have something in common with the PWM-stuff though, on second thought  ???

BTW.: interesting history-bit about Mr. TRIGGER !

Paul Perry (Frostwave)

Thanks for that link to the history of Mr trigger, Telefunkon! Best reading for ages! Truly there were giants in those days...

TELEFUNKON

You`re most welcome, Mr. Perry!

`t took me a long time to finally find out if it were Schmidt or rather Schmitt, that was correct.
Both spellings can be found over the past decades (as you know) - and I definitely wanted to know which one was the right one.
So finally that link luckily showed up last year.  :icon_smile:

What a biography!

gez

The idea I outlined in my last post caused frequency changes.  Had to resort to pot-and-diodes:



In theory, the 4k7 resistor limits PWM.  In practice it doesn't make a jot of difference.  It was necessary in order to preserve the virtual earth effect when the phase pot (the 470K - sorry, forgot to label it) is at its extremes.  Without it, there was a sudden decrease in frequency.

The above circuit gives you two square waves of 50:50 duty cycle.  The pot and diode trick gives a huge range of PWM, so the square waves go from as-good-as totally in sync, to as-good-as 360 degrees out-of-phase (you can barely tell on the scope: they look in sync).

Square waves aren't much use to you on their own.  Adding inverters biased for unity gain will round the corners off somewhat, but there'll still be sharp rise/fall times before rounding, and this will probably cause tick.  LDRs will help, in that they'll distort/slow down the transitions, or you could add another dual op-amp to convert the squares into trapezoid.  Would get rid of tick and give you choppy trem/filter action (not that musical for filters).

RG's suggestion of using PLLs and wave generator chips will give you the most options, but is an added layer of complexity.  If your flip-flops are OK with being clocked by inverters (mine won't work with them), then his inverter chip idea is also worth considering.  Whichever way you go, the above circuit might at least help you evaluate if this whole idea is worth persuing (doesn't take much to breadboard).

PS  Many op-amps should be OK.  Helps if they have symmetrical swing at the output.

"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

R.G.

Quote from: gez on December 13, 2008, 04:00:54 AM
There are a number of ways of doing the PWM.  It all seems to be swings and roundabouts, though.  I was thinking of doing a variation of the Andy Flind circuit found in Practical Oscillator Circuits.  Use half a 7556 as a Schmidt trigger and use an op-amp integrator in conjunction with it to form a triangle oscillator.  The bias on the + input of the op-amp could be shifted up/down using a pot (and stop resistors either side) across the rails.  This would vary duty cycle, but frequency remains the same as the Schmidt's trigger thresholds remain fixed.  I think Telefunkon was alluding to something like this in an earlier post (adding a voltage to the 'threshold' of the integrator?)  The other half of the 7556 inverts the PWM square and both squares are sent to the flip-flops.  Would be trickier getting the full range of PWM without latching the LFO, though.  Would either have to put up with latching in extreme positions of the pot, or pull in the range of PWM slightly.  All swings and roundabouts...

Anyway, total parts count would be:

1 - op-amp (if dual, the other half could be used as a ref voltage to divide down the square for more linear freqency control)
2 - 7556
3 - 4013

Slightly less PCB space taken up and not much in the way of resistors and caps.
That's a good one!
Quote
From there, your idea of PLLs and wave generators could be used.  Surely some form of divider/counter chip would have to be used in conjunction with the PLL, though?  low parts count, but a lot of the 'parts' are chips (board space is growing by the minute!) 
Actually, it's important that the PLL not do a bunch of multiplication/division. The phase shift you're looking for is tied to the phase shifted square waves. If you multiply or divide in the PLL, the resulting sine runs at the frequency of the VCO, and the phase shift is lost. It needs to run at unity. Which makes me remember - you'll probably have to go active on the phase detector integrator to get a low enough time constant for the filter.

It's always something.  :icon_frown:


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

Quote from: R.G. on December 13, 2008, 10:15:38 AM
That's a good one!

No it's not!  I just realised that once the flip-flops divide down both squares, there's only a Max shift of 180 degrees.  I had one of those 'hang on!' moments when I was remembering the scope patterns.  A few sketches of the waveforms on the back of some scrap paper confirms this. 

In short, AGHHHHHHH!

Was that the sound of a (UK) towel being thrown in?  I think so...[reaches for revolver in desk]
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

R.G.

Put the revolver back into the desk. 0 to 180 is almost as good as 0 to 360. If one insists on 0 to 360, one can invert one waveform at 180 and then get the 180 to 360 side of things.
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

...or use a couple of PLLs instead of flip-flops, to square up both outputs. (I was out of bullets)
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

puretube

#52
Quote from: R.G. on December 09, 2008, 10:21:02 PM
Quote from: puretube on December 09, 2008, 07:33:00 PM
Quote from: R.G. on December 09, 2008, 07:19:17 PM
Quote from: puretube on December 09, 2008, 07:06:40 PM
Quadrature analog multiplication...
= quadrature LFO into VCAs (e.g.: LM13700);
See first reply.
analog, not µC...  :icon_wink:
See first reply.


uC was topic 1, analog trig games mixing quadrature LFOs was topic two.
See first reply.  :icon_wink:

OOps :icon_redface:, sorry R.G., the mentioning of "three-phase" and "electrical power class" in that reply distracted my attention;
(since I prefer the 4 phases over the 3 for my purposes...).

On the other hand (cc.: quad-LFO into OTA-VCA [LM13700] ) is not just a " believe"-thing, but actually works proven well in practice,
and especially nice and effective when going into 4-quadrant modulators.

bytheway: your mentioning of the problems in the fortyfiver cc. the gain,
is the same as in (m-)any of the common/wellknown feedbackoscillators (mostly seen in Wienbridge configurations),
and can easily be dealt with by the use of some (simple) kind of AGC...
(but the aim of that special 45er was the fun of using tiny quad-SMD-components and thus making it low-part-count  :icon_smile:).

R.G.

Quote from: puretube on December 13, 2008, 04:23:08 PM
OOps :icon_redface:, sorry R.G., the mentioning of "three-phase" and "electrical power class" in that reply distracted my attention;
(since I prefer the 4 phases over the 3 for my purposes...).
No problem at all. Four phase is actually slicker for many purposes.

One odd thing I remember from my AC power and motors courses is that you can transmute ANY multiphase power into any other multiphase setup with the appropriate set of transformers.  :icon_eek: Shocked me. Three-phase to quadrature was on the final...

QuoteOn the other hand (cc.: quad-LFO into OTA-VCA [LM13700] ) is not just a " believe"-thing, but actually works proven well in practice,
and especially nice and effective when going into 4-quadrant modulators.
No, it's not at all make believe. I spent some time messing with I-Q modulators and dome filters; these are the generalization of multiphase to modulated signal, and are the basis of most modern radio practice.

Quotebytheway: your mentioning of the problems in the fortyfiver cc. the gain,
is the same as in (m-)any of the common/wellknown feedbackoscillators (mostly seen in Wienbridge configurations),
and can easily be dealt with by the use of some (simple) kind of AGC...
(but the aim of that special 45er was the fun of using tiny quad-SMD-components and thus making it low-part-count  :icon_smile:).
I understand. My only point was that it had some problems for the one app at hand. And having both the true and inverted versions of the waveforms available means you can use four two-quadrant multipliers instead of two four-quadrant multipliers - I think.

The simple and straightforward version as shown has all the gain lumped at one place in the chain. That means that the loss in signal is distributed in each stage. The 45-er would be perfect if you could get the gain *and* lossed distributed into each stage. That would keep all the waveforms the same size and make it easier to do the kinds of mixing needed for variable phase results. The all-opamps version does this by making all the losses just about nil. Another way, even simpler, is to use the 45er as is, but put a resistor divider on each stage to make the higher-output stages be the same as the lowest output stage. Probably work just as well.
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

#54
that's a lot of work for getting a square wave which can't be used to modulate filter control or BBD timing ... and, can't you just use a triangle LFO, variable threshold comparators and a couple of flops to get the same output ??

this raises the question again, what is it exactly that you want to modulate Charlie ?

my optical PLL uses 6 op-amps (2 as followers, 4 as comparators), 4 bjt's, 2 jFets, 2 D flops, 2 NOR gates, 2 opto-couplers and two phase shift sine oscillators (2 bjt's each) ... as the problem started out it puts out two synched up sine waves using a Hogge detecto - locked at zero degrees +/- offset, and not 90 - with a phase range of +/- pi ... this is std for PLL's with a Hogge front end ... the phase offset is controllable through application of an offset current on the averaging cap as mentioned - PLL's do not auto-correct phase-offsets as was claimed by RG otherwise there wouldn't be all this research put into finding ways to null them out ... also, the circuit as I have it will work on a single 9volt source ... the 5v TTL circuits work easily within the 9volt environment using simple diode shifting on the logic IC's and is adjusted according to the output swing of the op-amps - so no exotics op-amps necessary here ...

one cool application of this optical PLL is in a producing over-damped/under-damped speed-up/slow-down speed adjustment responses of sinewave LFO's - this depending on loop gain settings and filter bandwidth in the optical PLL ... but a lot of work just for that ...

what's the deal Charlie ??

gez

Quote from: Eb7+9 on December 14, 2008, 12:34:00 AM
that's a lot of work for getting a square wave which can't be used to modulate filter control or BBD timing

That has continuously been pointed out to Charlie.  It's a hack way of doing things; but possibly a way of evaluating whether it's worth persuing a better way of doing this (spending a few months learning PIC programming).  Also, Charlie did say that other types of wave forms would do, including square.


Quoteand, can't you just use a triangle LFO, variable threshold comparators and a couple of flops to get the same output ??

Sure, but (as I've mentioned in a few of my posts above) not all flip-flops play game and need sharp rise/fall times in order to be clocked.  All the UK suppliers I use send me ST flip-flop chips.  They're a pain in the backside and won't clock using humble op-amps/inverters etc.  To get them to work usually involves the addition of Schmitt trigger devices, hence the inclusion of a 7556 in my schematic.  Bearing in mind others might have this problem, it's wise to include Schmitt trigs in the design.  Now tot up the part count of your idea.  Dual op-amp for the triangle, a comparator or two plus pot(s?) for threshold control, flip flop, Schmitt trigger chip to get the flip-flops to work (best to be on the safe side)...not much in it, is there?  Possibly a higher parts count, even.

Your idea of varying the thresholds is the first thing I came up with when thinking of a way of making that Quad oscillator I posted variable.  It could possibly be done very easily - a pot and resistor is all that's needed - but would only give a 90 degree phase shift.  That could be inverted and then both inversions could be compared with an inversion of the original triangle (180 degrees out-of-phase) and I think that would cover the whole range.  I'd need to sketch wave forms on some scrap paper to be sure.  Not what was required though - 4 way rotary switch and a pot isn't as sexy as a single pot.

Quote from: Eb7+9 on December 14, 2008, 12:34:00 AM
this raises the question again, what is it exactly that you want to modulate Charlie ?

He's outlined what he wants in a previous post.  I pointed out (when I posted it) that the variable phase square wave schematic isn't that suitable.  The quad LFO I posted might be a good compromise, though.  OK, not variable, but at least you get a few more positions (as the actress said to the Bishop)...
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

gez

Charlie, just remembered this circuit once posted by Marcos (from an old magazine):



It uses a square wave LFO, then (crudely) shapes it into something resembling a triangle to drive a simple T-filter.  Not perfect as amplitude of the modulating waveform reduces with increased frequency.  With a limited range, though, it works surprisingly well (I once breadboarded it).  I'm not suggesting for one moment that you build this (it's too primitive), but it's a quick and easy circuit to breadboard along with what I posted (or something similar) to assess whether your idea is at least worth persuing.  You could do something along similar lines for your tremolo.  Everything immediately underneath, and to the right, of pin 11 would be used.  Just a thought...

"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

slacker

Probably won't work, but how about taking your variable phase square waves and feeding them into  Johnson counters with the outputs summed like shown here or over at Geo to get stepped triangle waves. Filter the crap out of them or use them to drive LED/LDR combos and at tremolo speeds they might get smooth enough.



R.G.

Quote from: Eb7+9 on December 14, 2008, 12:34:00 AM
PLL's do not auto-correct phase-offsets as was claimed by RG otherwise there wouldn't be all this research put into finding ways to null them out ... also, the circuit as I have it will work on a single 9volt source ... the 5v TTL circuits work easily within the 9volt environment using simple diode shifting on the logic IC's and is adjusted according to the output swing of the op-amps - so no exotics op-amps necessary here ...
I always like it when I have to go think about something.  :icon_biggrin:

Let's do the logic stuff first: CMOS runs well at 9V, no 5V needed, and are plenty fast enough for sampling on a 10Hz circuit, I think. So no need for 5V logic. But in many instances LFOs will need either their input or output or both to go to either ground, or the power supply or both. Rail to rail input and output opamps are not particularly 'exotic', just less common that most jellybean opamps. But back to PLLs.

My earlier comments weren't really a "claim". I went out and did some quick research before posting and also some simulation. There is indeed an error signal in PLL output phases, which differs depending on what kind of phase detector is used. The actual resulting phase error between perfect lock and actual output in a PLL is an error signal, and there is a great amount of work spent trying to find ways to null them out. But the errors are small compared to the entire cycle to start with, nothing like a selectable 0-360 degree phase difference. My "claims" were pretty much rephrasing the words out of a couple of sources I found in Wikipedia.

I did a lot of looking for a phase detector where you could inject an error to force the phase of the output signal to be at a fixed offset, and didn't find anything, which matched with what I was taught about PLLs; I did this because I was mindful that new things are invented all the time. Didn't find anything. I did find a lot of things which said for a given phase detector that the offset was pi/2 or 0 degrees in lock, the implication being that the phase detector drove the residual error to as small as it could.

Beyond that, a PLL is a feedback system. The error in a PLL is analogous to the error in an opamp or other feedback system. The output is equal to the input error times the open loop gain minus the feedback factor loss. That is - small compared to the input or output. In fact I found a lot of math on PLLs where the phase error at the output was described as proportional to 1/(Kp*Kf), the funny K factors being the forward gain of the loop and phase detectors. The point of that is that the loop gain drives the sensed phase error toward zero.

And that opens a window to getting a static offset phase in a PLL - lower the loop gain, because the higher the loop gain the lower the error until it goes unstable.

So I thought, OK, let's just try it. I fired up the circuit simulator and started prototyping PLLs. Had a fun couple of hours.  :icon_biggrin:  What I found was that nothing I could simulate would give me a stable, useful phase offset; this included multiplier, XOR, and latched phase detectors, as well as hacking on PDs with variable resistors, current sources, etc. Low loop gains give you some offset, but the odd thing was that there was always a falling-off-the-cliff point; back to the books. Phase detectors have this input/output graph that's commonly presented to show their behavior. There's a discontinuity and loss of lock at the extremes, which correspond to where one would want to operate a phase offset PLL. So you have to run at low gain (implying slow lock, and small capture range) as well as easy loss of lock even if you got

I always keep in mind that I may be wrong or ignorant of something, though. So I went off to look up Hogge detectors (invented 1985, long after my intro to PLLs) and I did find one reference to a Hogge detector with an output that offers some output of phase with respect to the reference signal. It's in US patent 7151814, and I found it here: http://www.google.com/patents?id=Akx-AAAAEBAJ&printsec=abstract&zoom=4&dq=patent:7151814&as_drrb_ap=q&as_minm_ap=1&as_miny_ap=2008&as_maxm_ap=1&as_maxy_ap=2008&as_drrb_is=q&as_minm_is=1&as_miny_is=2008&as_maxm_is=1&as_maxy_is=2008#PPA9,M1  I'm having trouble relating this to a usable PD for the application at hand.

It is entirely possible that there is something hidden there that I don't know. So let's do this JC - post a source for the info on a variable Hogge detector output, as I have. I'm sure you must have done your research before posting, as I did.  You may also want to post your proposed circuit in the interest of being clear.
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.

R.G.

#59
Quote from: slacker on December 14, 2008, 10:18:01 AM
Probably won't work, but how about taking your variable phase square waves and feeding them into  Johnson counters with the outputs summed like shown here or over at Geo to get stepped triangle waves. Filter the crap out of them or use them to drive LED/LDR combos and at tremolo speeds they might get smooth enough.
I tried to make something out of that one, as the Johnson counter sine wave converter is a favorite of mine. I think it will be severely limited in the amount of phase shift, because each of the output square waves is offset by no more than one period of the square waves. Since that's the clock into the Johnson counters, the offset is no more than one of the original periods per Johnson clock, and that results in a phase shift of 2*pi/N where N is the number of stages in the Johnson counter. I think the counter "dilutes" the phase shift by the number of stages.

But the Johnson counter does make for a nice sine source.

Upon some thought I did come up with a workable solution for that - use a CD4046 PLL to multiply the phase shifted square waves by N. Drive the Johnson counter with the Nx output, then use the highest order bit of the Johnson counter as the output frequency to mix back into the PD. PD2 in the 4046 drives the phase difference between the reference (original square wave) and VCO output (in this case, one output of the Johnson counter) to zero degrees in lock. Since the phase of the output square wave is locked to the phase of the high order bit, the output stepped sine is now locked to the input reference square wave, and it follows the offset as long as the loop is locked.
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.