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_menu.ino | Nested menu UI (LOOK / RECS / MIDI / VOL / 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)
| 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) |
PCB/toern_revG/ | Current KiCad board — see Hardware overview |
tools/, standalone-tools/ | Host-side utilities — see Tools overview |
website/devdocs/ | This Docusaurus site (code + hardware + tools docs) → published at /docs/ |
website/docs/ | Built static output of the docs site (generated by npm run build:docs) |
website/ (rest) | Project website (mostly local / deploy-only; see This docs site) |
_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.