Files
fmini-1/CLAUDE.md
T
Claude 3ce4be8807 FMini-1 v2.5.12: one version for the FM-1 and the SMK-37
- core.h: one FMINI_VERSION (2.5.12) for both boards; FMINI_SMK_VERSION goes.
  The FM-1 build differs from v2.5.5 only in its version; the SMK-37
  packages are byte for byte the v2.5.12 ones.
- build.py, build_wasi.sh, make_fmini_installer.py and the workflow read
  FMINI_VERSION for both; editor FW_LATEST 2.5.12; the site shows one version.
- CLAUDE.md: one version, one release with the four packages (tag vX.Y.Z).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94
2026-11-11 12:46:15 -03:00

8.6 KiB

CLAUDE.md

FMini-1: Minimoog-style firmware for the M-VAVE FM-1 (a fork of Felucca, GPL-3.0-only, by Leo Kuroshita). Author of the fork: Guilherme Ruppert. Repository: https://github.com/ruppert/fmini-1. Site, installer, patch editor and browser emulator: https://ruppert.github.io/fmini-1/.

The long guide is DEVELOPING.md (architecture, the filter, presets, editor, tests, release, and how to start a new firmware from this base). Read it before changing the engine, the UI or the tests. BUILDING.md is the toolchain setup.

