How the Electric Mistress modulates audio

Started by DrAlx, February 17, 2017, 09:02:42 AM

Previous topic - Next topic

DrAlx

I was reading a web page by ElectricDruid that examines modulation in chorus effects.

http://electricdruid.net/investigations-into-what-a-bbd-chorus-unit-really-does/

There is some nice work there, and it got me thinking about the LFO/VCO combination used in the Electric Mistress as I've always liked the modulation it produces.

For those unfamiliar with the EM circuit, its LFO produces a triangular control voltage (CV) that rises and falls at the same rate. The VCO in the EM contains a clock capacitor that is charged by a constant current source so that the capacitor voltage increases linearly in time.  When the capacitor voltage reaches the CV level, a comparator causes the capacitor to rapidly discharge.  Here is a simplified picture of voltages during the charge/discharge process for a fixed CV level.



My analysis included a fixed gap between the discharge and charge periods to account for the response time of the comparator, but it turned out to have absolutely no effect on the modulation.  I call the capacitor discharges "ticks".  A VCO period is the horizontal distance between two consecutive ticks.  Each tick triggers a flip-flop that generates the bi-phase clocks for the BBD.  Therefore each tick causes the BBD to move a sample from one stage in the delay line to the next.

So the question is "what happens to the audio signal when the CV increases linearly in time" as in the following picture?



My basic thinking was this:

    1) This particular VCO gives a BBD delay that varies linearly with CV.
    2) Therefore a linear increasing CV should give a linearly increasing BBD delay.
    3) A linearly increasing BBD delay should mimic the effect of an observer moving away from a stationary sound source at constant speed.
       Why? Because that is a situation where the time delay between the sound leaving the source and arriving at the observer increases linearly.
    4) Therefore the BBD should give a fixed downward Doppler shift to the sound.

I didn't fully trust this argument though and didn't know what the equation for the Doppler shift would be.  After reading ElectricDruid's page I was inspired to do my own analysis of how the VCO ticks in the EM are generated and how this causes the BBD to modulate audio.

I obtained a very nice mathematical result that gives the Doppler shift in terms of physical quantities in the circuit.  I don't know if this has been done before.  Here is the result.

Firstly, for an observer moving away from a stationary sound source, the classical Doppler shift is given by

     ( f_out / f_in ) = ( 1 - v / V )

where

    f_out = frequency of the sound as perceived by the observer.
    f_in  = true frequency of the sound produced by the source.
    v     = speed of the observer moving away from the source.
    V     = speed of sound in the medium.


My analysis showed that the linear CV sweep of the Electric Mistress produces a constant Doppler shift given by

      ( f_out / f_in ) = ( 1 - r / R )N

where

    f_out = frequency of the audio on leaving  the BBD
    f_in  = frequency of the audio on entering the BBD
    r     = rate of CV increase (volts per second)
    R     = rate of clock capacitor charging (volts per second).
    N     = number of BBD stages (e.g. 1024)

So the formula is saying that each delay stage contributes a Doppler shift of (1 - r/R).
Since one stage feeds into the next, the overall Doppler shift is obtained by multiplying them together.
If you look at the last picture you can get an idea of where each little Doppler shift comes from.  Between any two ticks, you have a situation where the clock cap voltage moves towards the CV at a constant "speed" of R, but the CV level is running away from it at a speed of r.

The main thing though is that the Doppler shift is constant during the EMs linearly increasing CV.  In other words, all notes entering the BBD will be downshifted by the same number of semitones throughout the sweep.  This is very nice for modulation effects like chorus.

If anyone is interested in how I got the above result read on...

===================================================

I won't write down my full derivation (a bit too much maths) but it is based on writing down the equations of the lines in the above picture and getting a recurrence relation from them.  That recurrence relation shows that the linear CV sweep causes the periods between ticks to increase geometrically (not linearly).  So if the period between the first two ticks is D, then consecutive periods will increase as follows

D
D*k
D*k2
D*k3
etc
 
where the value k is given by

k = R/(R-r)
 
where

r
is the rate at which the CV voltage rises (in volts/second).
This can be either positive or negative depending on sweep direction.

R
is the rate at which the clock capacitor voltage rises during charging (in volts/second).
It is always positive, and many orders of magnitude larger than r.

How do these geometrically increasing periods affect audio in the BBD?  We can use a 4-stage BBD as an example to find out:

To make everything easier to write down I am going to assume the BBD samples audio at its input on every tick (instead of on every other tick).  This does not affect the overall result. 

A 4-stage BBD needs 4 ticks to shift a sample from the input to the output.  Consider a sequence of sample voltage levels (a,b,c,d,e) as they enter and later leave the BBD.

Each row represents a tick of the VCO, and we can start the system time at 0 without loss of generality.  The time between ticks increases geometrically, so the system time gets incremented by larger amounts with each tick.

        in  1  2  3  out    System time
        ================    ================================   
