How portamento works: a slew limiter
A slew limiter makes a stepped pitch voltage glide: a resistor fills a capacitor, and an op-amp buffer copies it. With 100 kΩ and 1 µF, each step goes 63% of the way in 100 ms and 99% in 0.46 s, so an octave slides instead of jumping.
circuit Slew setting input: 0.5 V, from 0.1 V to 1 V setting glide: 100k, from 1k to 1M R1 in a glide C1 a gnd 1u U1 a out out opampendPress Play to see the wave after the circuit, at out.
What you're hearing
A capacitor can't jump, so the voltage glides. A keyboard or sequencer sends pitch as a voltage, usually 1 V per octave, and it changes in steps: one voltage per note. Here a square wave plays that part: −0.5 V, then +0.5 V, two notes an octave apart, a new one every 0.5 s. It reaches C1, 1 µF, through R1, the glide knob. A capacitor's voltage can only change as current fills it, and the current through R1 is the gap between the input and the capacitor, divided by R1. So the voltage moves fast at first and slows as it closes in. U1, an op-amp buffer, copies C1's voltage to the output without draining it (see the op-amp's two rules). Here you hear the output glide an oscillator's pitch, 1 V an octave: from A2 to A3 and back.
The glide time is RC, per 63%. The time constant is R1 × C1 = 100 kΩ × 1 µF = 0.1 s. In that time the output covers 63% of the step. After two time constants it's 86.5% of the way, after three 95%, and after 4.6, 99%: 461 ms. The glide knob turns R1, so it scales every one of those times:
| glide (R1) | 63% of the way | 99% of the way |
|---|---|---|
| 1 kΩ | 1.0 ms | 4.6 ms |
| 22 kΩ | 22 ms | 101 ms |
| 100 kΩ | 100 ms | 461 ms |
| 220 kΩ | 220 ms | 1.01 s |
In pitch terms: an octave in about a quarter of a second. At 1 V per octave, 1% of a volt is 12 cents. At 100 kΩ, an octave's step has covered 7.6 semitones after 100 ms, comes within a semitone of the new note after 248 ms (RC × ln 12), and within 12 cents after 461 ms. The time to get 99% of the way is the same for any step: a fifth and two octaves both take 461 ms. Play faster than the glide and it never arrives. With "Long glide" at 220 kΩ, it has covered only 90% of a step when the next one comes, and it settles into a swing of 0.81 V: about 10 semitones instead of 12.
Different up and down: two diodes, two resistors. For a slow rise and a quick fall, the current up goes one way and the current down another: up through a diode and R1, 220 kΩ, down through the other diode and R2, 22 kΩ. A diode on its own would spoil it. It needs about 0.6 V across it before it conducts much, so the glide would stall well short of the note: with plain 1N4148s, it has covered 66% of the octave after half a second, and only 83% after one and a half. So in "Slow up, quick down" each diode sits inside an op-amp's feedback, U2 for the way up and U3 for the way down. The op-amp lifts its output by whatever the diode drops, so the resistor sees the input's full voltage: the precision diode. Now the rise takes 220 ms to 63% and 1.00 s to 99%, the fall 22 ms and 101 ms, and it lands within 5 µV of the note. At a step every 0.5 s, it gets 90% of the way up and all the way down.
Constant rate: a comparator and an integrator. The RC glide is exponential: quick, then slow. Some glides move at a steady rate instead. In "Constant rate", U2 compares the input with the output and swings to its rail, 10 V, whichever way the output has to go. R1 then feeds that fixed voltage into C1, now 10 µF around U3, an integrator, so the voltage ramps in a straight line at 10 V / (100 kΩ × 10 µF) = 10 V per second, and U1 turns it the right way up. An octave takes 99 ms: half of it at 50 ms, all but 1% at 99 ms. Two octaves take twice as long, 198 ms, where the RC glide takes the same time for any step. U2 lets go of its rail only within about 1 mV of the note, so the ramp runs straight almost to the end.
To a sound, it's a very low low-pass filter. It's the RC filter with a buffer, its corner at 1/(2π × 100 kΩ × 1 µF) = 1.6 Hz, so anything faster than a slow wobble is smoothed away. Many glide circuits are exactly this. It isn't the same thing as an op-amp's slew rate, the fastest a real op-amp's output can move: volts per microsecond, where this glide moves volts per second. The op-amps here are ideal, and C1 holds its charge perfectly; a real capacitor this size leaks a little, which barely matters when it's refilled every note.
Try this
- Turn glide from 1k to 1M while it plays. At 1 kΩ the pitch jumps; at 1 MΩ it covers only about a quarter of the octave before the next note pulls it back.
- Turn input from 0.5 V to 1 V: two octaves. The RC glide still takes 461 ms to get 99% of the way. Press "Constant rate" and it takes 198 ms, twice the octave's 99 ms.
- Press "Slow up, quick down". The pitch swoops up and snaps back down. Open it in SynthMaker to change the parts: swap R2's 22k for 220k, and it's symmetric again.
The parts list
circuit Slew setting input: 0.5 V, from 0.1 V to 1 V setting glide: 100k, from 1k to 1M R1 in a glide C1 a gnd 1u U1 a out out opampendWire a pitch voltage, or a square LFO, into it. For the slow rise and quick fall, replace R1 in a glide with:
U2 in ku du opamp rails 12V D1 du ku 1N4148 R1 ku a glide U3 in kd dd opamp rails 12V D2 kd dd 1N4148 R2 kd a 22kFor the constant rate, replace R1, C1 and U1 with:
U2 in n c opamp rails 10V Rf c n 10M Rn n out 1k R1 c a glide C1 a b 10u Rl a b 100M U3 gnd a b opamp Ri b m 10k Rm m out 10k U1 gnd m out opampRl gives the integrator a path for steady current, so it has a resting point; at 100 MΩ it changes nothing you can hear.
How we checked it
Checked against ngspice, a standard circuit simulator: the plain glide is exact, and the slow-up, quick-down version follows ngspice within 0.01% over a 1 Hz square. Measured in SynthMaker, 100 kΩ and 1 µF reach 63% in 100.0 ms and 99% in 460 ms, and the constant-rate version ramps at exactly 10 V per second.
Build it step by step
- The circuit format: Start a circuit, for writing resistors, capacitors, diodes and op-amps in a parts list.
- The same two parts, as a tone control: How an RC filter works.
Further reading
- What portamento is, on instruments and voices: Wikipedia: Portamento.
- How a capacitor charges through a resistor, and the 63% rule: Wikipedia: RC time constant.
- Pitch as 1 V per octave, and how a keyboard's voltages reach an oscillator: Wikipedia: CV/gate.
- How an op-amp hides a diode's drop: Wikipedia: Precision rectifier.
- How a fixed voltage into an integrator makes a straight ramp: Wikipedia: Op amp integrator.
- Why a buffer doesn't drain what it copies: Wikipedia: Buffer amplifier.
- How SynthMaker simulates a circuit: M. Holters and U. Zölzer, "A Generalized Method for the Derivation of Non-Linear State-Space Models from Circuit Schematics", EUSIPCO 2015. PDF