VOLTAlearn

Learn Volta / Modulation

Macros: your knobs

Expose musical controls you can perform live.

lesson 15 of 39 · about 10 minutes

Open this lesson in the workbench →

A macro is a knob you invent. Declare it once, wire it anywhere, and it appears in the rack on the left — live, MIDI-mappable, and automatable by the song.

bright = macro "bright" 0.5 declares a knob named bright, initial value 0.5, range 0–1. It's a control signal like any other.

Wire it with arithmetic: cutoff = const 400Hz + bright * 4000Hz. Drag the slider while the pattern plays — you're mixing the sound live.

One knob can drive many destinations at different depths: add + bright * 0.2 to the gain and brightness now also means louder, like a real instrument pushed harder.

A macro can carry its own motion: a third argument (macro "air" 0.4 (lfoSine @ 1/2c |> scale [0, 0.3])) sums a modulation graph on top of the knob — the knob sets the center, the LFO breathes around it.

The starting point#

The lesson opens with this song in the editor. Every edit recompiles and plays.

-- Macros: the brightness is hardcoded. Put it on a knob you can play.
keys = patch {
  source = saw (freq pitch),
  ampEnv = adsr 5ms 200ms 0.4 200ms,
  cutoff = 2400Hz,
  gain   = vel * 0.4
}

comp = play keys !"c3 eb3 g3 <bb3 c4>"

What to watch#

Turn your knob in the rack on the left while it plays — the spectrum moves under your hand, with no edit and no recompile.

Goals#

The workbench checks these as you work; the solution is there when you want it.

  1. Declare a knob
  2. Wire it into the sound
  3. Stretch: give a knob its own motion

Make it yours#

Design one "performance" knob that changes at least three things at once — cutoff up, reverb-ready gain up, attack down — so a single gesture takes the patch from asleep to awake.

Further reading#

Macros and automation in the reference.