6

In the factory synth, Oki Computer, there is a portamento/glide knob. I would like to alter the instrument so that a new note (ie. the gate has closed) begins on it's default pitch rather than pulling the pitch from the previous note.

It looks like this would be done in the gate pitch > mono module:

mono module of Oki Computer

or perhaps within the gate pitch > mono > glide itself:

glide module

The portamento goes away when I remove the (highlight) cable between the GI output and the Glide GI input and am thinking maybe some kind of use of a Compare module will do the trick.

Update

First of all, I realized that I can achieve the musical goal in this case simply by manually manipulating the amount of portamento with the knob, turning it down for non-legato lines. However, I aim to make sense of the wonderful answer to this question anyway.

Based on the input from answer below, I am working on building the various version of this module. The first thing I realized is that portamento happens between the pitch input and the sound generation. So it goes:

pitch input > portamento > oscillators

There's a tutorial here by Mike Huckaby, which demonstrates putting the pitch input through a 1 pole filter, and converting the low-pass output from the filter from analog to event data, while using a control (knob) to generate the input on the 1 pole filter, which might step (as in this example) by increments of 1 between -60 and 60 Hertz (mostly below the audible range).

You get something that looks like this:

basic monophonic portamento

So I think that perhaps for the "Monophonic Legato-Only Portamento" approach it would be inserting the "Single Trigger Gate>Separator>Hold>Selector" module, something like this, but I don't know what is coming out of the selector module, how to tell what is coming out of it, or what it is supposed to feed.

Monophonic Legato-Only Portamento attempt (Selector input should be around 128, not 0.)

The AllKeyGate macro from accepted answer works nicely.

Attempting now to implement the Portamento macro that implements is, including a pitch filter:

Implementing the All Key Gate module

Not sure if I have all of the connections correctly from the image below:

Maybe the portamento module

7
  • 1
    I assume you mean that you want portamento when playing legato style and no portamento when leaving gaps between the notes? Are you using it as a monophonic or polyphonic synth? Commented Aug 31, 2019 at 21:29
  • @YourUncleBob it's monophonic. Or at least the monophonic mode of Oki Computer that I am playing with. From what you guys are saying, I am wondering if Reaktor is the wrong animal for this part.
    – MikeiLL
    Commented Sep 1, 2019 at 16:22
  • One thing I'm curious about is, is there a term to describe portamento when playing legato style and no portamento when leaving gaps between the notes?
    – MikeiLL
    Commented Sep 1, 2019 at 18:09
  • @piiperi If you build your own Single-Trigger Gate, the simple trick of temporarily setting the portamento time to zero at the start of non-legato notes seems to result in useful polyphonic legato portamento. Commented Sep 2, 2019 at 3:34
  • I deleted my comment about legato being difficult to do, because there are many different cases of monophonic and polyphonic instruments. Suffice it to say that the Single-Trigger Gate module does not work like you'd expect it to work, and you need to work around it. Commented Sep 2, 2019 at 18:46

1 Answer 1

6

For a monophonic instrument, or a polyphonic instrument with the number of voices set to one, you can use simple tricks to get legato-only portamento to work. Here's one such solution, which temporarily sets the portamento time to its minimum value at the start of non-legato notes:

Legato portamento (version 1)

You start with the Single Trigger Gate module, which creates a gate signal of all keys/voices combined, which means that it doesn't send a new key-on event when playing legato. You set both its minimum and maximum output value to 1, so that every key-on event has a value of 1 whatever the velocity is.

You then use a Separator module to filter out the key-off events, and use the key-on events to trigger a Hold module with a very short time, e.g. 1 millisecond. You then use the output of the Hold module to select between the time setting for the portamento, and a constant time value (indicated in red in the image) that is low enough so that the new pitch is reached within the 1 millisecond that you've set in the Hold module.

The end result is that whenever you play a note after a gap, the portamento time is set to its minimum setting so that the pitch jumps to the new note instantly, and then the portamento time is set back to its original setting.

Depending on how the portamento module or macro is programmed, you may have to adapt the Hold module time and the alternative low time setting for the portamento to get the desired result. If you use a 1-Pole Low-Pass Filter module on the pitch signal as portamento, then a filter pitch of 128 is high enough to jump five octaves without noticeable glide. A higher filter frequency means a shorter portamento time. So that's a number that you might use for the bottom input on the Selector module (in red, above).


The method described above also works to an extent for polyphonic instruments. You can play monophonic non-legato lines without portamento, and legato lines and chords with portamento. You can also set the Hold module time to something like 100ms, and then you can play non-legato chords without portamento.

Depending on whether you set the Voice Assign in the instrument's properties to "Newest" or "Oldest", you'll get slightly different results.

