memlnaut-nisps/firmware
monkey-w1n5t0n 4e60d0192a feat(slp-workshop): new MEMLCelium-based mode + port Jolt & OU-noise RL learning
New SLP-Workshop firmware variant (Synth Library Portland), built on the
MEMLCelium engine + MLP shape. Ports the two post-fork learning-algorithm
changes from upstream memllib InterfaceRL into the shared nisps/ml core,
runtime-configurable (no compile-time switch), inert by default:

- nisps/ml/jolt.hpp: Jolt — held continuous weight morph over the flat
  weight buffer + post-release LR ramp (kJolt* constants verbatim).
- nisps/ml/ou_noise.hpp: OUNoise<N> — Ornstein-Uhlenbeck exploration walk
  on the output vector (theta=0.02, dt=0.001, kMaxAmplitude=0.65).

Both wired into ModeBase so every mode gains jolt_press/jolt_release/
jolt_lr_scale + set_explore_intensity; gated so existing modes stay
bit-identical (parity + golden tests green). Firmware surfaces them on
TogB1 (Jolt) and RVX1 (explore). New SLPWorkshopMode mode + schema +
codegen; firmware alias + .ino variant; playground mode registration.

Tests: jolt + OU unit tests, ModeBase learning integration incl. an
inert-parity test proving SLP-Workshop == MEMLCelium with features off.
Verified: cpp tests, wasm build, native↔wasm parity, lint, codegen
golden, playground typecheck. Firmware compile/e2e/hardware are
environment-bound (no arduino-cli/submodules/browser here).

Refs ergo 019f0fca.
2026-06-28 22:15:36 +02:00
..
MEMLNaut-NISPS feat(slp-workshop): new MEMLCelium-based mode + port Jolt & OU-noise RL learning 2026-06-28 22:15:36 +02:00
README.md Stream 6: extract firmware glue under firmware/ 2026-04-29 17:05:38 +03:00

firmware/ — Arduino sketch + hardware glue

Thin shell around nisps/. The platform-agnostic ML / DSP / engines / modes live there; this directory contains:

  • MEMLNaut-NISPS.ino — entry point. Picks one mode at compile time, hosts the dual-core lifecycle (Core 0: ML + UI, Core 1: audio + MIDI), and connects glue to mode.
  • glue/audio_driver.hpp — bridges memllib's AudioDriver block callback to Mode::process(stereosample_t). Templated trampoline so no virtual dispatch in audio path.
  • glue/peripherals.hpp — wires MEMLNaut joystick / pots / buttons to Mode::set_input(idx, value) and the ML primitives (draw_weights, move_weights, train, reset).
  • glue/midi_io.hpp — binds incoming MIDI to mode.note_on/note_off/update_bpm/set_playing (where supported); drains outgoing ControlEvents from the mode's ring buffer to the MIDI UART.
  • glue/input_router.hppwire_inputs() entry point, currently a thin re-export over peripherals. Will grow into a schema-aware router.
  • glue/output_router.hpp — drains engine events + mode events; called from loop1().
  • glue/mode_select.hpp — type aliases mapping MEMLNautMode<Name> identifiers to nisps::modes::<Name>Mode C++ types. Build script rewrites MEMLNAUT_MODE_TYPE between the alternatives.

Building

scripts/build-firmware.sh                # interactive variant prompt
scripts/build-firmware.sh PAFSynth       # build a specific variant
scripts/build-and-flash-firmware.sh      # build + flash via UF2

Target: rp2040:rp2040:solderparty_rp2350_stamp_xl:opt=Optimize3 with compiler.cpp.extra_flags=-std=gnu++20.

Include paths

Arduino-CLI compiles every *.cpp / *.hpp reachable from the sketch directory and from any submodule under src/. Headers under nisps/ are included via relative path (#include "../../nisps/..."). No -I flag injection needed.

src/memllib and src/daisysp are git submodules; the firmware-common.sh wrapper rejects builds when submodules drift from the recorded revision.

Verification

You cannot test on hardware from a sandbox. We verify three things:

  1. arduino-cli compile succeeds for at least three modes (PAFSynth, ChannelStrip, BreakOr).
  2. Host C++ tests in nisps/build still pass — the firmware refactor must not perturb the platform-agnostic library.
  3. git grep confirms no remaining references to deleted root-level files.

Removed

  • Root-level MEMLNaut-NISPS.ino, IMLInterface.hpp, *AudioApp.hpp, XiasriAnalysis.{cpp,hpp} — replaced by nisps/engines/* and firmware/MEMLNaut-NISPS.ino.
  • Root-level modes/MEMLNautMode*.hpp and modes/AudioApps/ — replaced by nisps/modes/* and the mode_select.hpp type aliases.
  • Root-level voicespaces/ — replaced by static voice space data inlined into engines (nisps/engines/paf_synth.hpp etc.).
  • src/memlp/ submodule — replaced by nisps/ml/.