# Modular synth ## What this builds A patchable software instrument: oscillators, a filter, a gain, an envelope, a delay, and cables between them. A patch is a file. Tests render fixture patches offline to a buffer, and they compare waveform or spectrum envelopes to a fixture, with a tolerance. Note scheduling is tested. No audio hardware, no microphone, and no live MIDI device are required in the checks. Read `spekkr.inputs.json` first. `title` labels the rack. `sample_rate` is the engine rate. `rack` is the starting patch. `keyboard` and `scopes` change the chrome. ## Out of scope - A hardware modular, a vendor's module clones, or a commercial sample pack. - A live MIDI device or a speaker in the checks. - Network or a public patch forum in the checks. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. Offline render and envelopes - A patch file lists modules, parameters, and cables. The engine renders it to a mono or stereo buffer at `sample_rate`, with no AudioContext hardware output required. - `fixtures/patch-a.json` rendered for 2.0 s has the peak, RMS, and onset time in `fixtures/patch-a-env.json`, within the tolerances there. - A silence patch (no oscillator, or gain 0) is below -80 dBFS RMS. Accept when: patch A's envelope matches, and the silence patch is below the floor. ### R2. Notes - A note-on at t = 0.5 s, mid-C, velocity 100, on the starting `voice` rack, starts a tone whose onset (first sample above -40 dBFS) is within 5 ms of 0.5 s. - A note-off at t = 1.0 s, with a 0.2 s release, is below -40 dBFS by t = 1.25 s. - Times are in the rendered buffer, not a wall clock. Accept when: onset and release fall in the listed windows at both sample rates. ### R3. Frames and files - Goldens of the rack, a patched bay, a scope after patch A, and the keyboard. - One command renders the fixtures, checks envelopes and notes, and writes the frames. No audio device. Accept when: the command passes at both sample rates, and the frames match the goldens. ### R4. Inputs - The build reads `spekkr.inputs.json`. Settings label the UI, options turn features on or off, and a swap must be one of its choices. - A value outside a stated range, or a swap that is not one of its choices, is refused before the app starts its checks, with a message that names the key. Accept when: the default inputs render, an illegal swap is refused by name, and changing a visible setting (for example the title) shows up in a later check. ## Verification Offline renders of fixture patches match documented waveform or spectrum envelopes, with tolerances. Note-on and note-off are checked in the buffer, not against a speaker. No audio hardware, no MIDI device, and no network are required. ## Definition of done - Every acceptance check above runs from one command, and all pass at the person's inputs. - A README says how to patch, how to render offline, and how to run the checks.