Working with the owner

  • The owner writes Portuguese (pt-BR): answer in Portuguese. Code, comments, commit messages and documents are English.
  • Nothing here has been tested on a real FM-1 unless the owner says so. Say it in the closing message of any firmware change.
  • When something ships, remind the owner of two things: the site is published by the "Installer" GitHub Actions workflow a few minutes after the push to main; and the GitHub Release (one per version, tag vX.Y.Z, the four .fwsc): try gh release create (it was refused with 403 in earlier sessions; if it is, the owner creates it by hand).
  • Commit trailers, on every commit (and the pull request footer from the session's reminder): Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> and Claude-Session: <the session URL given in the system reminder>.
  • There is one branch, main: commit on it and git push origin main (run git fetch origin first: the owner sometimes edits files in the GitHub web interface). A stop hook refuses to end a session with unpushed commits.
  • Do not change the project when the owner only asks a question.

Commands (from the repository root)

export JIELI_TOOLCHAIN=<dir with pi32v2/bin/clang>   AC79_SDK=<AC79 SDK checkout with cpu/wl82/tools/uboot.boot>
./build.sh                                  # build/fmini-1-fm1-<version>.bin, build/loader/ota.bin, build/fmini-1-fm1-<version>.fwsc (~30 s)
sh tests/run_tests.sh > /tmp/tests.log 2>&1 # the whole host suite, 20-30 minutes; run it in the background
python3 tools/fmini_filter.py                # regenerate firmware/src/eng_fmini_filter.h (filter laws and tables)
python3 tools/gen_fmini_presets.py           # regenerate firmware/src/eng_fmini_presets.h from tools/fmini_bank.py
python3 tools/preset_lab.py --wasm docs/emu/felucca.wasm --out DIR     # render and measure the 200 factory patches
BOARD=smk37 [MODEL=elite|mke] ./build.sh   # build/fmini-1-smk37[-elite|-mke]-<version>.fwsc (the SMK-37's three models)
WASI_SDK=<wasi-sdk-25.0 dir> sh web/emu/build_wasi.sh                    # docs/emu (the FM-1 browser emulator)
SMK=1 WASI_SDK=<wasi-sdk-25.0 dir> sh web/emu/build_wasi.sh              # docs/emu/smk (the SMK-37 browser emulator)
python3 web/make_fmini_installer.py build/fmini-1-fm1-<version>.fwsc docs/index.html X.Y.Z  # the site and installer (docs/index.html);
                                             # it embeds the FM-1 package and the three SMK-37 ones of the same version from build/

A single host test is one cc line (they are in tests/run_tests.sh); tests/fmini_filter_test.c and tests/fmini_app_test.c are the FMINI ones. The sandbox is ephemeral: the toolchain and the SDK may have to be fetched again (tools/get_toolchain.sh; BUILDING.md has the SDK clone). If a download is refused by the network allowlist, say so and ask for the files.

Rules that are easy to break

  • The firmware is integer-only and one compilation unit (firmware/src/felucca.c includes the rest; the order matters). No floating point, no 64-bit multiplies in a per-sample loop (int64 only per block). Floating point lives in tools/.
  • firmware/engines/ is a git submodule (MIT, another repository): never edit it. Value formats the engine headers do not have go in firmware/src/core.h.
  • Engine numbers (ENGINES[] in engines.c) are stored in projects, presets and the editor protocol: append, never reorder.
  • Generated files are checked in and are not edited by hand: eng_fmini_filter.h, eng_fmini_presets.h (and build/gen, which is not checked in). Change the generator, rerun it, commit both.
  • The factory bank (tools/fmini_bank.py) is written in physical units (Hz, ms, cents). A change of a law (the filter's) needs a conversion of the bank (tools/fmini_retune.py is the pattern) and new levels (tools/fmini_levels.json).
  • Velocity is loudness only on FMINI (1.7.3). voice.c has Felucca's "accent" (a velocity above 110 adds the loudness contour to the cutoff); it skips ENG_FMINI. A host behaviour that reaches the cutoff, pitch or shape (vmod_t) reaches FMINI too: check tests/fmini_filter_test.c (section 3a holds the velocity) when you touch track_render.
  • Raw CUTOFF / EMPHASIS bytes changed meaning in 1.7.0: a stored patch, user preset, sound file or library entry from 1.6.x sounds different. Any change of a stored value's meaning needs a note in web/EDITOR_PROTOCOL.md and, if possible, a migration.
  • Every new firmware build the owner gets carries a new version: bump the patch number (0.0.x) before building, never ship a changed firmware under a version already given out. The FM-1 and the SMK-37 share one version (since 2.5.12): every release carries the four packages (FM-1, SMK-37 Pro, Elite, MKE-P37) under one tag vX.Y.Z.
  • The version is FMINI_VER_MAJ/MIN/PATCH and FMINI_VERSION in firmware/src/core.h; the workflow, the emulator and the installer read it from there. INFO reports it (tag 49), and the web editor compares it with FW_LATEST in web/editor_fmini.html: change both with the version. (FELUCCA_VERSION in felucca.c is Felucca's and stays.) After a version bump rebuild docs/emu and docs/index.html.
  • Until 1.7.0 "FMINI" was called FMUG (files, identifiers, the engine's name on the device and in the editor protocol). Old commits, the v1.7.0 release and firmware up to 1.7.0 use that name; the editor accepts both. fmg_ / GR_FMG are leftover short forms.
  • New source files carry SPDX-License-Identifier: GPL-3.0-only. Credit outside work in CREDITS.md.
  • New tests are registered in tests/run_tests.sh. tests/target_budget.txt (static loop-instruction cost of the render functions) and tests/golden.txt (render hashes) change only on purpose: BUDGET_UPDATE=1 python3 tests/target_budget.py build/felucca.dis tests/target_budget.txt; for goldens run build/host/regress against a scratch copy with GOLDEN_UPDATE=1 and merge only the lines you mean to change.

The test suite today (1.11.0): what fails and is not yours

Seven sections fail at 1.9.2, the same seven as at 1.7.0 (the 1.7.1 rename changed no render hash and no instruction; 1.7.2 touched the editor only; 1.7.3 moved the 100 FMINI goldens on purpose and no other). Four were confirmed on the untouched v1.6.1 with identical output: fm4 (the DIGITAL conversion) and the three regress sections (the golden hashes of Felucca's other engines: 76 differ; in the default build the 100 FMINI hashes are current). The second regress section, the FELUCCA_CPU2=0 build, reports 117 changed: the same 76 plus 41 FMINI patches (pads, brass, drones) whose render differs from tests/golden.txt, which holds the default build's hashes. That is the same on 1.7.0, did not happen on v1.6.1, and its cause was not investigated. The other three sections were not rerun on 1.6.1 but have causes the filter does not touch: union_test (all 720 engine-switch hashes differ), ui_render (126 lint findings, all label ellipses and overlaps on the CTRL and FILT screens), web pages (3 FAIL lines: the mock tables lack the FMINI engine, percent values, the DIGITAL conversion). Do not chase them unless asked. The runner's run() only sets a flag and does not name the failing section: to find one, copy the script, change run() to print the section on a non-zero exit, and read the log. A test that prints nothing and fails is a return 1 with no message: run the binary alone. web/test_editor_fmini.py can fail once when the machine is busy; run it alone before believing it. A new failure outside this list is yours. The known sections are marked in tests/run_tests.sh (known "...": they print KNOWN FAIL and do not set the suite's failure flag) and in the KNOWN list of web/test_web.mjs: they still run, so a change to their output stays visible.

Before saying a change is done

Build, run the tests that touch the change (and the whole suite for anything shared), regenerate the emulator and the installer if the firmware or the site changed, commit with the trailers, push main, and give the owner the .fwsc (SendUserFile) with the standing reminders above.