fm1-emufor developers v0.5.1 GitHub

For firmware authors and developers

Run your firmware without the hardware.

fm1-emu runs the FM-1's and the SMK-37's update packages unchanged: their pi32v2 CPU, the parts of the chip the firmwares use, the screen and the audio, written in Rust. Try a build before you flash it, link people to it, and run it from a script.

# your build in a window, with sound and MIDI in
$ fm1-live --fwsc my-synth.fwsc

# headless: hold a chord, write the screen at 5 s
$ FM1_BENCH_KEYS=1500:C4,1500:E4,1500:G4 \
  fm1-live --fwsc my-synth.fwsc --shot 5000

# or in the browser, from your own site
…/fm1-emu/?package=https://you.example/my-synth.fwsc

Test a firmware

Before it goes near a device.

In the browser

On the FM-1 page or the SMK-37 page, open your .fwsc with Open .fwsc…, or drop it on the synth. The page keeps what the firmware saves to its flash. A changed package starts a save of its own, so a new build cannot overwrite an older one's patches.

From a link

  • ?package=URL&name=Name plays a package your site serves over https, with CORS on
  • ?fw=id one of the listed firmwares
  • ?mhz=240 the clock (the page starts at 100 MHz)
  • ?embed=1 the synth and its controls alone, for an iframe on your page

Headless, with fm1-live

  • --shot MS runs MS ms, then writes the panel to work/panel.ppm (--lcd-only: the screen alone)
  • --record DIR with it: a frame every 16 ms, and the audio
  • FM1_BENCH_KEYS a script of keys, encoders, the MASTER knob and MIDI bytes
  • --bench MS how fast it runs

fm1-live also plugs in a USB cable (--usb: a USB-MIDI firmware shows up on this computer as a MIDI device, on macOS and Linux), keeps the flash chip in a file between runs (--flash FILE), and runs with the FM-1's own timings (FM1_STRICT=1). Download it from the latest release; all of its options are in the README.

Get listed

The FM-1 list follows the Hub.

The FM-1 page lists the firmwares on the FM-1 Firmware Hub. Publish yours there, as you would for a real FM-1; nothing else is needed.

  1. Publish it on the HubThe page reads the Hub's list when it opens.
  2. It shows up as newListed last, marked as not yet run here, and playable from its card.
  3. It gets its cardWhen the list is next refreshed, it is played. If it plays, it moves up with a picture of its screen, its version and your links. If not, it stays with the new ones, and the refresh says what failed.

The SMK-37 page's list follows genkigenki's SMK-37 install page.

Once a firmware is on the FM-1 list, a pull request that changes the emulator's CPU or chip plays it, with every other listed firmware, for 8 seconds at 240 MHz, compiled and interpreted. The two must give the same audio, and the audio must match its recording (tests/catalog.json). A change that moves a firmware's sound updates that recording in the same pull request, where review sees it.

How it works

One emulator, three front ends.

The FM-1 is built on a JieLi AC791N: two cores of JieLi's own 32-bit pi32v2 CPU, with no public instruction set manual. The instruction set here was recovered from the firmwares themselves and checked against test programs built with JieLi's toolchain. The same Rust crates run in the page, in the desktop app and in the DAW plugin. Hot code is compiled while it runs: to native code on ARM64 and x86-64, to WebAssembly in the browser.

Read more: the technical report (PDF, 12 pages), the instruction set notes, the hardware notes, M-VAVE's firmware and the second core.

Build and contribute

MIT, on GitHub.

Issues and pull requests are welcome: the source · issues.

# the desktop app, and the listed firmwares to play in it
$ cargo build --release -p fm1-live
$ node tools/fetch_firmwares.mjs
$ target/release/fm1-live --fw felucca

# the page, served locally (needs the wasm32-unknown-unknown target)
$ web/build.sh && (cd web/dist && python3 -m http.server 8642)

# the plugin, on a Mac (AU, VST3, CLAP)
$ tools/build_plugin.sh

# the tests, and the listed firmwares compiled against interpreted
$ cargo test --release -p fm1-isa -p fm1-core -p fm1-soc -p fm1-web
$ node --test web/*.test.mjs
$ tools/catalog_check.py --jobs 4

Every pull request runs the unit tests and the page's tests, builds the site and boots a firmware in it, and runs the core tests and the JIT against the interpreter on Linux (x86-64 and ARM64) and Windows. One that changes the emulator also plays the FM-1 list; one that changes the plugin builds and tests it on macOS and Windows.