COGITATOR :: /projects/canticle-forge
> open_stc_fragment --designation=canticle-forge

// STC fragment retrieved from forge archives

// Status: COMPILED — Machine spirit: HARMONIOUS


⚙ canticle-forge

// classification: personal-forge · date: 2026 · language: rust · type: chiptune tracker

rust tui audio chiptune music

ok so i made this chiptune engine for the website (music.js, it plays 8-bit canticles on every page) and then i realised the only way to compose new tracks was to hand-type arrays of frequencies like [220, 277, 330] and that sucks actually. i wanted something like lsdj on the gameboy — a grid of notes, you press keys, hear it back, bam. so i built one. in the terminal. because at this point im just putting everything in the terminal.

what it actually does

you open it and theres a grid. 4 channels (i defaulted to 32 steps per pattern, you can add more with >). each channel gets its own waveform — square, triangle, or sawtooth. you move the cursor with hjkl (or arrows if youre normal about it), press a key on your keyboard to plonk a note down, and the synth plays it through your speakers. space starts and stops playback. its basically a tracker from 1987 except the colour scheme matches this website and theres no floppy disk involved.

the keyboard layout is two rows of piano keys:

other stuff you can do:

the keyboard layout

// bottom row — C4 to B4
  z  x  c  v  b  n  m      ← white keys
   s  d    g  h  j          ← black keys

// top row — C5 to B5
  q  w  e  r  t  y  u      ← white keys
   2  3   5  6  7           ← black keys

// upper row — C6 to E6
  i  o  p                  ← white keys
   9  0                    ← black keys

// special
  space → rest (silence)
  `     → percussion hit
  .     → delete note at cursor

tech stack (bc people always ask)

rust. ratatui + crossterm for the TUI (same combo as vox-relay, i am a creature of habit), cpal for audio (talks to whatever sound system your OS uses — alsa, pulseaudio, coreaudio, wasapi — i dont have to think about it which is nice), serde_json for saving and loading patterns. the synth is about 60 lines of math that i wrote at 1am and honestly it sounds better than it has any right to. no external audio libs, no samples, no VSTs. just a buffer full of floats and some trig.

export to the website

this is why i built it. you compose a track in the tracker, save it, then:

// export to music.js format
$ canticle-forge export my-track.canticle -o melody.js

// open melody.js, copy the MELODY_GLOBAL array into a page
// right before <script src="music.js">. deploy. now your website
// has a custom chiptune track that you actually composed instead
// of something i hardcoded at 1am (no offence to my own work)

get it

→ browse the source   (syntax-highlighted, right here on this site)

// build and run
$ cd ~/Others/Code/canticle-forge
$ cargo build --release
$ cp target/release/canticle-forge ~/.local/bin/
$ canticle-forge

// or just:
$ canticle-forge forge          # launch the TUI
$ canticle-forge export ...     # export a .canticle file

→ cd ..   (back to all STC fragments)

>