<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://git.raphaelforment.fr/BuboBubo/cagire">Gitea</a> &middot;
  AGPL-3.0
</p>

Cagire is a terminal based step sequencer and live coding platform. Each step in a sequence is represented by a **Forth** script. It ships with a self-contained audio engine. No external software is needed, Cagire is a fully autonomous musical instrument that provides everything you need to perform.

### 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 language made for live coding
  - Forth has almost no syntax, only words, numbers and spaces. Very easy to learn for beginners, quite deep for experienced programmers.
  - Nondeterminism and generative: randomness, probabilities, patterns thought as first-class features.
  - Quotations: code blocks `( ... )` that compose with probability, cycling, euclidean, and conditional words.
  - User-defined words: extend (or redefine) 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 (up to 32 partials), FM (2-op, 3 algorithms), wavetables, 7-voice spread.
  - Drum models: seven drum models with timbral morphing.
  - Sampling: disk-loaded samples with slicing, looping, pitch tracking, wavetable mode, and live recording from engine output or line input.
  - Filters: biquad LP/HP/BP and ladder filters. Filters can be modulated, stacked, etc.
  - 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, audio-rate LFO, transitions, DAHDSR envelope modulation — all applicable to any parameter.
- **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

### License

[AGPL-3.0](LICENSE)
