<h1 align="center">Cagire</h1>

<p align="center"><em>A Forth-based live coding sequencer</em></p>

<p align="center">
  <img src="assets/Cagire.png" alt="Cagire" width="256">
</p>

<p align="center">
  <a href="https://cagire.raphaelforment.fr">Website</a> &middot;
  <a href="https://github.com/Bubobubobubobubo/cagire">GitHub</a> &middot;
  AGPL-3.0
</p>

Cagire is a terminal-based step sequencer for live coding music. Each step in a pattern contains a **Forth** script that gets evaluated at the right time, producing sound and events. It ships with a self-contained audio engine — no external software needed.

### Examples

A filtered sawtooth with reverb:

```forth
saw sound 200 199 freq 400 lpf .8 lpq .3 verb .
```

A generative pattern using randomness, scales, and effects:

```forth
sine sound 2 fm 0.5 fmh
0 7 rand minor 50 + note
.1 .8 rrand cutoff
1 4 irand 10 * delay .5 delayfb
.
```

### Features

- **Cagire's Forth**: a stack-based DSL specialized for live coding
  - Concise and light syntax, every step is a short script. Forth has almost no syntax, only words and numbers.
  - Nondeterminism: randomness, probabilities, patterns as first-class operations.
  - Quotations: code blocks `( ... )` that compose with probability, cycling, euclidean, and conditional words.
  - User-defined words: extend the language on the fly with `:name ... ;` definitions.
  - Interactive documentation: built-in tutorials with runnable examples.
- **Audio engine** (powered by [Doux](https://doux.livecoding.fr)):
  - Synthesis: classic waveforms (saw, pulse, tri, sine), additive, FM (2-op, 3 algorithms), additive synthesis, wavetables, 7-voice spread, Mutable Instruments Plaits models: modal, granular, waveshaping, chord, swarm, etc.
  - Drum models: kick, snare, hat, tom, rim, cowbell, cymbal with timbral morphing.
  - Sampling: disk-loaded samples with slicing, pitch tracking, wavetable mode, and live recording from engine output or line input.
  - Filters: biquad LP/HP/BP and ladder filters, each with independent envelope.
  - Effects: phaser, flanger, chorus, smear, distortion, wavefolder, wavewrapper, bitcrusher, sample-rate reduction, 3-band EQ, tilt EQ, Haas stereo.
  - Bus effects: delay (standard, ping-pong, tape, multitap), two reverb engines (Dattorro plate, Vital Space), comb filter, feedback delay with LFO, sidechain compressor.
  - Modulation: vibrato, AM, ring mod, pitch envelope, FM envelope, glide — all with selectable LFO shapes (sine, tri, saw, square, sample & hold).
- **Sequencing**: probabilities, patterns, euclidean structures, sub-step timing, pattern chaining and a lot more.
- **MIDI**: receive or send MIDI messages across up to 4 inputs and 4 outputs.
- **Ableton Link**: tempo and phase sync with any Link-enabled software or hardware.
- **Cross-platform**: terminal and desktop interfaces on macOS, Linux, and Windows.
- **Plugins**: run Cagire as a CLAP or VST3 plugin inside your DAW (separate version).

### Getting started

Download the latest release for your platform from the [website](https://cagire.raphaelforment.fr).

To build from source instead, see [BUILDING.md](BUILDING.md).

### Documentation

Cagire includes interactive documentation with runnable code examples. Press **F1** in the application to open it.

- [Website](https://cagire.raphaelforment.fr)
- [BUILDING.md](BUILDING.md) — build instructions and CLI flags
- [CHANGELOG.md](CHANGELOG.md)

### Credits

Cagire is developed by [BuboBubo](https://raphaelforment.fr) (Raphael Forment).

- **[Doux](https://doux.livecoding.fr)** (audio engine) — Rust port of Dough, originally written in C by Felix Roos
- **mi-plaits-dsp-rs** — Rust port of Mutable Instruments Plaits DSP by Oliver Rockstedt, original code by Emilie Gillet

### License

[AGPL-3.0](LICENSE)
