Stabilizing the Model


Tutorial home




This model has an unfortunate characteristic:  it has a tendency to squawk, and play harmonics of the pipe length.  Since this is a synthesizer, after all, maybe that’s a cool thing.  Still, it would be good to be able to tame it.




The symptom


Try loading the reed patch on the “Legato Phrasing” page.  Play a note, release it, and then play another note one or two octaves lower than the original.  Repeat this a few times, and the problem becomes clear:  if a low-pitched note is played after a high-pitched one, the patch plays a harmonic of the low-pitched note, instead of the fundamental.


Try a legato version of the same test.  Play a note, and before releasing it, play another note one or two octaves lower than the original.  The same thing tends to happen.


Notice that the problem doesn’t happen if the note intervals are small, about 7 semitones or less.




The explanation


The pipe-switching legato logic is part of the problem.  Every time we play a note, that note actually begins life as the previous note, and is crossfaded into the current note over a few milliseconds.  The purpose is to eliminate clicks between.  A side effect (at least on this patch) is that if the pitch of the previous note is close to a harmonic of the new note, the model stabilizes on a harmonic of the new note, not the fundamental.




The solution


The solution will be in two parts:


  1. We’ll turn off the legato-switching logic, unless we’re actually playing legato.  That is, if we play a staccato passage on the keyboard, we’ll never switch from one pipe to another.  This will eliminate those initial confusing milliseconds when the model is told to crossfade from one pitch to another.  Instead, we’ll start off each note immediately at the desired pitch.


  1. But we still want the legato-switching logic to work when we’re playing legato.  So what should we do when we come upon a legitimate two-octave interval when playing legato?  We’ll do this:  detect large intervals, and momentarily stop the flow of air in the pipe while the crossfader is switching.  After the crossfader has stopped, we’ll let the air through again.  This will create a momentary drop in the sound level, but it’s still better than squawking.  And we’ll only do it if the note interval is large.




Part 1 of the solution


Turning off the legato-switching logic doesn’t seem too hard:  it’s just triggered by a rising edge at the Clk input of a flip-flop.  Since the Clk input has been connected directly to the keyboard gate, we’ve been switching pipes at every note.  Now, we only want to trigger the flip-flop if we detect a legato transition.  That is, if we play a note when another note is still held down.


Unfortunately, that’s not as easy as it sounds.  The G2 doesn’t have a module that creates a signal like this.  But we can make one.  Below is a patch fragment that will create a short pulse only during a legato transition.  It triggers an oscillator/envelope so you can hear when the pulse is created.





This patch fragment does three things:


  1. Creates a 1 millisecond pulse from the Keyboard module’s Gate output.
  2. Delays the Keyboard module’s Gate output by 2 milliseconds, and also stretches it by two milliseconds.
  3. ANDs these two together.


The result is a 1 millisecond pulse during each legato transition. 




Part 2 of the solution


Detecting a large note interval (and triggering an envelope generator) can be done in the following steps:


  1. Begin with the Note output of the Keyboard module.
  2. Send it through a short delay (a signal delay, not a logic delay).
  3. Subtract the delayed signal from the original.  This will create a short pulse when a note is changed.  The height (or depth) of the pulse is the note interval.
  4. Rectify the pulse so that it’s always positive.
  5. If the pulse is high enough (detected via a Compare module), trigger the envelope generator.


Below is a patch fragment that will create a short pulse only when a note transition is an octave or more.  It triggers an oscillator/envelope so you can hear when the pulse is created.





Adding it all up


Below is a patch that combines these two methods to stabilize the model.



This has been a lot of work.  Fortunately, this is the only model that requires this much care.