Send CC Automation
.cc(number) on a MIDI track gives a CC lane. Send it a value, a pattern or a signal with <<.
The lane is in the MIDI reference.
Send a fixed value
Section titled “Send a fixed value”let synth = MidiTrack("synth");synth >> MidiOutput("synth");synth.cc(7) << 100;The value is sent once, and again whenever you change it.
Send a sweep
Section titled “Send a sweep”Send a signal. Its value is sent 30 times a second, and only when it changes:
use "std/signals" { Sine };
let synth = MidiTrack("synth");synth >> MidiOutput("synth");synth << [C4 E4 G4 C5];
synth.cc(74) << Sine(0.5).range(0, 127);A signal lane keeps sending with the transport stopped, like a knob on the synth would.
Send values in time with the notes
Section titled “Send values in time with the notes”Send a pattern. Each value is sent on its step, like a note, and only while the transport runs:
synth.cc(1) << [0 64 127 64];Remap one controller to another
Section titled “Remap one controller to another”A controller’s CC is a signal too, so you can pass it on under another number — here the mod wheel drives the synth’s cutoff:
use "std/signals" { Cc };
let synth = MidiTrack("synth");synth >> MidiOutput("synth");synth.cc(74) << Cc(1).range(0, 127);Send a signal more often
Section titled “Send a signal more often”.set_send_rate(hz) changes how often a signal is sent. Higher is smoother, and uses more of the port’s
bandwidth:
synth.cc(74).set_send_rate(60) << Cc(1).range(0, 127);At most one message is sent per audio buffer, about 90 per second at common settings, so a much higher rate gains nothing.
Related
Section titled “Related”- Map a Controller — read a controller’s CC as a signal
- MIDI Tracks & Time — signal lanes and pattern lanes
- Export MIDI — write CC lanes to a file