27 lines
1.3 KiB
Markdown
27 lines
1.3 KiB
Markdown
# MIDI
|
|
|
|
Cagire speaks MIDI. You can send notes, control changes, and other messages to external synthesizers, drum machines, and DAWs. You can also read incoming control change values from MIDI controllers and use them to modulate your scripts.
|
|
|
|
## Device Slots
|
|
|
|
Cagire provides four input slots and four output slots, numbered `0` through `3`. Each slot can connect to one MIDI device. By default, slot `0` is used for both input and output.
|
|
|
|
## Configuration
|
|
|
|
Configure your MIDI devices in the **Options** view. Select input and output devices for each slot. Changes take effect immediately.
|
|
|
|
## MIDI vs Audio
|
|
|
|
The audio engine (`Doux`) and MIDI are independent systems. Use `.` to emit audio commands, use `m.` to emit MIDI messages. You can use both in the same script:
|
|
|
|
```forth
|
|
saw snd c4 note 0.5 gain . ;; audio
|
|
60 note 100 velocity m. ;; MIDI
|
|
```
|
|
|
|
MIDI is useful when you want to sequence external gear, layer Cagire with hardware synths, or integrate into a larger studio setup. The audio engine is self-contained and needs no external equipment.
|
|
|
|
## Clock and Transport
|
|
|
|
Cagire can send MIDI clock and transport messages to synchronize external gear. Use `mclock` to send a single clock pulse, and `mstart`, `mstop`, `mcont` for transport control. MIDI clock requires 24 pulses per quarter note, so you need to call `mclock` at the appropriate rate for your tempo.
|