File map
Arduino builds every .ino in the sketch root as one program. Treat the filenames as modules even though they share a global namespace.
Sketch root
| File | Responsibility |
|---|---|
toern.ino | Version, includes, enums, Mode/Note/Device/GlobalVars, encoder + touch input, mode switching, playback timers, setup/loop, most glue |
toern_ui.ino | LED matrix drawing: grid, cursor, status, BPM screen, overlays |
toern_touchy.ino | TOUCHY input mapping and flying cat display; reuses voice audition, pitch/effects, Fastrec, SMP and FILTER |
toern_menu.ino | Nested menu UI (PATT / KIT / SMP / BPM / VOL / SETT / REC / MIDI / MODE / ETC), settings persistence hooks |
toern_helpers.ino | Pattern generation helpers, sample browser lists, misc utilities |
toern_sample.ino | Sample preview, trim, load into voices, SD I/O yielding while audio runs |
toern_synths.ino | Poly/mono synth voice allocation, presets, playSound / stopSound |
toern_midi.ino | MIDI in/out, clock master/slave, transport, pulse-clock options |
toern_filter.ino | Apply filter/FX graph parameters; smooth mixer gain transitions |
toern_filterUI.ino | Filter-mode sliders on the matrix, encoder color cues |
toern_parameters.ino | Defaults and parameter setters (setParams, envelopes, synth presets) |
toern_fileoperations.ino | Pattern/project save & load on SD |
toern_sd_serial.ino | USB-serial SD file server (Menu → ETC → SD) |
toern_leds.ino | Optional external WS2812 strip ripples synced to notes |
Headers
| File | Responsibility |
|---|---|
audioinit.h | Full Teensy Audio object graph + connections |
notes.h | Pitch/frequency tables |
colors.h | Channel / UI color definitions |
font_3x5.h | Tiny bitmap font for matrix text |
icons.h | Icon bitmaps for menu/status |
src/ (custom audio and storage helpers)
| File | Responsibility |
|---|---|
src/resamplerReader.h | Modified variable-rate sample playback (from teensy-variable-playback lineage) |
src/effect_freeverb_dmabuf.* | Freeverb variant that keeps large buffers in DMAMEM |
Other trees (not the firmware sketch)
| Path | Role |
|---|---|
handbook/ | End-user guide (HTML); published at handbook.toern.live |
PCB/toern_revH/ | Current KiCad board — see Hardware overview |
tools/, standalone-tools/ | Host-side utilities — see Tools overview |
devdocs/ | This Docusaurus site (code + hardware + tools docs) → docs.toern.live |
website/ | Project website (local / deploy-only; gitignored) |
_internal-docs/ | Scratch notes / plans (gitignored) |
Size intuition
toern.ino is the largest file by far (~8k+ lines). Prefer adding focused logic to an existing toern_*.ino (or a new one) rather than growing the main file further when practical.
src/pattern_transaction.h provides destination-specific pattern commit, recovery and explicit slot deletion helpers. Tests for storage and MIDI live under tests/.