Tick 0   a  .  .  .  .      0
Tick 1   b  a  .  .  .      D
Tick 2   c  b  a  .  .      D + D*k
Tick 3   d  c  b  a  .      D + D*k + D*k2
Tick 4   e  d  c  b  a      D + D*k + D*k2 + D*k3
Tick 5   .  e  d  c  b      D + D*k + D*k2 + D*k3 +D*k4
Tick 6   .  .  e  d  c      D + D*k + D*k2 + D*k3 +D*k4 + +D*k5


Looking at the input  column, the time period between "b" and "a" is given by  D.
Looking at the output column, the time period between "b" and "a" is given by  D*k4.

So the BBD has stretched out the time period between these two samples by a factor of  k4.
We get the exact same factor regardless of which two input samples we pick, and the samples don't even need to be adjacent.  For example:

At the input , the time between "c" and "a" is given by   D + D*k
At the output, the time between "c" and "a" is given by  D*k4 + D*k5

Again, the time period between samples has been stretched out by a factor of k4.
It should be clear that for an "N" stage BBD, all time intervals are scaled by a factor of kN.

Since time and frequency are inverse quantities, another way of saying this is that the BBD scales all frequencies by a factor of

             (f_out / f_in) = ( 1 / k )N

which when written in term of r and R gives the result.

             (f_out / f_in) = ( 1 - r/R )N


===================================================

Note that even for very large fast sweeps, the upward and downward shifts in pitch are well matched.
e.g. for N=1024 and r made large enough to give a downshift of exactly 1 octave,then flipping the sign of r (i.e. reversing direction of sweep) will give an upward pitch shift that is almost exactly 1 octave.  (It's actually slightly more than an octave, but the note is out by less than 1 cent).

All of the above applies to a linearly changing CV (as in the triangular CV variation in the original 18V EM).  Large fast sweeps on that particular flanger give a clear "ping-ponging" effect between the up-shifted and down-shifted notes.  I say ping-ponging (NOT sea-sick or warbling) because there is no noticeable sliding of pitch between the two extremes.

The 9V EM and Deluxe EM versions have a VCO that works on the same basic principle (a cap being charged at constant rate till it reaches a CV) and they have a triangular LFO also, but both those flangers low pass filter the CV.  So for fast LFO rates, the CV waveform is not triangular, and it becomes more sinusoidal looking and has a reduced CV range.
A sinusoidal CV sounds good for rapid rate modulations with low CV range.
That's about the only time a sinusoidal modulation sounds OK.  Fast sinusoidal modulations with large CV range make the pitch warble horribly.

That's one thing I prefer about the original 18V EM compared to the later versions. Some settings on Rate and Range on the later versions will warble because the CV waveform is somewhere between linear and sinusoidal. My ideal LFO for EM modulation would be to have triangular CV by default, with a separate pot that can be used to morph the CV waveform between triangular and sinusoidal without changing CV range.

===================================================

So why is it frequently mentioned that a VCO should sweep frequency exponentially?  The above EM sweeps frequency in a hyperbolic way. It is definitely NOT exponential, and yet it gives a very nice (I would argue the best) pitch-shift behaviour (i.e. uniform pitch shift across octaves, and constant pitch shift during the sweep).
A (downward) hyperbolic frequency sweep means the VCO frequency changes in time like this...

f(t) = F / ( 1 + A t )

and is equivalent to saying that the BBD delay is linearly increasing during the sweep.

Compare that to a (downward) exponential frequency sweep.  That is a sweep where the VCO frequency changes in time like this...

f(t) = F exp( - A t)

That does NOT give a constant Doppler shift during the sweep, and so is not the ideal sweep for modulation.  It is however the best sweep for a flanger doing the "jetplane" thing.  That's because with the jetplane effect you are not hearing modulated notes but rather the sweep of the flanger notches themselves, and the frequency of the lowest flanger notch is proportional to the frequency of the VCO.
________________________________________________________________
EDIT:  For a sufficiently slow sweep (i.e. small value of   A ) the exponential VCO sweep can be approximated as

f(t) = F exp( - A t)
     = F / exp( A t )
     = F / (1 + A t + (A t)2/2 + ...)   
     = F / (1 + A t + smaller terms)

and by ignoring all the smaller terms we see that the sweep is approximately hyperbolic and will therefore give almost uniform pitch shift.  For faster sweeps though, the smaller terms become significant and the Doppler shift will not be uniform through the sweep. 
________________________________________________________________

So if you want nice modulation or chorus effect, use something like an EM where the VCO gets a hyberbolic frequency sweep. (And if the required audio modulation is high rate and sufficiently low range, consider modifying the triangular CV to a sinusoid).
If you want something that does the best possible sweep for the jet-plane thing, then use a flanger where the VCO gets an exponential frequency sweep.





armdnrdy

I just designed a new fuzz circuit! It almost sounds a little different than the last fifty fuzz circuits I designed! ;)