Four items from one workflow, committed together because their build and CI
wiring genuinely interleaves — nisps/CMakeLists.txt, run-all-tests.sh and
ci.yml each carry hunks from two of them, and the stage renumbering (1/5 ->
1/6) touches every line. Splitting would produce commits that do not build,
which is worse than a commit that does four things and says so.
S26 part 2 — the curve declaration now matches reality. params[].curve stays
the mode-wide DEFAULT; a voice_spaces entry may now be {name, curve_overrides}
declaring only the slots where THAT voice space deviates. The 6 modes with one
voice space are byte-identical. The values were derived MECHANICALLY by a new
codegen/curve-audit.ts that models the four idioms a p[N]*p[N] regex misses
(alias form, memlcelium's implicit-counter sq() lambda, loop-generated indices,
smooth_params_), inlines helpers, and RAISES rather than guessing when it
cannot reduce an expression. A drift gate cross-checks 1179 (voice space x
param) slots against engine source on every run and was proved to fail loudly
on three drift classes. Application stays in the engine: nisps/engines,
nisps/pipeline and nisps/core are untouched, generated output is pure insertion
(755 insertions, 0 deletions), and the rebuilt nisps.wasm was byte-identical.
S4 / 7.2 — firmware reads the active mode's driver config at mode start, and
mic/line is real. My brief assumed the engine owns this; the code disagreed and
the code was right. sound_analysis_midi's EngineT is NoOpEngine — the mic lives
on a separately-composed AnalysisEngine member — so engine-level wiring would
have compiled, passed every gate, and left the one mic mode on line input.
Hence a mode-level seam defaulting to engine().driver_config(). Separately,
DriverConfig's defaults (line_level 0, output_volume 1.0) had drifted from
memllib's actual 3/0.8 because nothing had ever read them; wiring them as-is
would have made every silent mode louder and its line input maximally
insensitive — a behaviour change disguised as plumbing. Now pinned by a test.
Also: GetSysClockSpeed() panic()s on unsupported sample rates and runs on the
first line of setup(), so sample_rate needed a fallback ahead of clock setup.
CI's firmware env list gains soundanalysismidi — it is the only mic variant and
nothing else compiles that path.
Plan 5e — telemetry is real. A loss_history C-API entry across the full 5-layer
chain lets the browser read the per-iteration loss the core already records.
The audit named one fabrication site; there were two — wasm-iml.ts's
synchronous train() published lossHistory: [loss] as well. A third, ctx.loss,
was not merely dead but actively synthetic (fallbacks of prev * 0.82 and a
literal 0.5, rendered by nothing) and is deleted. The firmware buffer stays
untouched, per the L25 call. EngineApi.lossHistory() reads spine state rather
than the MLP handle, because trainAsync() fits on the worker's mirror net and
the handle would give a subtly-wrong second answer.
Plan 5f — engine throughput is measurable. One source compiled twice (CMake
natively, emcc for WASM) so the targets compare directly and no WASM export is
added. Sequencers are driven into a working state, and every row prints its own
working-state evidence so a number produced by an idle engine is visible rather
than plausible. Reports, never asserts: a wall-clock threshold on shared
hardware is meaningless or flaky, same call as the firmware size job.
ALIGNMENT: the telemetry defect is deleted (built, not deferred); the
performance defect is rewritten to what is actually left — these are HOST
numbers, and nothing measures the RP2350 at 150 MHz, which is the target the
mission's constraint is about. Q4 (memllib ownership) and Q5 (legacy feedback
modes) are closed.
Corrections to my own earlier claims, both found by agents contradicting the
brief: manifold/ONBOARDING.md was NOT "now accurate" — its primitives list
still named five deleted primitives and cited a seededGradient() that does not
exist. And the parity harness misses the sequencer engines because it runs 128
frames while their sequencers evaluate every 400-500 samples, NOT because
all-params-0.5 fails to trigger them (it does trigger: 0.5 maps to ratio 2,
firing three times per bar). The fix is a longer window, not different params.
Gates: run-all-tests.sh ALL GREEN — 4/4 ctest, parity PASS, lint clean, curve
drift 1179 slots ok, 39 e2e (was 33). Firmware: 5 envs built including the mic
variant.
|
||
|---|---|---|
| .. | ||
| MEMLNaut-NISPS | ||
| useq-celium | ||
| README.md | ||
firmware/ — PlatformIO firmware + hardware glue
Thin shell around nisps/. The platform-agnostic ML / DSP / engines / modes live there; this directory contains:
MEMLNaut-NISPS/platformio.ini— the build: one[env:<alias>]per firmware variant (the variant list here IS the registry). See the file itself for the full flag/library rationale.MEMLNaut-NISPS/src/main.cpp— entry point. Picks one mode at compile time viaMEMLNAUT_MODE_TYPE(a per-env build flag, not an in-source registry), hosts the dual-core lifecycle (Core 0: ML + UI, Core 1: audio + MIDI), and connects glue to mode.MEMLNaut-NISPS/glue/audio_driver.hpp— bridges memllib'sAudioDriverblock callback toMode::process(stereosample_t). Templated trampoline so no virtual dispatch in audio path.MEMLNaut-NISPS/glue/peripherals.hpp— wires MEMLNaut joystick / pots / buttons toMode::set_input(idx, value)and the ML primitives (draw_weights,move_weights,train,reset).MEMLNaut-NISPS/glue/midi_io.hpp— binds incoming MIDI tomode.note_on/note_off/update_bpm/set_playing(where supported); drains outgoingControlEvents from the mode's ring buffer to the MIDI UART.MEMLNaut-NISPS/glue/output_router.hpp— drains engine events + mode events; called fromloop1().MEMLNaut-NISPS/glue/mode_select.hpp— type aliases mappingMEMLNautMode<Name>identifiers tonisps::modes::<Name>ModeC++ types. The active alias is chosen per PlatformIO env (-DMEMLNAUT_MODE_TYPE=...), not by rewriting a source file.MEMLNaut-NISPS/glue/selftest.hpp— the guided hardware self-test rig (selftestenv,-DNISPS_SELFTEST=1).MEMLNaut-NISPS/lib/memllib/— vendored hardware-abstraction library (audio driver, TFT display, MIDI I/O, peripherals). Not a submodule — seelib/memllib/VENDORED.mdfor provenance and the re-sync procedure.useq-celium/— standalone RP2040 firmware for the uSEQ-Celium USB→CV/gate converter (separate PlatformIO project; unrelated to the MEMLNaut-NISPS build described here).
Building
scripts/build-firmware.sh # interactive variant prompt
scripts/build-firmware.sh pafsynth # build a specific variant
scripts/build-firmware.sh --all # build every variant
scripts/build-and-flash-firmware.sh # build + flash via picotool
These wrap pio (PlatformIO Core). If pio isn't on PATH, run through
nix-shell -p platformio-core --run '...' — not nix-shell -p platformio,
which wraps the CLI in a bubblewrap FHS sandbox that fails without a working
user namespace (containers/sandboxes). platformio-core is the same CLI,
unwrapped. First build downloads the RP2350 platform + toolchain + libraries
into ~/.platformio (hundreds of MB) — be patient once, fast after.
Target board: solderparty_rp2350_stamp_xl (RP2350, Cortex-M33), -O3,
-std=gnu++20. See platformio.ini for the exact flag/version pins.
Include paths
nisps/(platform-neutral, shared with the WASM build) is reached via-I${PROJECT_DIR}/../..(repo root) — never copied or symlinked intofirmware/. Includes look like#include "nisps/core/perf.hpp".lib/memllib/is a PlatformIO private library (library.properties+src/— the standard Arduino 1.5 layout, required for PlatformIO to recursively compile its nested subdirectories; seeVENDORED.md). Itssrc/becomes the include root:#include "audio/AudioDriver.hpp", nomemllib/orsrc/prefix.glue/is reached via-I${PROJECT_DIR}:#include "glue/audio_driver.hpp".
There is no git submodule anywhere in this tree.
Verification
You cannot test on hardware from a sandbox. We verify:
- Every
[env:...]inplatformio.inibuilds (scripts/build-firmware.sh --all). - Flash/RAM sizes are comparable to an arduino-cli build of the same source
at the same commit — use
arm-none-eabi-size -A(text+rodata vs. data+bss) rather thanpio run's own console "Flash: NN%" line, which double-counts.datafor this board (see the note inplatformio.ini). - Host C++ tests in
nisps/buildstill pass — the firmware build system must not perturb the platform-agnostic library (scripts/run-all-tests.sh).