There are some anomalies, e.g. when you set a long portamento and release time, play a few notes that are still changing pitch during their release phase, and then play another note, the new note will cause all the notes to suddenly jump to their final pitch. This can be fixed with the version below, which combines the Single Trigger Gate module output with each voice's own gate signal:

Legato Portamento (version 2)

This still leaves some problems, caused by the Single Trigger Gate, which doesn't function as you'd expect when playing non-legato notes while holding down one or more keys. Of course, as always in Reaktor, we can just build our own, which behaves the way we want it to; combining Selective Note Gate modules, we can make a monophonic gate macro that keeps track of every key on the keyboard, independent of the instrument's polyphony:

All-Key Gate Octave

The above macro combines twelve Selective Note Gate modules, to keep track of the keys in one octave; combining multiple of these macros gives us a complete all-key gate:

enter image description here

If you replace the Single Trigger Gate module by the above All-Key Gate macro in the version with the combined monophonic and polyphonic Hold modules, with a hold time of around 50 ms, you have a useful polyphonic portamento. As before, setting the instrument's Voice Assign to "oldest" or "newest" will give slightly different results.


When you use the 1-Pole Low-Pass Filter module to create portamento, there is the additional complication that the Pitch signal never quite reaches its target, and all notes are slightly flat or sharp, depending on whether the pitch gradually changed from a lower or a higher note. (In an instrument which requires exact pitches, such as an FM synth with seperate portamento settings per operator, this could be problematic; in other instruments it may be less noticeable.)

This slight pitch offset depends on the filter frequency and the note number. However, if we shift the pitches to the range 128 ~ 255 before the filter and then subtract 128 again after the filter, the offsets are the same for all notes:

Filter     Note
Pitch     Offset

  48     ±0.0004    (fast)
  36     ±0.0008
  24     ±0.0016
  12     ±0.0033
   0     ±0.0065
 -12     ±0.0131
 -24     ±0.0262
 -36     ±0.0524
 -48     ±0.1048    (slow)

Below is a portamento macro which compensates this offset, to produce precise pitches. It also incorporates the legato portamento functionality, using the All-Key Gate macro described above.

Legato Portamento macro with offset compensation

It has four inputs:

  • P (Pitch) in MIDI note numbers: 0 ~ 127 (polyphonic)
  • G (Gate) note off: 0, note on: 1 ~ 127 (polyphonic)
  • T (Time) portamento time: 0 ~ 127 (monophonic)
  • H (Hold) time in ms: 0 ~ 127 (monophonic)

When the portamento time is set to 0, the filter is bypassed, to avoid any hint of portamento. When the Hold time is set to 0, portamento is applied to every note; when Hold time is set to 1, portamento is only applied to legato notes; a higher setting, around 50 or so, allows all notes in a chord to be considered non-legato, even when the keys are not pressed at exactly the same time.

The constant value 60, which is merged with the Pitch input, provides an initial key value; the first notes you play after loading or restarting the instrument will rise or fall from this note number; it can be set to any value from 0 to 127. The constant value 43 sets the time range to approximately 0.01 ~ 10 seconds for a 5-octave glide; increase or decrease this value to have shorter or longer portamento times.

The output of the portamento macro is an audio-rate signal; for the smoothest results, don't convert it to an event-rate signal, but connect it to the F (frequency) input of oscillators (with an Exponential Pitch to Frequency conversion module between them), and connect a constant value of -276.478 (which corresponds to 0 Hz) to the oscillator's P (pitch) input. Note that other pitch modulation (pitch bend wheel, LFO, envelopes, ...) should always be added to the pitch signal after the portamento.

11
  • In your first example, what is the source of the portamento module?
    – MikeiLL
    Commented Sep 1, 2019 at 23:35
  • @MikeiLL I deliberately didn't show the portamento macro, because this should work with any portamento module or macro that has an input for time or speed. The idea is simply to temporarily set the time to its lowest (or speed to its highest) value at the start of each non-legato note. Commented Sep 2, 2019 at 1:29
  • Is the all-key gate macro available somewhere in the NI user library? I think I considered such a contraption, but gave up on the idea after figuring out there would have to be 128 x something. My working solution used a poly-gate to single-trigger gate thingy, but IIRC its note tracking ability was limited by the polyphony in that instrument. So the actual instrument has to be "fake mono". Commented Sep 2, 2019 at 6:02
  • @piiperi I don't know; I enjoy tinkering and coming up with my own solutions, so I rarely look at the user library. Only the note number in the selective note gate module has to be set manually every time; the rest is just clicking duplicate. And a range of 12 - 108 is more than enough. Commented Sep 2, 2019 at 10:39
  • 2
    🏅You deserve some kind of a medal for this stuff. 🎖️ Commented Sep 4, 2019 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.