Site for the FM-1 and the SMK-37: both installers, two emulators

- Site text (pt, en) covers both keyboards; new SMK-37 section; the hero film
  shrinks the Minimoog into the FM-1's and the SMK-37's screens.
- Installer: embeds the FM-1 package and the SMK-37 Pro, Elite and MKE-P37
  ones, picks the package by the identity found and says which device it
  detected after step 1; when none is found by name it asks for the MIDI
  input and the device. Details lists every .fwsc.
- "Try in browser" opens a menu: FM-1 (emu/) or SMK-37 (emu/smk/).
- SMK-37 emulator: felucca_web.c with BOARD_SMK37 (web/emu/smk_web_input.h),
  its own worklet and page, the panel adapted from Felucca SMK's simulator
  (Chance Roth, GPL-3.0; credited). The FM-1 wasm is unchanged.
- Installer workflow builds the three SMK-37 packages and publishes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUF6pQ1NkTwmBC8SR8AK94
This commit is contained in:
Claude committed 2026-11-11 11:05:27 -03:00
1 parent b689c314c0
commit 5380984880
16 files changed
+2155 -291

No files matched your search

+10 -5
View File
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-3.0-only
# FMini-1: builds the firmware and publishes the web installer (web/make_fmini_installer.py: one page with the package
# inside) on GitHub Pages, at https://ruppert.github.io/fmini-1/.
# FMini-1: builds the firmware (FM-1 and the SMK-37's three models) and publishes the web installer
# (web/make_fmini_installer.py: one page with the four packages inside) on GitHub Pages, at https://ruppert.github.io/fmini-1/.
# Once in the repository's Settings > Pages: Source = GitHub Actions.
name: Installer
@@ -40,8 +40,11 @@ jobs:
git clone --depth 1 --branch AC79NN_SDK_V1.2.1_2023-12-13 \
https://gitee.com/Jieli-Tech/fw-AC79_AIoT_SDK.git "$HOME/fw-AC79_AIoT_SDK"
- name: Build the firmware
- name: Build the firmware (the SMK-37's three models, then the FM-1)
run: |
BOARD=smk37 ./build.sh
BOARD=smk37 MODEL=elite ./build.sh
BOARD=smk37 MODEL=mke ./build.sh
./build.sh
- name: Make the installer page
@@ -49,11 +52,13 @@ jobs:
VERSION=$(sed -n 's/^#define FMINI_VERSION "v\(.*\)"/\1/p' firmware/src/core.h)
mkdir -p _site
python3 web/make_fmini_installer.py "build/fmini-1-fm1-$VERSION.fwsc" _site/index.html "$VERSION"
SMK=$(sed -n 's/^#define FMINI_SMK_VERSION "v\(.*\)"/\1/p' firmware/src/core.h)
cp "build/fmini-1-fm1-$VERSION.fwsc" "_site/fmini-1-$VERSION.fwsc"
cp "build/fmini-1-fm1-$VERSION.fwsc" build/fmini-1-smk37*-"$SMK".fwsc _site/
cp docs/fmini-ad.mp4 docs/fmini-ad-poster.jpg _site/
mkdir -p _site/editor && cp web/editor_fmini.html _site/editor/index.html # the patch editor (web/test_editor_fmini.py)
cp -r docs/emu _site/emu # the browser emulator (web/emu/build_wasi.sh builds docs/emu)
echo "FMini-1 v$VERSION" >> "$GITHUB_STEP_SUMMARY"
cp -r docs/emu _site/emu # the browser emulators: FM-1 in docs/emu, SMK-37 in docs/emu/smk (web/emu/build_wasi.sh, SMK=1)
echo "FMini-1 v$VERSION (FM-1), v$SMK (SMK-37)" >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-pages-artifact@v3
with:
+6 -3
View File
@@ -29,8 +29,11 @@ sh tests/run_tests.sh > /tmp/tests.log 2>&1 # the whole host suite, 20-30 minute
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
WASI_SDK=<wasi-sdk-25.0 dir> sh web/emu/build_wasi.sh # docs/emu (the browser emulator)
python3 web/make_fmini_installer.py build/fmini-1-fm1-<version>.fwsc docs/index.html X.Y.Z # the installer page (docs/index.html)
BOARD=smk37 [MODEL=elite|mke] ./build.sh # build/fmini-1-smk37[-elite|-mke]-<smk 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 FMINI_SMK_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`
@@ -54,7 +57,7 @@ BUILDING.md has the SDK clone). If a download is refused by the network allowlis
- 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. On branch `fmini-smk37` the SMK-37 has its own version
ship a changed firmware under a version already given out. The SMK-37 has its own version
(`FMINI_SMK_VERSION` and its `FMINI_VER_*` under `BOARD_SMK37` in `core.h`); an SMK-only change bumps that one alone.
- 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`.
+4
View File
@@ -37,3 +37,7 @@ thanks the work below; each keeps its own licence (see [LICENSE](LICENSE), [LICE
The SMK-37 board layer (input HAL, display, pad LEDs, flash map, update path, installers and their tests) is
genkigenki's (M. Geisler), from [genkigenki/Felucca](https://github.com/genkigenki/Felucca) branch `smk37`
(hugelton/Felucca#237), GPL-3.0, with the [fm1-to-smk37](https://github.com/genkigenki/fm1-to-smk37) kit's guide.
The SMK-37 browser emulator's panel (web/emu/smk/index.html: the keyboard's drawing, its finishes and controls) is adapted from
the simulator of [Felucca SMK](https://github.com/ChanceTheMaker/felucca-smk) by Chance Roth
([ChanceTheMaker](https://github.com/ChanceTheMaker)), GPL-3.0; here it runs FMini-1 (web/emu/felucca_web.c built with BOARD_SMK37).
Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
View File
Binary file not shown.
+462
View File
@@ -0,0 +1,462 @@
<!doctype html>
<!-- SPDX-License-Identifier: GPL-3.0-only
FMini-1 on the M-Vave SMK-37, in the browser. The panel (its drawing, layout and gestures) is the SMK-37 simulator of
Felucca SMK by Chance Roth (https://github.com/ChanceTheMaker/felucca-smk, web/smk-simulator.js, smk-studio.css,
panel-glide.js, keyboard-glide.js; GPL-3.0), restyled for the FMini-1 site; what runs behind it is FMini-1's own
firmware built for the SMK-37 (web/emu/felucca_web.c with BOARD_SMK37). The FM-1 page (../index.html) is the pattern
for the start, the silent boot and the saved flash. -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>FMini-1 for SMK-37 — in your browser</title>
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 16%22%3E%3Crect width=%2216%22 height=%2216%22 rx=%223%22 fill=%22%23ff7a1a%22/%3E%3Crect x=%224%22 y=%224%22 width=%228%22 height=%228%22 fill=%22%230d0c10%22/%3E%3C/svg%3E">
<meta name="description" content="FMini-1, the Minimoog emulation firmware, on the M-Vave SMK-37, running in your browser: the same code the keyboard runs.">
<style>
:root { --bg: #0d0c10; --surface: #15131a; --surface2: #1c1922; --line: #2a2631; --fg: #f4f0ea; --dim: #a29cab; --mute: #6f6a78;
--or: #ff7a1a; --or2: #ff9a4d; --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
--mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--fg); font: 14px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--or2); }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
header.nav { position: sticky; top: 0; z-index: 30; background: rgba(13,12,16,.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
header.nav .wrap { display: flex; align-items: center; gap: 14px; height: 56px; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.brand { font-weight: 900; font-style: italic; letter-spacing: -.04em; font-size: 22px; color: var(--fg); text-decoration: none; }
.brand i { color: var(--or); }
.brand small { font: 600 12px/1 var(--mono); font-style: normal; letter-spacing: 0; color: var(--dim); margin-left: 8px; }
header.nav nav { display: flex; gap: 6px; margin-left: auto; }
header.nav nav a { color: var(--dim); text-decoration: none; font-size: 13.5px; font-weight: 600; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); }
header.nav nav a:hover { color: var(--fg); border-color: var(--mute); }
header.nav nav a.keep { color: #1a0e05; background: var(--or); border-color: var(--or); }
header.nav nav a.keep:hover { background: var(--or2); }
@media (max-width: 560px) { header.nav nav a:not(.keep) { display: none; } .brand small { display: none; } }
main { max-width: 1240px; margin: 0 auto; padding: 8px 20px 32px; }
/* the toolbar and the panel: after Felucca SMK's smk-studio.css (Chance Roth, GPL-3.0) */
#smk { position: relative; margin: 10px auto 20px; }
#smk.sim-expanded { max-width: none; }
#smk:fullscreen { box-sizing: border-box; width: 100%; height: 100%; margin: 0; padding: 18px clamp(12px,3vw,48px); overflow: auto; background: var(--bg); }
.sim-toolbar { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.sim-toolbar strong { margin-right: auto; font: 700 14px/1 var(--mono); letter-spacing: .02em; }
.sim-toolbar strong i { color: var(--or); font-style: normal; }
.sim-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 6px; border-radius: 8px;
color: var(--dim); background: var(--surface2); border: 1px solid var(--line); }
.sim-icon-button:hover { color: var(--fg); border-color: var(--mute); }
.sim-icon-button svg { display: block; width: 22px; height: 22px; }
.sim-finish-picker { position: relative; }
.sim-finish-toggle { width: 54px !important; gap: 5px; }
.sim-swatch { display: inline-block; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; border: 1px solid #0008; box-shadow: inset 0 1px 2px #ffffff66, 0 0 0 1px #ffffff33; }
.sim-caret { font-size: 12px; }
.sim-finish-menu { position: absolute; z-index: 60; right: 0; top: calc(100% + 8px); min-width: 170px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px #0008; }
.sim-finish-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; background: transparent; color: var(--fg); text-align: left; font-size: 12.5px; border-radius: 7px; }
.sim-finish-option[aria-selected=true] { outline: 1px solid var(--or); outline-offset: -2px; }
.sim-finish-option:is(:hover,:focus-visible) { background: var(--surface2); }
.sim-status { flex-basis: 100%; font-size: 12px; color: var(--dim); }
.smk-simulator-shell { --case:#b92832; --case-edge:#53141a; --ink:#fff2e5; position:relative; padding:24px 24px 20px; border:1px solid #0009; border-radius:22px 22px 15px 15px; color:var(--ink); background:linear-gradient(110deg,#ffffff22,transparent 30%,#0002),var(--case); box-shadow:inset 0 2px 1px #fff5,inset 0 -8px 0 var(--case-edge),0 18px 40px #000a; font-family:Arial,sans-serif; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.smk-simulator-shell[data-finish=white] { --case:#e8e7e0; --case-edge:#9b9c98; --ink:#303436; }
.smk-simulator-shell[data-finish=elite] { --case:#687481; --case-edge:#39434e; --ink:#f1f1e9; }
.smk-simulator-shell[data-finish=black] { --case:#16191b; --case-edge:#08090a; --ink:#e9eef0; }
.smk-simulator-shell[data-finish=pink] { --case:#e5a2b4; --case-edge:#9b6476; --ink:#392630; }
.smk-simulator-shell[data-finish=charcoal] { --case:#52575b; --case-edge:#2b2e31; --ink:#f2f0e6; }
.smk-simulator-shell::before,.smk-simulator-shell::after { content:''; position:absolute; top:10px; width:10px; height:10px; background:linear-gradient(135deg,#ddd,#666); border:1px solid #000b; border-radius:50%; box-shadow:0 1px 2px #0008; }
.smk-simulator-shell::before { left:10px; } .smk-simulator-shell::after { right:10px; }
.sim-top { display:grid; grid-template-columns:8% 21% 40% 1fr; gap:16px; align-items:start; }
.sim-left,.sim-center,.sim-right,.sim-wheels { min-width:0; }
.sim-bezel { position:relative; padding:12px; background:linear-gradient(135deg,#2e3032,#090a0b); border:2px solid #111; border-radius:18px; box-shadow:0 2px 5px #0006,inset 0 1px 2px #fff3; }
.sim-lcd { display:block; width:100%; height:auto; aspect-ratio:1; border-radius:7px; background:#000; }
.sim-knobs { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:6px; padding:4px 0 14px; }
.sim-encoder { display:grid; justify-items:center; gap:6px; min-width:0; font-size:10px; font-weight:bold; }
.sim-encoder small { font-size:8px; font-weight:normal; white-space:nowrap; }
.sim-dial { padding:0; min-width:0; width:100%; max-width:45px; aspect-ratio:1; border-radius:50%; border:2px solid #111; background:repeating-conic-gradient(#222 0deg 6deg,#36393b 6deg 12deg); box-shadow:0 4px 5px #0008,inset 0 1px 1px #fff6; position:relative; cursor:ns-resize; touch-action:none; }
.sim-dial::before { content:''; position:absolute; inset:5px; border-radius:50%; background:radial-gradient(ellipse at 35% 20%,#696b6c,#292b2d 65%,#181a1c); box-shadow:inset 0 1px #fff4; }
.sim-dial::after { content:''; position:absolute; top:12%; left:calc(50% - 1px); width:2px; height:26%; border-radius:2px; background:#e8e8e4; transform-origin:50% 146%; transform:rotate(var(--angle,0deg)); }
.sim-pads { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:7px; padding:9px; background:#0002; border:1px solid #0004; border-radius:10px; box-shadow:inset 0 2px 6px #0003; }
.sim-pad { min-width:0; padding:0; aspect-ratio:.95; border-radius:6px; color:#bfc3c6; font-size:10px; border:2px solid #15191b; background:linear-gradient(135deg,#555a5e,#303437); box-shadow:inset 0 1px 2px #ffffff35,0 2px 2px #0006; touch-action:none; }
.sim-pad.lit { background:color-mix(in srgb,var(--led) var(--mix,100%),#303437); border-color:color-mix(in srgb,var(--led) var(--mix,100%),#15191b); color:#e8e6e2; box-shadow:0 0 calc(14px*var(--glow,1)) color-mix(in srgb,var(--led) 60%,transparent),inset 0 1px #fff4; }
.sim-pad.lit.full { color:#0d0c10; }
.sim-pad[aria-pressed=true] { box-shadow:inset 0 2px 5px #0009; filter:brightness(.85); }
.sim-faders { display:flex; gap:8px; justify-content:space-evenly; padding:4px 0 12px; }
.sim-fader,.sim-wheel { display:flex; flex-direction:column; align-items:center; gap:8px; font-size:9px; font-weight:bold; }
.sim-fader input { writing-mode:vertical-lr; direction:rtl; touch-action:none; appearance:none; -webkit-appearance:none; width:40px; height:124px; margin:0; border:0; background:repeating-linear-gradient(to top,transparent 0 11px,#ffffff40 11px 12px) left center/7px 108px no-repeat; cursor:ns-resize; }
.sim-fader input::-webkit-slider-runnable-track { width:6px; border:1px solid #090b0d; border-radius:5px; background:#141719; box-shadow:inset 1px 0 3px #000,1px 0 #ffffff30; }
.sim-fader input::-webkit-slider-thumb { -webkit-appearance:none; width:36px; height:23px; margin-left:-16px; border:1px solid #101214; border-radius:4px; background:linear-gradient(to bottom,#777c7f 0%,#414649 36%,#111416 43%,#dadcda 47%,#dadcda 53%,#171a1c 57%,#393e41 75%,#202427); box-shadow:0 3px 4px #0009,inset 0 1px #ffffff77; }
.sim-fader input::-moz-range-track { width:6px; height:100%; border:1px solid #090b0d; border-radius:5px; background:#141719; }
.sim-fader input::-moz-range-thumb { width:36px; height:23px; border:1px solid #101214; border-radius:4px; background:linear-gradient(#777c7f,#414649 36%,#111416 43%,#dadcda 47%,#dadcda 53%,#171a1c 57%,#202427); }
.sim-banks,.sim-buttons { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:5px; margin-top:8px; }
.sim-banks { grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; margin:0; }
.sim-button { min-width:0; min-height:27px; padding:7px 2px; font:700 8px/1.2 Arial,sans-serif; color:#e3e5e6; background:linear-gradient(#474b4e,#272b2e); border:1px solid #131617; border-radius:5px; box-shadow:0 2px 2px #0005,inset 0 1px #fff2; touch-action:none; }
.sim-button.lit { border-bottom:3px solid var(--or); padding-bottom:5px; color:#ffd8b0; box-shadow:0 2px 8px #ff7a1a66,inset 0 1px #fff2; }
.sim-button[aria-pressed=true] { background:#171b1e; box-shadow:inset 0 2px 4px #0009; }
.sim-banks .sim-button { min-height:23px; padding:4px 2px; font-size:7px; border-radius:4px; }
.sim-banks .sim-button.lit { padding-bottom:2px; }
.sim-bottom { margin-top:20px; }
.sim-wheels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; align-content:end; padding-top:4px; }
.sim-wheels > .sim-banks { grid-column:1/-1; width:100%; }
.sim-wheel { gap:6px; text-transform:uppercase; letter-spacing:.08em; }
.sim-wheel-housing { display:block; position:relative; width:min(42px,100%); height:104px; padding:5px 6px; overflow:hidden; border:1px solid #151819; border-radius:12px; background:#0b0d0f; box-shadow:inset 0 3px 6px #000,0 1px #ffffff40; }
.sim-wheel-tread { display:block; height:100%; border-radius:45% / 18%; background:linear-gradient(to bottom,#000e,transparent 30%,#ffffff15 48%,transparent 65%,#000e),linear-gradient(to right,#07090b,#4d5357 24%,#343a3e 55%,#14191d),repeating-linear-gradient(to bottom,#6b7378 0 2px,#202529 2px 5px); background-blend-mode:normal,soft-light,normal; background-position:0 0,0 0,0 var(--wheel-turn,0px); box-shadow:inset 1px 0 #ffffff30,inset -2px 0 #0008; }
.sim-wheel-housing::after { content:''; position:absolute; left:11px; right:11px; top:var(--wheel-position,50%); height:2px; background:#e0e4df; box-shadow:0 1px 2px #000; pointer-events:none; }
.sim-wheel-housing input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:ns-resize; writing-mode:vertical-lr; direction:rtl; touch-action:none; }
.sim-wheel-housing:focus-within { outline:2px solid var(--or); outline-offset:3px; }
.smk-simulator-shell[data-finish=elite] .sim-button { background:linear-gradient(#f78a4f,#cd4b16); color:#311f17; }
.smk-simulator-shell[data-finish=elite] .sim-key.black { background:linear-gradient(90deg,#ac3914,#ed733d 35%,#ce4e1e); border-color:#82341c; }
.smk-simulator-shell[data-finish=elite] .sim-pad:not(.lit) { background:linear-gradient(#fff5dc,#c5c3b1); color:#5e5950; }
.sim-piano { position:relative; height:180px; background:#111; border:5px solid #111; border-top:9px solid #111; border-radius:4px 4px 8px 8px; box-shadow:0 3px 4px #0006; overflow:hidden; touch-action:none; }
.sim-key { position:absolute; top:0; margin:0; padding:0 0 8px; border-radius:0 0 4px 4px; text-align:center; display:flex; align-items:end; justify-content:center; font:9px Arial,sans-serif; left:calc(var(--key-x)*100%/var(--white-count)); width:calc(100%/var(--white-count)); min-width:0; touch-action:none; }
.sim-key.white { height:100%; color:#777; background:linear-gradient(90deg,#d5d5d0,#fcfcf7 20%,#eee 85%,#b8b9b6); border:1px solid #777; border-top:0; box-shadow:inset 0 -6px 0 #c5c6c2; }
.sim-key.black { z-index:2; height:62%; width:calc(62%/var(--white-count)); color:#999; background:linear-gradient(90deg,#151618,#3d4042 30%,#222426 75%,#070808); border:1px solid #060708; border-bottom:6px solid #0b0c0d; box-shadow:2px 4px 3px #0006; }
.sim-key[aria-pressed=true] { background:linear-gradient(#e0661a,#ff9a4d); box-shadow:inset 0 3px 5px #0006; color:#1a0e05; }
.smk-simulator-shell[data-finish=black] .sim-key.white:not([aria-pressed=true]) { color:#aaa; background:linear-gradient(90deg,#16181a,#34383b 20%,#25292c 85%,#111315); border-color:#080a0b; box-shadow:inset 0 -6px 0 #121416; }
.smk-simulator-shell[data-finish=black] .sim-key.black:not([aria-pressed=true]) { color:#b7b9ba; background:linear-gradient(90deg,#08090a,#202326 30%,#121416 75%,#030405); border-color:#020303; }
.smk-simulator-shell :is(button,input):focus-visible { outline:2px solid var(--or); outline-offset:3px; }
@media(max-width:1050px) { .sim-top { gap:12px; } .smk-simulator-shell { padding:20px 14px; } .sim-encoder small { display:none; } .sim-pads { gap:6px; padding:8px; } .sim-piano { height:150px; } }
@media(max-width:700px) { #smk { overflow:auto; } .smk-simulator-shell { min-width:660px; } .sim-toolbar { position:sticky; left:0; } }
#smk.sim-screen-only .smk-simulator-shell { min-width:0; width:min(100%,640px); margin-inline:auto; padding:22px; }
#smk.sim-screen-only :is(.sim-wheels,.sim-center,.sim-right,.sim-bottom) { display:none; }
#smk.sim-screen-only .sim-top { display:block; }
.start { position:absolute; inset:0; z-index:5; display:grid; place-content:center; justify-items:center; gap:12px; background:rgba(13,12,16,.55); border-radius:22px 22px 15px 15px; }
.start button { font:800 17px/1 var(--sans); padding:14px 28px; background:var(--or); color:#1a0e05; border:0; border-radius:12px; }
.start button:disabled { opacity:.5; cursor:progress; }
.start p { margin:0; max-width:32em; text-align:center; color:var(--fg); }
.keys { margin:14px 0 0; color:var(--dim); text-align:center; font-size:12.5px; }
.keys span { white-space:nowrap; margin:0 8px; }
kbd { font:600 11px var(--mono); border:1px solid var(--line); border-radius:4px; padding:0 4px; color:var(--fg); }
footer { margin-top:18px; color:var(--mute); text-align:center; font-size:12px; line-height:1.7; }
footer a { color:var(--dim); }
</style>
</head>
<body>
<header class="nav"><div class="wrap">
<a class="brand" href="../../"><i>FM</i>ini-<i>1</i><small>SMK-37</small></a>
<nav><a href="../">FM-1 emulator</a><a href="../../" class="keep">FMini-1 website</a></nav>
</div></header>
<main>
<section id="smk" aria-label="SMK-37 running FMini-1"></section>
<p class="keys">
<span><kbd>A</kbd>–<kbd>;</kbd> <kbd>W</kbd>–<kbd>P</kbd> keys</span>
<span><kbd>Z</kbd> <kbd>X</kbd> OCTAVE</span>
<span>Knobs: drag, scroll or arrow keys</span>
<span>Faders and wheels: drag</span>
</p>
<footer>
<span class="version">FMini-1 v2.5.12</span><br>
FMini-1 by Guilherme Ruppert, a fork of Felucca by Leo Kuroshita, Hügelton Instruments · <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPL-3.0</a><br>
The SMK-37 panel is the simulator of <a href="https://github.com/ChanceTheMaker/felucca-smk">Felucca SMK</a> by Chance Roth (GPL-3.0), restyled; the firmware behind it is FMini-1's.<br>
<small>M-VAVE, SMK-37 and FM-1 are trademarks of their respective owners. FMini-1 is not affiliated with or endorsed by them.</small>
</footer>
</main>
<script type="module">
const $ = (id) => document.getElementById(id);
const STORE = "fmini-smk-emu-flash", FINISH = "fmini-smk-emu-finish";
let node = null;
const send = (m) => { if (node) node.port.postMessage(m); };
const el = (tag, cls, text) => { const n = document.createElement(tag); if (cls) n.className = cls; if (text) n.textContent = text; return n; };
const host = $("smk");
// ------------------------------------------------------------------ the panel (after Felucca SMK's smk-simulator.js)
const toolbar = el("div", "sim-toolbar"), title = el("strong");
title.innerHTML = "SMK-37 · <i>FMini-1</i>";
const finishes = [["red", "Pro Red", "#b92832"], ["white", "Pro White", "#e8e7e0"], ["elite", "Elite", "linear-gradient(135deg,#687481 55%,#e76522 55%)"],
["black", "Pro Black", "#16191b"], ["pink", "Pro Pink", "#e5a2b4"], ["charcoal", "Pro Charcoal", "#52575b"]];
const picker = el("div", "sim-finish-picker"), finish = el("button", "sim-icon-button sim-finish-toggle"), menu = el("div", "sim-finish-menu");
finish.type = "button"; finish.setAttribute("aria-haspopup", "listbox");
const swatch = el("span", "sim-swatch"); finish.append(swatch, el("span", "sim-caret", "⌄"));
menu.hidden = true; menu.setAttribute("role", "listbox"); picker.append(finish, menu);
const icon = (d, extra = "") => `<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">${extra}<path d="${d}"/></svg>`;
const screenOnly = el("button", "sim-icon-button"); screenOnly.type = "button"; screenOnly.title = "Screen only";
screenOnly.innerHTML = icon("M9 21h6m-3-4v4", '<rect x="3" y="3" width="18" height="14" rx="2"/>');
const expand = el("button", "sim-icon-button"); expand.type = "button"; expand.title = "Expand";
expand.innerHTML = icon("M9 4H4v5M15 4h5v5M4 15v5h5M20 15v5h-5");
const full = el("button", "sim-icon-button"); full.type = "button"; full.title = "Fullscreen"; full.hidden = !document.fullscreenEnabled;
full.innerHTML = icon("M7 12V8h4m2 8h4v-4M7 8l4 4m2 0 4 4", '<rect x="3" y="4" width="18" height="16" rx="2"/>');
const status = el("span", "sim-status"); status.setAttribute("role", "status"); status.hidden = true;
toolbar.append(title, picker, screenOnly, expand, full, status);
const shell = el("div", "smk-simulator-shell");
function chooseFinish(id, save = true) {
const f = finishes.find((x) => x[0] === id) || finishes[0];
shell.dataset.finish = f[0]; swatch.style.background = f[2]; finish.title = "Finish: " + f[1];
for (const b of menu.children) b.setAttribute("aria-selected", String(b.dataset.finish === f[0]));
if (save) try { localStorage.setItem(FINISH, f[0]); } catch {}
}
for (const [id, name, color] of finishes) {
const b = el("button", "sim-finish-option"); b.type = "button"; b.dataset.finish = id; b.setAttribute("role", "option");
const s = el("span", "sim-swatch"); s.style.background = color; b.append(s, el("span", "", name));
b.onclick = () => { chooseFinish(id); menu.hidden = true; }; menu.append(b);
}
finish.onclick = () => { menu.hidden = !menu.hidden; };
document.addEventListener("pointerdown", (e) => { if (!picker.contains(e.target)) menu.hidden = true; });
let saved = "red"; try { saved = localStorage.getItem(FINISH) || "red"; } catch {}
chooseFinish(saved, false);
screenOnly.onclick = () => { releaseAll(); host.classList.toggle("sim-screen-only"); };
expand.onclick = () => host.classList.toggle("sim-expanded");
full.onclick = async () => { releaseAll(); try { if (document.fullscreenElement === host) await document.exitFullscreen(); else await host.requestFullscreen(); } catch {} };
const top = el("div", "sim-top"), left = el("div", "sim-left"), center = el("div", "sim-center"), right = el("div", "sim-right");
const lcd = el("canvas", "sim-lcd"); lcd.width = lcd.height = 240; lcd.setAttribute("role", "img"); lcd.setAttribute("aria-label", "The screen");
const bezel = el("div", "sim-bezel"); bezel.append(lcd); left.append(bezel);
const ctx = lcd.getContext("2d"), img = ctx.createImageData(240, 240);
ctx.fillStyle = "#000"; ctx.fillRect(0, 0, 240, 240);
// press / release, counted per control: several pointers or keys may hold one
const owners = new Map(), counts = new Map();
let buttonMask = 0;
function act(kind, id, value) {
if (kind === "button") { buttonMask = value ? buttonMask | (1 << id) : buttonMask & ~(1 << id); send({ type: "buttons", mask: buttonMask }); }
else if (kind === "key") send({ type: "key", k: id, vel: value });
else if (kind === "pad") send({ type: "pad", p: id, vel: value });
}
function press(owner, kind, id, value, button) {
if (owners.has(owner)) return;
const key = kind + ":" + id, n = counts.get(key) || 0;
counts.set(key, n + 1); owners.set(owner, { key, kind, id, button });
if (!n) act(kind, id, value);
button?.setAttribute("aria-pressed", "true");
}
function release(owner) {
const v = owners.get(owner); if (!v) return;
owners.delete(owner);
const n = counts.get(v.key) - 1;
if (n) counts.set(v.key, n); else { counts.delete(v.key); act(v.kind, v.id, 0); }
v.button?.setAttribute("aria-pressed", String(n > 0));
}
// a gesture that crosses keys or pads plays each (Felucca SMK's keyboard-glide.js / panel-glide.js)
const glides = new Map();
const hitAt = (x, y) => { const t = document.elementFromPoint(x, y)?.closest(".sim-key,.sim-pad"); return t && host.contains(t) ? t : null; };
const velOf = (t, y) => { const r = t.getBoundingClientRect(); return Math.max(20, Math.min(127, Math.round(40 + 87 * (y - r.top) / r.height))); };
function glideVisit(id, g, x, y) {
const t = hitAt(x, y);
if (t === g.t) return;
g.t = t; release("p" + id);
if (t) press("p" + id, t.classList.contains("sim-pad") ? "pad" : "key", +(t.dataset.pad ?? t.dataset.key), velOf(t, y), t);
}
function glideMove(id, x, y) {
const g = glides.get(id); if (!g) return;
const dx = x - g.x, dy = y - g.y, steps = Math.max(1, Math.ceil(Math.hypot(dx, dy) / 4));
for (let i = 1; i <= steps; i++) glideVisit(id, g, g.x + dx * i / steps, g.y + dy * i / steps);
g.x = x; g.y = y;
}
function glideEnd(id) { if (glides.delete(id)) release("p" + id); }
function wire(button, kind, id) {
button.type = "button"; button.setAttribute("aria-pressed", "false");
const playable = kind === "key" || kind === "pad";
button.addEventListener("pointerdown", (e) => {
if (e.pointerType === "mouse" && e.button !== 0) return;
e.preventDefault(); button.setPointerCapture(e.pointerId);
if (playable) { glideEnd(e.pointerId); const g = { x: e.clientX, y: e.clientY, t: null }; glides.set(e.pointerId, g); glideVisit(e.pointerId, g, e.clientX, e.clientY); }
else press("p" + e.pointerId, kind, id, 1, button);
});
if (playable) button.addEventListener("pointermove", (e) => { if (e.pointerType === "mouse" && !(e.buttons & 1)) { glideEnd(e.pointerId); return; } glideMove(e.pointerId, e.clientX, e.clientY); });
for (const n of ["pointerup", "pointercancel", "lostpointercapture"])
button.addEventListener(n, (e) => { if (playable) glideEnd(e.pointerId); else release("p" + e.pointerId); });
button.onkeydown = (e) => { if (["Space", "Enter"].includes(e.code)) { e.preventDefault(); if (!e.repeat) press("k" + e.code, kind, id, 100, button); } };
button.onkeyup = (e) => { if (["Space", "Enter"].includes(e.code)) { e.preventDefault(); release("k" + e.code); } };
button.onblur = () => { release("kSpace"); release("kEnter"); };
}
// K1..K8: endless encoders (K1 MASTER; K2 PRESETS, K3 SELECT, K4 ALGORITHM; K5..K8 the screen's four, as KNOB BANK says)
const knobs = el("div", "sim-knobs");
["MASTER", "PRESETS", "SELECT", "ALGORITHM", "KNOB", "KNOB", "KNOB", "KNOB"].forEach((name, id) => {
const box = el("div", "sim-encoder"), dial = el("button", "sim-dial");
dial.type = "button"; dial.setAttribute("aria-label", `K${id + 1} (${name})`);
let angle = 0, drag;
const turn = (n) => { n = Math.max(-32, Math.min(32, n)); if (!n) return; send({ type: "enc", e: id, n }); angle += n * 12; dial.style.setProperty("--angle", angle + "deg"); };
dial.onpointerdown = (e) => { if (e.button) return; e.preventDefault(); dial.focus(); dial.setPointerCapture(e.pointerId); drag = { id: e.pointerId, y: e.clientY }; };
dial.onpointermove = (e) => { if (drag?.id !== e.pointerId) return; const step = e.shiftKey ? 24 : 7, n = Math.trunc((drag.y - e.clientY) / step); if (n) { turn(n); drag.y -= n * step; } };
for (const n of ["pointerup", "pointercancel", "lostpointercapture"]) dial.addEventListener(n, () => { drag = null; });
dial.onkeydown = (e) => { const n = { ArrowUp: 1, ArrowRight: 1, ArrowDown: -1, ArrowLeft: -1 }[e.key]; if (n) { e.preventDefault(); turn(n * (e.shiftKey ? 10 : 1)); } };
dial.addEventListener("wheel", (e) => { e.preventDefault(); turn(e.deltaY < 0 ? 1 : -1); }, { passive: false });
box.append(el("span", "", `K${id + 1}`), dial, el("small", "", id >= 4 ? `KNOB ${id - 3}` : name)); knobs.append(box);
});
// the 16 pads: 1..8 the top row (hardware pads 0..7), 9..16 the bottom row
const padGrid = el("div", "sim-pads"), pads = [];
for (let i = 0; i < 16; i++) { const b = el("button", "sim-pad", String(i + 1)); b.dataset.pad = String(i); b.setAttribute("aria-label", `Pad ${i + 1}`); wire(b, "pad", i); pads.push(b); padGrid.append(b); }
center.append(knobs, padGrid);
// the 4 faders: 0..127
const faderRow = el("div", "sim-faders"), faders = [];
let faderVals = [0, 0, 0, 0];
for (let i = 0; i < 4; i++) {
const label = el("label", "sim-fader", `F${i + 1}`), f = el("input");
f.type = "range"; f.min = 0; f.max = 127; f.value = 0; f.setAttribute("aria-label", `Fader ${i + 1}`);
f.oninput = () => { faderVals[i] = +f.value; send({ type: "fader", i, v: +f.value }); };
label.append(f); faders.push(f); faderRow.append(label);
}
right.append(faderRow);
// the 18 buttons, in smk_input.h's order (bit i = button i)
const BUTTONS = ["KNOB BANK", "FADER BANK", "◀", "▶", "OCT−", "OCT+", "ARP", "NOTE REPEAT", "SCALE", "CHORD", "GLOBE", "BT", "PATCH", "PARA", "FX", "SEQ", "SEQ PLAY", "SEQ REC"];
const SHORT = { 7: "REPEAT", 16: "PLAY", 17: "REC" };
const bankRow = el("div", "sim-banks"), panelBtns = el("div", "sim-buttons"), buttons = [];
BUTTONS.forEach((name, id) => {
const b = el("button", "sim-button", SHORT[id] || name); b.setAttribute("aria-label", name); b.title = name;
wire(b, "button", id); buttons.push(b); (id < 6 ? bankRow : panelBtns).append(b);
});
right.append(panelBtns);
// the wheels: raw values as the SMK's mux reads them (pitch rests ~535, ~445..640; mod 615 none .. 485 full)
const wheels = el("div", "sim-wheels");
for (const [id, name, min, max] of [[0, "Pitch", -100, 100], [1, "Mod", 0, 127]]) {
const label = el("label", "sim-wheel", name), housing = el("span", "sim-wheel-housing"), tread = el("span", "sim-wheel-tread"), input = el("input");
input.type = "range"; input.min = min; input.max = max; input.value = 0; input.setAttribute("aria-label", name + " wheel");
const paint = () => { const p = (+input.value - min) / (max - min); housing.style.setProperty("--wheel-turn", (p * 48) + "px"); housing.style.setProperty("--wheel-position", (12 + (1 - p) * 76) + "%"); };
const out = () => send({ type: "wheel", i: id, raw: id ? Math.round(615 - +input.value * 130 / 127) : 535 + Math.round(+input.value * .95) });
input.oninput = () => { paint(); out(); };
if (!id) { const back = () => { input.value = 0; paint(); out(); }; for (const n of ["pointerup", "pointercancel", "keyup", "blur"]) input.addEventListener(n, back); }
paint(); housing.append(tread, input); label.append(housing); wheels.append(label);
}
wheels.append(bankRow);
// the 37 keys, C3..C6
const piano = el("div", "sim-piano"), keys = [];
const NOTES = ["C", "C♯", "D", "D♯", "E", "F", "F♯", "G", "G♯", "A", "A♯", "B"];
let white = 0;
for (let i = 0; i < 37; i++) {
const n = i + 48, black = [1, 3, 6, 8, 10].includes(n % 12), b = el("button", "sim-key " + (black ? "black" : "white"), black ? "" : NOTES[n % 12] + (Math.floor(n / 12) - 1));
b.setAttribute("aria-label", NOTES[n % 12] + (Math.floor(n / 12) - 1)); b.dataset.key = String(i); wire(b, "key", i);
b.style.setProperty("--key-x", String(black ? white - .31 : white++)); keys.push(b); piano.append(b);
}
piano.style.setProperty("--white-count", white);
top.append(wheels, left, center, right);
const bottom = el("div", "sim-bottom"); bottom.append(piano);
shell.append(top, bottom);
const start = el("div", "start"), go = el("button", "", "Switch on"), msg = el("p"); msg.hidden = true;
go.type = "button"; start.append(go, msg); shell.append(start);
host.replaceChildren(toolbar, shell);
// the computer keyboard: A W S E D F T G Y H U J K O L P ; from the second C (C4), Z / X the octave buttons
const TYPING = ["KeyA", "KeyW", "KeyS", "KeyE", "KeyD", "KeyF", "KeyT", "KeyG", "KeyY", "KeyH", "KeyU", "KeyJ", "KeyK", "KeyO", "KeyL", "KeyP", "Semicolon"];
document.addEventListener("keydown", (e) => {
if (e.ctrlKey || e.metaKey || e.altKey || e.repeat || e.target.closest("input,select,textarea")) return;
const i = TYPING.indexOf(e.code);
if (i >= 0) { e.preventDefault(); press("q" + e.code, "key", 12 + i, 100, keys[12 + i]); }
else if (e.code === "KeyZ") press("q" + e.code, "button", 4, 1, buttons[4]);
else if (e.code === "KeyX") press("q" + e.code, "button", 5, 1, buttons[5]);
});
document.addEventListener("keyup", (e) => release("q" + e.code));
function releaseAll() { for (const id of [...glides.keys()]) glideEnd(id); for (const o of [...owners.keys()]) release(o); }
addEventListener("blur", releaseAll);
document.addEventListener("visibilitychange", () => { if (document.hidden) releaseAll(); send({ type: "visible", on: !document.hidden }); });
// ------------------------------------------------------------------ what the firmware shows
function drawScreen(fb) {
const d = img.data;
for (let i = 0; i < 240 * 240; i++) {
const v = fb[i], p = ((v >> 8) | (v << 8)) & 0xFFFF;
d[i * 4] = ((p >> 11) & 31) * 255 / 31; d[i * 4 + 1] = ((p >> 5) & 63) * 255 / 63; d[i * 4 + 2] = (p & 31) * 255 / 31; d[i * 4 + 3] = 255;
}
ctx.putImageData(img, 0, 0);
}
function drawLights(leds, rgbs) {
buttons.forEach((b, i) => b.classList.toggle("lit", !!(leds & (1 << i))));
pads.forEach((b, i) => {
const c = rgbs[i] >>> 0, r = (c >> 16) & 255, g = (c >> 8) & 255, bl = c & 255, m = Math.max(r, g, bl);
b.classList.toggle("lit", m > 0);
b.classList.toggle("full", m > 160);
if (m > 0) { // the LED's colour, mixed into the dark pad by its level (perceived: the square root)
const k = 255 / m, lv = m / 255;
b.style.setProperty("--led", `rgb(${Math.round(r * k)},${Math.round(g * k)},${Math.round(bl * k)})`);
b.style.setProperty("--mix", Math.round(100 * Math.min(1, 0.15 + 0.85 * Math.sqrt(lv))) + "%");
b.style.setProperty("--glow", lv.toFixed(2));
}
});
}
// ------------------------------------------------------------------ the flash, kept in this browser
function loadFlash() {
try {
const raw = JSON.parse(localStorage.getItem(STORE) || "{}"), out = {};
for (const [off, b64] of Object.entries(raw)) out[off] = Uint8Array.from(atob(b64), (c) => c.charCodeAt(0));
return out;
} catch { return {}; }
}
function saveFlash(sectors) {
try {
const raw = {};
for (const [off, u8] of Object.entries(sectors)) {
let s = "";
for (let i = 0; i < u8.length; i += 4096) s += String.fromCharCode.apply(null, u8.subarray(i, i + 4096));
raw[off] = btoa(s);
}
localStorage.setItem(STORE, JSON.stringify(raw));
return true;
} catch { return false; }
}
// ------------------------------------------------------------------ Web MIDI in (channel messages) to the firmware
async function midiOn() {
if (!navigator.requestMIDIAccess) return;
try {
const access = await navigator.requestMIDIAccess();
const bind = () => { for (const input of access.inputs.values()) input.onmidimessage = (e) => { const d = e.data; if (d.length >= 2 && d[0] >= 0x80 && d[0] < 0xF0) send({ type: "midi", data: [d[0], d[1], d[2] || 0] }); }; };
access.onstatechange = bind; bind();
} catch { /* no permission: the panel only */ }
}
// ------------------------------------------------------------------ switching on
const say = (t) => { msg.textContent = t; msg.hidden = !t; };
function onNodeMessage(m, st) {
if (m.type !== "frame") return;
if (m.fb) drawScreen(m.fb);
if (m.leds !== undefined) drawLights(m.leds, m.pads);
if (m.sectors && !saveFlash(m.sectors) && !st.warned) { st.warned = true; console.warn("FMini-1: this browser does not keep the saves."); }
}
function loadNode(n, wasm, st) {
return new Promise((res, rej) => {
n.port.onmessage = (e) => { const m = e.data; if (m.type === "ready") res(); else if (m.type === "error") rej(new Error(m.message)); else onNodeMessage(m, st); };
n.port.postMessage({ type: "load", wasm, sectors: loadFlash(), faders: faderVals }, [wasm]);
});
}
const sync = () => { send({ type: "buttons", mask: buttonMask }); send({ type: "visible", on: !document.hidden }); };
async function startWorklet(ac, wasm) {
await ac.audioWorklet.addModule("worklet.js");
const n = new AudioWorkletNode(ac, "fmini-smk", { numberOfInputs: 0, numberOfOutputs: 1, outputChannelCount: [2] });
n.connect(ac.destination);
await loadNode(n, wasm, { warned: false });
node = n;
}
// no click yet: the firmware runs silently on this thread (the screen alive); the first click starts the sound
async function startSilent(ac, wasm) {
const { FMiniSMKCore } = await import("./worklet.js");
const core = new FMiniSMKCore();
const out = [[new Float32Array(128), new Float32Array(128)]];
const n = { port: { onmessage: null, postMessage: (m) => core.onMessage(m) } };
core.port = { postMessage: (m) => n.port.onmessage && n.port.onmessage({ data: m }), set onmessage(f) {} };
await loadNode(n, wasm.slice(0), { warned: false });
node = n;
let last = performance.now(), owed = 0;
const timer = setInterval(() => { const t = performance.now(); owed += Math.min(100, t - last) * 44.1 / 128; last = t; for (; owed >= 1; owed--) core.process([], out); }, 8);
const wake = async () => {
try { await ac.resume(); } catch (_) {}
if (ac.state !== "running") return;
for (const t of ["pointerdown", "keydown", "touchstart"]) removeEventListener(t, wake, true);
clearInterval(timer); node = null;
await startWorklet(ac, wasm);
sync();
};
for (const t of ["pointerdown", "keydown", "touchstart"]) addEventListener(t, wake, true);
}
async function switchOn() {
go.disabled = true; go.textContent = "Starting…";
try {
const ac = new AudioContext({ sampleRate: 44100, latencyHint: "interactive" });
ac.resume().catch(() => {});
const [wasm] = await Promise.all([
fetch("felucca.wasm").then((r) => { if (!r.ok) throw new Error(`felucca.wasm: ${r.status}`); return r.arrayBuffer(); }),
new Promise((r) => setTimeout(r, 250))]);
if (ac.state === "running") await startWorklet(ac, wasm); else await startSilent(ac, wasm);
start.hidden = true;
sync();
midiOn();
} catch (err) {
node = null; go.disabled = false; go.textContent = "Switch on";
say("Could not start: " + (err && err.message || err) + ". A current Chrome, Edge, Firefox or Safari should work.");
}
}
go.addEventListener("click", switchOn);
switchOn();
</script>
</body>
</html>
+133
View File
@@ -0,0 +1,133 @@
// SPDX-License-Identifier: GPL-3.0-only
// FMini-1 on the SMK-37 in an AudioWorklet: felucca.wasm is the whole firmware built for the SMK-37 (web/emu/felucca_web.c
// with BOARD_SMK37, its input from web/emu/smk_web_input.h). Each render quantum asks it for 128 frames, which runs the
// device's clock forward; between quanta the page's input goes in and, about 30 times a second (4 when the page is
// hidden), the screen, the button lights, the pads' colours and any changed flash go out. The FM-1 one (../worklet.js)
// is the pattern.
// The flash the page keeps: the SMK-37's data area (settings, projects, the autosave: 0x9D000..0xBAFFF) and the preset
// slots in the user sample area (0xC2000..0xE9FFF), only the sectors that hold something. {offset: bytes}
export const STORE_AREAS = [[0x9D000, 0xBB000], [0xC2000, 0xEA000]];
export function storeSectors(nor) {
const out = {};
for (const [a, b] of STORE_AREAS)
for (let off = a; off < b; off += 4096) {
const s = nor.subarray(off, off + 4096);
if (s.some((v) => v !== 0xFF)) out[off] = s.slice();
}
return out;
}
export function restoreSectors(nor, sectors) {
for (const [k, v] of Object.entries(sectors || {})) {
const off = +k, b = v instanceof Uint8Array ? v : new Uint8Array(v);
if (STORE_AREAS.some(([a, e]) => off >= a && off + 4096 <= e && off % 4096 === 0) && b.length === 4096)
nor.set(b, off);
}
}
export const HOLD_MS = 24; // a button change stays this long (device time) before the next: the UI reads them a frame
const clock = globalThis.performance ? () => globalThis.performance.now() : () => Date.now();
const nowSec = () => (typeof currentTime === "number" ? currentTime : clock() / 1000);
const Base = typeof AudioWorkletProcessor === "function" ? AudioWorkletProcessor : class { constructor() { this.port = { postMessage() {}, onmessage: null }; } };
{
class FMiniSMK extends Base {
constructor() {
super();
this.ex = null;
this.sentDraws = -1;
this.sentWrites = -1;
this.sentLeds = "";
this.lastFrame = 0;
this.period = 1 / 30;
this.queue = [];
this.nextOk = 0;
this.port.onmessage = (e) => this.onMessage(e.data);
}
async onMessage(m) {
if (m.type === "load") {
try {
const { instance } = await WebAssembly.instantiate(m.wasm, {});
const ex = instance.exports;
ex._initialize();
ex.web_nor_erase();
restoreSectors(new Uint8Array(ex.memory.buffer, ex.web_nor(), ex.web_nor_size()), m.sectors);
ex.web_smk_wheel(0, 535);
ex.web_smk_wheel(1, 615);
for (let i = 0; i < 4; i++) ex.web_smk_fader(i, m.faders ? m.faders[i] : 0);
ex.web_boot();
this.ex = ex;
this.sentWrites = ex.web_flash_writes_count();
this.port.postMessage({ type: "ready", rate: ex.web_sample_rate() });
} catch (err) {
this.port.postMessage({ type: "error", message: String(err && err.message || err) });
}
return;
}
const ex = this.ex;
if (!ex) return;
if (m.type === "buttons") this.queue.push(m);
else if (m.type === "key") ex.web_smk_key(m.k, m.vel | 0);
else if (m.type === "pad") ex.web_smk_pad(m.p, m.vel | 0);
else if (m.type === "enc") ex.web_smk_enc(m.e, m.n | 0);
else if (m.type === "fader") ex.web_smk_fader(m.i, m.v | 0);
else if (m.type === "wheel") ex.web_smk_wheel(m.i, m.raw | 0);
else if (m.type === "midi") ex.web_midi(m.data[0] | 0, m.data[1] | 0, m.data[2] | 0);
else if (m.type === "visible") this.period = m.on ? 1 / 30 : 1 / 4;
}
publish() {
const ex = this.ex, mem = ex.memory.buffer;
const msg = { type: "frame" };
const pads = Array.from(new Uint32Array(mem, ex.web_smk_pad_rgb(), 16));
const leds = ex.web_smk_leds();
const key = leds + ";" + pads.join(",");
if (key !== this.sentLeds) {
this.sentLeds = key;
msg.leds = leds;
msg.pads = pads;
}
const transfer = [];
const draws = ex.web_screen_draws();
if (draws !== this.sentDraws) {
this.sentDraws = draws;
msg.fb = new Uint16Array(mem, ex.web_screen(), 240 * 240).slice();
transfer.push(msg.fb.buffer);
}
const writes = ex.web_flash_writes_count();
if (writes !== this.sentWrites) {
this.sentWrites = writes;
msg.sectors = storeSectors(new Uint8Array(mem, ex.web_nor(), ex.web_nor_size()));
}
if (msg.leds !== undefined || msg.fb || msg.sectors) this.port.postMessage(msg, transfer);
}
input() {
const ex = this.ex, now = ex.web_now_ms();
while (this.queue.length && now - this.nextOk >= 0) {
const m = this.queue.shift();
ex.web_smk_buttons(m.mask >>> 0);
this.nextOk = now + HOLD_MS;
}
}
process(inputs, outputs) {
const ex = this.ex;
if (!ex) return true;
if (this.queue.length) this.input();
const out = outputs[0], n = out[0].length;
ex.web_render(n);
out[0].set(new Float32Array(ex.memory.buffer, ex.web_out_l(), n));
if (out[1]) out[1].set(new Float32Array(ex.memory.buffer, ex.web_out_r(), n));
if (nowSec() - this.lastFrame >= this.period) {
this.lastFrame = nowSec();
this.publish();
}
return true;
}
}
if (typeof registerProcessor === "function") registerProcessor("fmini-smk", FMiniSMK);
globalThis.FMiniSMKCore = FMiniSMK;
}
export const FMiniSMKCore = globalThis.FMiniSMKCore;
+333 -140
View File
@@ -6,8 +6,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<meta name="description" content="FMini-1: a Minimoog emulation firmware for the M-Vave FM-1, mono and polyphonic. Analog Circuit Modelling, 3 oscillators, ladder filter, 200 presets, arpeggiator, sequencer, MIDI.">
<title>FMini-1 — a Minimoog emulation for the M-Vave FM-1</title>
<meta name="description" content="FMini-1: a Minimoog emulation firmware for the M-Vave FM-1 and SMK-37, mono and polyphonic. Analog Circuit Modelling, 3 oscillators, ladder filter, 200 presets, arpeggiator, sequencer, MIDI.">
<title>FMini-1 — a Minimoog emulation for the M-Vave FM-1 and SMK-37</title>
<style>
:root {
--bg: #0d0c10; --surface: #15131a; --surface2: #1c1922; --line: #2a2631; --fg: #f4f0ea; --dim: #a29cab; --mute: #6f6a78;
@@ -36,17 +36,25 @@
header.nav nav a.keep:hover { background: var(--or2); }
.lang { font: 600 12px/1 var(--mono); color: var(--dim); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; cursor: pointer; }
.lang:hover { color: var(--fg); border-color: var(--mute); }
header.nav nav a.try .ts { display: none; }
header.nav nav a.try .ts, header.nav nav .try .ts { display: none; }
.trywrap { position: relative; }
header.nav nav button.try { font: 500 14px/1.65 var(--sans); color: var(--dim); background: transparent; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
header.nav nav button.try:hover, header.nav nav button.try[aria-expanded=true] { color: var(--fg); background: var(--surface2); }
header.nav nav button.try .car { font-size: 10px; margin-left: 5px; opacity: .7; }
.trymenu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.55); z-index: 40; }
header.nav nav .trymenu a { display: flex; align-items: baseline; gap: 10px; color: var(--fg); padding: 10px 12px; border-radius: 8px; font-weight: 600; }
header.nav nav .trymenu a small { color: var(--mute); font: 500 11.5px/1 var(--mono); }
header.nav nav .trymenu a:hover { background: var(--surface2); }
header.nav nav a.donate { color: var(--or2); }
/* a phone: the section links go, the emulator's ("Try in browser") and Install stay; on a narrow one the short label */
@media (max-width: 720px) {
header.nav nav a:not(.keep):not(.try) { display: none; }
header.nav nav > a:not(.keep):not(.try) { display: none; }
header.nav .wrap { gap: 10px; }
header.nav nav a { padding: 8px 9px; font-size: 13px; }
header.nav nav a.keep { margin-left: 2px; }
header.nav nav a.try { color: var(--fg); border: 1px solid var(--line); }
header.nav nav a.try, header.nav nav button.try { color: var(--fg); border: 1px solid var(--line); padding: 8px 9px; font-size: 13px; }
}
@media (max-width: 430px) { header.nav nav a.try .tl { display: none; } header.nav nav a.try .ts { display: inline; } }
@media (max-width: 430px) { header.nav nav .try .tl { display: none; } header.nav nav .try .ts { display: inline; } }
.tipbg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.tipbg[hidden] { display: none; }
.tipbox { background: var(--surface2, #1b1917); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 380px; color: var(--fg); }
@@ -92,7 +100,8 @@
.fm .body { display: block; width: 100%; height: auto; filter: drop-shadow(0 30px 50px rgba(0,0,0,.6)); }
.fm .lcd { position: absolute; left: 30.73%; top: 15.23%; width: 16.76%; height: 28.3%; background: #000; overflow: hidden; border-radius: 1.5%; opacity: 0;
box-shadow: 0 0 18px rgba(255,122,26,.18); cursor: pointer; }
.fm .lcd #scr { position: absolute; inset: 0; }
.fm .lcd .scr { position: absolute; inset: 0; }
.fm.smk .lcd { left: 13.702%; top: 11.423%; width: 17.107%; height: 38.713%; border-radius: 1.2%; }
.fm .lcd img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity .6s ease; }
.copy2 { position: absolute; z-index: 3; left: 0; right: 0; text-align: center; opacity: 0; pointer-events: none; padding: 0 24px; }
.copy2 h2 { margin: 0 auto; font-size: clamp(26px, 4vw, 40px); }
@@ -201,12 +210,13 @@
#install .steps { margin-bottom: 12px; }
#install #go { padding: 13px 20px; }
@media (min-width: 900px) { /* the install block on one screen: steps and button left, notes and details right */
#install .card { display: grid; grid-template-columns: 1.3fr 1fr; column-gap: 32px; row-gap: 12px; align-items: start; }
#install .card { display: grid; grid-template-columns: 1.3fr 1fr; grid-template-rows: auto auto auto auto auto 1fr; column-gap: 32px; row-gap: 12px; align-items: start; }
#install .steps { grid-column: 1; grid-row: 1; margin: 0; }
#install #go { grid-column: 1; grid-row: 2; }
#install .busywarn { grid-column: 1; grid-row: 3; margin: 0; }
#install .prog { grid-column: 1; grid-row: 4; margin: 0; }
#install .side { grid-column: 2; grid-row: 1 / span 4; display: flex; flex-direction: column; gap: 12px; }
#install .detected { grid-column: 1; grid-row: 2; margin: 0; }
#install #go { grid-column: 1; grid-row: 3; }
#install .busywarn { grid-column: 1; grid-row: 4; margin: 0; }
#install .prog { grid-column: 1; grid-row: 5; margin: 0; }
#install .side { grid-column: 2; grid-row: 1 / span 6; display: flex; flex-direction: column; gap: 12px; }
#install .side .note { margin: 0; }
}
.meter { position: relative; height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
@@ -230,6 +240,16 @@
body.finished #phases li.done::before { background: var(--ok); }
.note { color: var(--dim); font-size: 14.5px; margin: 10px 0 0; }
.detected { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--or); background: rgba(255,122,26,.10); font-size: 15px; line-height: 1.45; }
.detected b { color: var(--or2); }
.fwlist { list-style: none; margin: 8px 0 0; padding: 0; }
.fwlist li { margin: 6px 0; font-size: 14px; }
.fwlist li span { color: var(--mute); font: 500 12px/1 var(--mono); margin-left: 8px; }
.portpick label { display: block; margin-top: 14px; color: var(--dim); font-size: 13px; }
.devs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.devs label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg); font-size: 14px; cursor: pointer; }
.devs label:has(input:checked) { border-color: var(--or); background: rgba(255,122,26,.10); }
.devs input { accent-color: var(--or); margin: 0; }
.fwother { margin: 6px 0 0; }
#fwpick { background: transparent; color: var(--dim); border: 1px solid var(--line); font-size: 13px; padding: 6px 10px; cursor: pointer; }
.note.warn { color: #ffb37a; }
@@ -259,8 +279,10 @@
<a href="#features" data-t="nav_f"></a>
<a href="#screens" data-t="nav_s"></a>
<a href="#feat" data-t="nav_ft"></a>
<a href="#smk37">SMK-37</a>
<a href="editor/" data-t="nav_ed"></a>
<a href="emu/" class="try"><span class="tl" data-t="nav_try"></span><span class="ts" data-t="nav_try_s"></span></a>
<div class="trywrap"><button type="button" class="try" id="trybtn" aria-haspopup="true" aria-expanded="false"><span class="tl" data-t="nav_try"></span><span class="ts" data-t="nav_try_s"></span><span class="car">▾</span></button>
<div class="trymenu" id="trymenu" hidden><a href="emu/">FM-1 <small data-t="try_fm1"></small></a><a href="emu/smk/">SMK-37 <small data-t="try_smk"></small></a></div></div>
<a href="https://ko-fi.com/ruppert" class="try donate" target="_blank" rel="noopener"><span class="tl" data-t="donate"></span><span class="ts" data-t="donate_s"></span></a>
<a href="#install" class="keep" data-t="nav_i"></a>
</nav>
@@ -287,8 +309,13 @@
<img class="mm" id="mm" alt="Minimoog" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBAUEBAYFBQUGBgYHCQ4JCQgICRINDQoOFRIWFhUSFBQX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pbUVJfLbauBHDyh1SktLCg8l1N9LixEOLLpJjgw6xRdnFLjSCtyk0IcB/i1nKD2k5eEOHEr6EKUqj0NSU8ctPlzx4fR5xQCYSlAbBz2HAEXtAVMleYdY2sLk3PdE4k939WXhU/KvojRNYgmXGwpVIw+k3sc0iyNPAJgk4jcS84hymUAJbJST8nscf2YzoGcEAEFIuslF8o7dTw74MtNNulSrEn1iDa/frGXOfmfqXg0/Kvoi+Tid51IyUagkn61PZNvIQ4vEJyH+9VCSbcRS2T8Io0rbCCDwIINjfSCVMtIRmsU25pFwPZEdSpuy8Gl5UWTOKkrypVTaAFka3pjA18LaRJXiJ0IUEUmhEjhemM+XCM6qZl77xKwn6ShY2Pfa0PpWlxKVIb1Wbj6NxyPDjFdWe7HBp7InuYsmUpuKRR0dv96WbJ8xCGsVTi+suUoIB4BNMl9PbaIqlrDRbCbqvxS4gkDv7ISlQLSwpCE6WspwXPeBaLxpb+pOBT2X0LAYumBYmVoJB0saYxp38IaTLine truncated
<figure class="fm" id="fm">
<img class="body" id="fm-body" alt="M-VAVE FM-1" src="">
<div class="lcd" id="lcd"><div id="scr"><img id="lcd-a" alt=""><img id="lcd-b" alt=""></div></div>
<div class="lcd" id="lcd"><div class="scr" id="scr"><img id="lcd-a" alt=""><img id="lcd-b" alt=""></div></div>
</figure>
<figure class="fm smk" id="smkfig">
<img class="body" id="smk-body" alt="M-VAVE SMK-37" src="">
<div class="lcd" id="lcd2"><div class="scr" id="scr2"><img id="lcd2-a" alt=""><img id="lcd2-b" alt=""></div></div>
</figure>
<img class="mm" id="mm2" alt="" aria-hidden="true">
<div class="copy2" id="copy2">
<h2 data-t="hero2_t"></h2>
<p data-t="hero2_s"></p>
@@ -322,6 +349,21 @@
</div>
</section>
<section class="s wrap" id="smk37">
<p class="eyebrow">SMK-37</p>
<h2 data-t="h_smk"></h2>
<p class="lead" data-t="l_smk"></p>
<div class="grid">
<article class="feat"><span class="n">01</span><h3 data-t="k1t"></h3><p data-t="k1d"></p></article>
<article class="feat"><span class="n">02</span><h3 data-t="k2t"></h3><p data-t="k2d"></p></article>
<article class="feat"><span class="n">03</span><h3 data-t="k3t"></h3><p data-t="k3d"></p></article>
<article class="feat"><span class="n">04</span><h3 data-t="k4t"></h3><p data-t="k4d"></p></article>
<article class="feat"><span class="n">05</span><h3 data-t="k5t"></h3><p data-t="k5d"></p></article>
<article class="feat"><span class="n">06</span><h3 data-t="k6t"></h3><p data-t="k6d"></p></article>
</div>
<p class="cta"><a class="btn sec2" href="emu/smk/" data-t="btn_smkemu"></a></p>
</section>
<section class="s wrap" id="screens">
<p class="eyebrow" data-t="e_screens"></p>
<h2 data-t="h_screens"></h2>
@@ -373,9 +415,14 @@
<li><b><i>3</i><span data-t="step3"></span></b><span class="d" data-t="s3"></span></li>
</ol>
<div class="detected" id="detected" role="status" hidden></div>
<button id="go" disabled><span data-t="install"></span> <small class="curver-b"></small></button>
<dialog class="portpick" id="portpick"><b data-t="pick_t"></b><p data-t="pick_d"></p><select id="portsel" size="5" aria-label="MIDI"></select><button id="portgo" type="button" data-t="pick_b"></button><button id="portno" type="button" class="ghost" data-t="pick_c"></button></dialog>
<dialog class="portpick" id="portpick"><b data-t="pick_t"></b><p data-t="pick_d"></p>
<label data-t="pick_port"></label><select id="portsel" size="4" aria-label="MIDI"></select>
<label data-t="pick_dev"></label>
<div class="devs" id="devsel"><label><input type="radio" name="dev" value="FM-1" checked> FM-1</label><label><input type="radio" name="dev" value="SMK-37 Pro"> SMK-37 Pro</label><label><input type="radio" name="dev" value="SMK-37 Elite"> SMK-37 Elite</label><label><input type="radio" name="dev" value="MKE-P37"> MKE-P37</label></div>
<button id="portgo" type="button" data-t="pick_b"></button><button id="portno" type="button" class="ghost" data-t="pick_c"></button></dialog>
<div class="busywarn" role="alert"><b data-t="busy_t"></b><span data-t="busy_d"></span></div>
<div class="prog">
<div class="meter" id="bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="fill" id="fill"></div></div>
@@ -388,13 +435,15 @@
<div class="side">
<p class="note" data-t="intro"></p>
<p class="note" data-t="compat"></p>
<p class="note" data-t="smknote"></p>
<p class="note warn" data-t="warn"></p>
<p class="note" data-t="direct"></p>
<p class="note" data-t="beta"></p>
<details>
<summary data-t="logT"></summary>
<p><a id="fwdl" class="fwdl" href="#" download data-t="fwdl"></a></p>
<p data-t="fwdl"></p>
<ul class="fwlist" id="fwlist"></ul>
<p class="fwother"><button id="fwpick" type="button" data-t="fw_pick"></button><input type="file" id="fwfile" accept=".fwsc" hidden></p>
<pre id="log"></pre>
</details>
@@ -418,10 +467,10 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
//
// FM-1 .fwsc packages in the browser: the package identity and the image the
// FM-1 (and SMK-37 Pro) .fwsc packages in the browser: the package identity and the image the
// device reads during an update.
const BLOCKS = 20, BLK = 0x30, KEEP = 0x2F;
const BLOCKS = 20, BLK = 0x30, KEEP = 0x2F, MAX_BLOCKS = 64;
const STOCK_V15_SHA256 = "db1642b2b6fa5c2cccb11ffd13878068bb28601678d3644049f99dc40e7edb8a";
const STOCK_APP_SIZE = 0x8DFBC;
const STOCK_V15_SIZE = 699956;
@@ -625,7 +674,7 @@ class Package {
}
}
// the package identity ("FM-1_904"): one marker byte after each of the first 20 blocks
// the package identity ("FM-1_904", "SMK-37 Pro_016"): one marker byte after each of the first 20 blocks
function productOf(fwsc) {
if (fwsc.length < BLOCKS * BLK) throw new Error("not an FM-1 package (too short)");
let s = "";
@@ -636,14 +685,50 @@ function productOf(fwsc) {
return s;
}
// the image the device addresses during an update: the .fwsc without the 20 marker bytes
function logicalImage(fwsc) {
const out = new Uint8Array(fwsc.length - BLOCKS);
for (let i = 0; i < BLOCKS; i++) out.set(fwsc.subarray(i * BLK, i * BLK + KEEP), i * KEEP);
out.set(fwsc.subarray(BLOCKS * BLK), BLOCKS * KEEP);
// interleave blocks: 20, then more while the marker is the unused 0x7D (the stock SMK-37 Pro v016 has 36)
function blockCount(fwsc) {
let n = BLOCKS;
while (n < MAX_BLOCKS && (n + 1) * BLK <= fwsc.length && fwsc[n * BLK + KEEP] === 0x7D) n++;
return n;
}
function deinterleave(fwsc, blocks) {
const out = new Uint8Array(fwsc.length - blocks);
for (let i = 0; i < blocks; i++) out.set(fwsc.subarray(i * BLK, i * BLK + KEEP), i * KEEP);
out.set(fwsc.subarray(blocks * BLK), blocks * KEEP);
return out;
}
// the logical image's flash.bin (type 0) and ota.bin (type 100) match their CRCs (as fm1_install.py files_ok)
function filesOk(img) {
if (img.length < 0x40) return false;
const rd = (a, o, n) => a.slice(o, o + n).reduce((v, x, i) => v + x * 2 ** (8 * i), 0);
const h = Uint8Array.from(img.subarray(0, 0x40));
enc(h, 0, 0x40);
if (crc16(h.subarray(2, 0x40)) !== rd(h, 0, 2)) return false;
const count = rd(h, 8, 2);
if (count < 1 || count > 8 || img.length < 0x40 + 0x50 * count) return false;
for (let i = 0; i < count; i++) {
const e = Uint8Array.from(img.subarray(0x40 + i * 0x50, 0x90 + i * 0x50));
enc(e, 0, 0x50);
const typ = rd(e, 0, 2), off = rd(e, 8, 4), size = rd(e, 12, 4);
if (off + size > img.length) return false;
if ((typ === 0 || typ === 100) && crc16(img.subarray(off, off + size)) !== rd(e, 4, 2)) return false;
}
return true;
}
// the image the device addresses during an update: the .fwsc without the marker bytes (20 blocks, or the
// detected count when the files' CRCs agree: a 20-block package can have 0x7D after block 20 by chance)
function logicalImage(fwsc) {
const n = blockCount(fwsc);
if (n !== BLOCKS) {
const img = deinterleave(fwsc, n);
if (filesOk(img) || !filesOk(deinterleave(fwsc, BLOCKS))) return img;
}
return deinterleave(fwsc, BLOCKS);
}
async function sha256hex(bytes) {
const d = await crypto.subtle.digest("SHA-256", bytes);
return [...new Uint8Array(d)].map((x) => x.toString(16).padStart(2, "0")).join("");
@@ -705,6 +790,9 @@ const sleep = (ms) => new Promise((r) => {
w.postMessage({ id, ms });
});
const IS_OTA = (id) => /^ota-/i.test(id.model);
// two models ("ota-" aside) are exactly the same: a package installs only on its own model (the SMK-37 Pro,
// SMK-37 Elite and MKE-P37 builds each on their own model, never an FM-1 and an SMK)
const sameModel = (a, b) => a.replace(/^ota-/i, "") === b.replace(/^ota-/i, "");
// errors carry a code the pages translate: notfound, model, stopped, noloader, lost, noreturn,
// mismatch (detail: the identity the device reports), badreq
@@ -812,7 +900,7 @@ class Updater {
for (const input of this.access.inputs.values()) {
if (input.state === "disconnected") continue;
// never probe other gear: by name, unless the player picked a port (a firmware that names its USB device differently)
if (this.portName ? input.name !== this.portName : !/fm-1|fmini|felucca|ota|composite|sinco|usb-midi/i.test(input.name || "")) continue;
if (this.portName ? input.name !== this.portName : !/fm-1|fmini|smk|elite|mke-p37|starry|felucca|ota|composite|sinco|usb-midi/i.test(input.name || "")) continue;
const output = outs.find((o) => o.name === input.name && o.state !== "disconnected");
if (!output) continue;
try { await input.open(); await output.open(); } catch (_) { continue; }
@@ -870,7 +958,7 @@ class Updater {
this.portName = null; // (the picked port was for the running firmware: the loader is ours, FMini-1 Update)
if (!dev) throw fail("notfound", "FM-1 not found (USB cable, and no other app using it?)");
const [model] = product.split("_");
if (dev.id.model !== model) { dev.link.close(); throw fail("model", `the device is ${dev.id.text}, the package is for ${product}`); }
if (!sameModel(dev.id.model, model)) { dev.link.close(); throw fail("model", `the device is ${dev.id.text}, the package is for ${product}`); }
step("start", dev.id.text);
dev.link.send(UPGRADE);
await sleep(2000);
@@ -902,18 +990,24 @@ class Updater {
return s2;
}
// resume: the device is already in update mode (loader) -> true when the write finished
async resume(image, onStep, product = null) {
const model = product && product.split("_")[0];
const ota = await this.find((id) => model ? id.model === "ota-" + model : IS_OTA(id));
// resume: the device is already in update mode (loader) -> true when the write finished. product: the
// package's identity; the loader's model must be exactly the package's (sameModel, as install()): an SMK's
// loader never gets an FM-1 image nor another model's, and without the identity nothing is written
async resume(image, onStep, product = "") {
const model = (product || "").split("_")[0];
const ota = await this.find(IS_OTA);
if (!ota) return false;
if (!product || !sameModel(ota.id.model, model)) {
ota.link.close();
throw fail("model", `the device is in the update mode of ${ota.id.text}, the package is for ${product || "an unknown model"}`, ota.id.text);
}
const step = onStep || (() => {});
const result = await this.write(ota, image, step);
if (!result.finished) return false;
if (product) {
step("reboot");
await sleep(3000);
const back = await this.waitFor((id) => id.model === model, 40000);
const back = await this.waitFor((id) => !IS_OTA(id) && sameModel(id.model, model), 40000);
if (!back) throw fail("noreturn", "The FM-1 did not return after resuming the write.");
back.link.close();
if (back.id.text !== product) throw fail("mismatch", "The FM-1 reports a different firmware after resuming.", back.id.text);
@@ -1102,89 +1196,95 @@ class BackupConnection {
const $ = (id) => document.getElementById(id);
const TEXT = {
pt: {
intro: "Conecte o FM-1 por USB. (Funciona no Chrome ou no Edge.)",
intro: "Conecte o FM-1 ou o SMK-37 por USB. O instalador reconhece o aparelho e grava o firmware certo. (Funciona no Chrome ou no Edge.)",
compat: "Compatível com as novas versões do FM-1 (com o chip de flash UC25HQ80).",
warn: "Não desconecte o cabo USB durante a gravação.",
install: "Instalar", other: "English",
fw_pick: "Instalar outro firmware (.fwsc)…", fw_bad: "Este arquivo não é um firmware FM-1 válido.",
fw_pick: "Instalar outro firmware (.fwsc)…", fw_bad: "Este arquivo não é um firmware válido para o FM-1 ou o SMK-37.",
smknote: "SMK-37 (Pro, Elite e MKE-P37): a primeira inicialização apaga as configurações do firmware original. Para voltar ao original, use o firmware e o atualizador da M-Vave para o seu modelo.",
det: "Dispositivo detectado: ", det_ota: " (em modo de atualização)", det_fw: " · instalando o FMini-1 ",
editor: "Editor",
direct: "Ligue o cabo USB direto no computador. Não precisa de Probe nem de Transporter.",
beta: "O FMini-1 é uma versão experimental. O autor não se responsabiliza se o seu FM-1 for danificado ou se comportar de forma estranha por causa deste firmware personalizado. Use por sua conta e risco.",
beta: "O FMini-1 é uma versão experimental. O autor não se responsabiliza se o seu FM-1 ou SMK-37 for danificado ou se comportar de forma estranha por causa deste firmware personalizado. Use por sua conta e risco.",
nomidi: "Este navegador não consegue. Abra a página no Chrome ou no Edge.", loadfail: "Não foi possível carregar: ",
start: "Iniciando", verify: "Verificando", loader: "Entrando no modo de atualização", write: "Gravando",
reboot: "Reiniciando", done: "Pronto! O FM-1 agora é um FMini-1", e_support: "Apoio", h_support: "Suporte o projeto", l_support: "Foram mais de cem horas de trabalho voluntário (mesmo com a ajuda de IA). E sigo corrigindo bugs e implementando novas funções. Seria ótimo se você me apoiasse para continuar este trabalho!!!", btn_support: "Doar", tip_t: "Firmware instalado!", tip_b: "Se você gostar dele, considere dar uma ajuda para o projeto para continuar o aprimoramento dele. Obrigado!", tip_go: "Apoiar no Ko-fi", tip_x: "Fechar", donate: "Apoiar", donate_s: "☕", stopped: "Interrompido. Desconecte e reconecte o USB e aperte Instalar de novo.",
reboot: "Reiniciando", done: "Pronto! Seu teclado agora é um FMini-1", e_support: "Apoio", h_support: "Suporte o projeto", l_support: "Foram mais de cem horas de trabalho voluntário (mesmo com a ajuda de IA). E sigo corrigindo bugs e implementando novas funções. Seria ótimo se você me apoiasse para continuar este trabalho!!!", btn_support: "Doar", tip_t: "Firmware instalado!", tip_b: "Se você gostar dele, considere dar uma ajuda para o projeto para continuar o aprimoramento dele. Obrigado!", tip_go: "Apoiar no Ko-fi", tip_x: "Fechar", donate: "Apoiar", donate_s: "☕", stopped: "Interrompido. Desconecte e reconecte o USB e aperte Instalar de novo.",
error: "Erro: ",
denied: "O acesso ao MIDI (SysEx) não foi permitido. Permita o MIDI nas configurações do site (barra de endereço) e aperte Instalar de novo.",
notfound: "FM-1 não encontrado. Confira o cabo USB (precisa ser de dados), feche outros apps que usam MIDI e aperte Instalar de novo.",
model: "O aparelho conectado não é um FM-1.",
notfound: "Nenhum FM-1 ou SMK-37 encontrado. Confira o cabo USB (precisa ser de dados), feche outros apps que usam MIDI e aperte Instalar de novo.",
model: "O firmware não combina com o aparelho conectado: ",
unknown: "O aparelho conectado não é um FM-1 nem um SMK-37: ",
lost: "A conexão USB caiu. Reconecte e aperte Instalar de novo.",
noloader: "O FM-1 em modo de atualização não foi encontrado. Reconecte o USB e aperte Instalar de novo (ele fica em modo de atualização até terminar).",
noreturn: "O FM-1 não voltou. Desligue e ligue de novo.",
mismatch: "Gravado, mas o FM-1 informa outra versão: ",
noloader: "O aparelho em modo de atualização não foi encontrado. Reconecte o USB e aperte Instalar de novo (ele fica em modo de atualização até terminar).",
noreturn: "O aparelho não voltou. Desligue e ligue de novo.",
mismatch: "Gravado, mas o aparelho informa outra versão: ",
badpkg: "O arquivo a instalar está danificado. Recarregue a página.",
leave: "Gravando. Não feche a página.",
pick_t: "Qual destes é o seu FM-1?", pick_d: "Não achei o FM-1 pelo nome: outro firmware personalizado pode dar outro nome ao USB. Escolha na lista o dispositivo MIDI que é o FM-1 (com o USB dele conectado):", pick_b: "Instalar neste dispositivo", pick_c: "Cancelar",
busy_t: "Instalação em andamento: não feche esta página!", busy_d: "Pode trocar de aba ou de programa. Não feche a página, não desconecte o USB nem desligue o FM-1 até aparecer \"Pronto\". A tela do FM-1 pode ficar apagada ou reiniciar durante o processo: é normal.",
pick_t: "Qual é o seu teclado?", pick_d: "Não achei o FM-1 nem o SMK-37 pelo nome: outro firmware personalizado pode dar outro nome ao USB. Escolha a entrada MIDI do aparelho (com o USB dele conectado) e qual é o aparelho:", pick_port: "Entrada MIDI", pick_dev: "Dispositivo", pick_b: "Instalar neste dispositivo", pick_c: "Cancelar",
busy_t: "Instalação em andamento: não feche esta página!", busy_d: "Pode trocar de aba ou de programa. Não feche a página, não desconecte o USB nem desligue o teclado até aparecer \"Pronto\". A tela pode ficar apagada ou reiniciar durante o processo: é normal.",
license: "GPL-3.0, sem garantia. Código-fonte:",
ready: "Pronto. Conecte o FM-1 e aperte Instalar.",
ready: "Pronto. Conecte o FM-1 ou o SMK-37 e aperte Instalar.",
step1: "Conectar", step2: "Instalar", step3: "Tocar",
s1: "Ligue o FM-1 ao computador com um cabo USB de dados.", s2: "Aperte Instalar e mantenha o cabo conectado até aparecer Pronto.", s3: "O FM-1 reinicia como FMini-1, com a tela de abertura.",
s1: "Ligue o FM-1 ou o SMK-37 ao computador com um cabo USB de dados.", s2: "Aperte Instalar: o aparelho é detectado e o firmware certo é gravado. Mantenha o cabo conectado até aparecer Pronto.", s3: "O teclado reinicia como FMini-1, com a tela de abertura.",
ph_verify: "Verificar", ph_loader: "Modo de atualização", ph_write: "Gravar", ph_reboot: "Reiniciar", ph_done: "Pronto",
tagline: "Emulação do Minimoog para o FM-1 (mono/poly)",
tagline: "Emulação do Minimoog para o FM-1 e o SMK-37 (mono/poly)",
feat: "3 osciladores · filtro ladder · 200 presets · arpejador · MIDI",
risk: "Use por sua conta e risco", logT: "Detalhes", fw: "Firmware",
fwdl: "Baixar este firmware (.fwsc): a versão desta página",
fwdl: "Os firmwares desta página (.fwsc), para baixar:",
},
en: {
intro: "Connect the FM-1 by USB. (Works in Chrome or Edge.)",
intro: "Connect the FM-1 or the SMK-37 by USB. The installer recognises it and writes the right firmware. (Works in Chrome or Edge.)",
compat: "Supports the new FM-1 versions (with the UC25HQ80 flash chip).",
warn: "Do not unplug the USB cable while writing.",
install: "Install", other: "Português",
fw_pick: "Install another firmware (.fwsc)…", fw_bad: "This file is not a valid FM-1 firmware.",
fw_pick: "Install another firmware (.fwsc)…", fw_bad: "This file is not a valid firmware for the FM-1 or the SMK-37.",
smknote: "SMK-37 (Pro, Elite and MKE-P37): the first start clears the stock firmware's settings. To go back to the stock firmware, use M-Vave's firmware and updater for your model.",
det: "Detected device: ", det_ota: " (in update mode)", det_fw: " · installing FMini-1 ",
editor: "Editor (after installing: edit sounds and sequences from the computer)",
direct: "Connect the USB cable directly to the computer. No probe or Transporter is needed.",
beta: "FMini-1 is an experimental release. The author accepts no responsibility if your FM-1 is damaged or misbehaves because of this custom firmware. Use it at your own risk.",
beta: "FMini-1 is an experimental release. The author accepts no responsibility if your FM-1 or SMK-37 is damaged or misbehaves because of this custom firmware. Use it at your own risk.",
nomidi: "This browser cannot do it. Open the page in Chrome or Edge.", loadfail: "Could not load: ",
start: "Starting", verify: "Verifying", loader: "Switching to update mode", write: "Writing",
reboot: "Restarting", done: "Done", e_support: "Support", h_support: "Buy me a Coffee", l_support: "It took over a hundred hours for this voluntary work (even with the help of AI). And I am still fixing bugs and implementing new features. It would be great if you support me to continue this work!!!", btn_support: "Tip", tip_t: "Firmware installed!", tip_b: "If you like it, consider a tip to support the project. Thank you!", tip_go: "Support on Ko-fi", tip_x: "Close", donate: "Support", donate_s: "☕", stopped: "Stopped. Replug the USB cable and press Install again.",
reboot: "Restarting", done: "Done! Your keyboard is now an FMini-1", e_support: "Support", h_support: "Buy me a Coffee", l_support: "It took over a hundred hours for this voluntary work (even with the help of AI). And I am still fixing bugs and implementing new features. It would be great if you support me to continue this work!!!", btn_support: "Tip", tip_t: "Firmware installed!", tip_b: "If you like it, consider a tip to support the project. Thank you!", tip_go: "Support on Ko-fi", tip_x: "Close", donate: "Support", donate_s: "☕", stopped: "Stopped. Replug the USB cable and press Install again.",
error: "Error: ",
denied: "MIDI (SysEx) access was not allowed. Allow MIDI in the site settings (address bar) and press Install again.",
notfound: "FM-1 not found. Check the USB cable (a data cable), close other apps that use MIDI, and press Install again.",
model: "The connected device is not an FM-1.",
notfound: "No FM-1 or SMK-37 found. Check the USB cable (a data cable), close other apps that use MIDI, and press Install again.",
model: "The firmware does not match the connected device: ",
unknown: "The connected device is neither an FM-1 nor an SMK-37: ",
lost: "The USB connection was lost. Replug it and press Install again.",
noloader: "The FM-1 in update mode was not found. Replug the USB cable and press Install again (it stays in update mode until it is finished).",
noreturn: "The FM-1 did not come back. Power-cycle it.",
mismatch: "Written, but the FM-1 reports another version: ",
noloader: "The device in update mode was not found. Replug the USB cable and press Install again (it stays in update mode until it is finished).",
noreturn: "The device did not come back. Power-cycle it.",
mismatch: "Written, but the device reports another version: ",
badpkg: "The file to install is damaged. Reload the page.",
leave: "Writing. Do not close the page.",
pick_t: "Which one is your FM-1?", pick_d: "I could not find the FM-1 by name: another custom firmware may name its USB device differently. Pick the MIDI device that is the FM-1 from the list (with its USB connected):", pick_b: "Install on this device", pick_c: "Cancel",
busy_t: "Installing: do not close this page!", busy_d: "You can switch tabs or apps. Do not close the page, unplug the USB cable or power off the FM-1 until it says Done. The FM-1 screen may go blank or restart meanwhile: that is normal.",
pick_t: "Which is your keyboard?", pick_d: "I could not find the FM-1 or the SMK-37 by name: another custom firmware may name its USB device differently. Pick the device's MIDI input (with its USB connected) and which device it is:", pick_port: "MIDI input", pick_dev: "Device", pick_b: "Install on this device", pick_c: "Cancel",
busy_t: "Installing: do not close this page!", busy_d: "You can switch tabs or apps. Do not close the page, unplug the USB cable or power off the keyboard until it says Done. The screen may go blank or restart meanwhile: that is normal.",
license: "GPL-3.0, no warranty. Source:",
ready: "Ready. Connect your FM-1 and press Install.",
ready: "Ready. Connect your FM-1 or SMK-37 and press Install.",
step1: "Connect", step2: "Install", step3: "Play",
s1: "Plug the FM-1 into the computer with a USB data cable.", s2: "Press Install and keep the cable connected until it says Done.", s3: "The FM-1 restarts as FMini-1 with its splash screen.",
s1: "Plug the FM-1 or the SMK-37 into the computer with a USB data cable.", s2: "Press Install: the device is detected and the right firmware is written. Keep the cable connected until it says Done.", s3: "The keyboard restarts as FMini-1 with its splash screen.",
ph_verify: "Verify", ph_loader: "Update mode", ph_write: "Write", ph_reboot: "Restart", ph_done: "Done",
tagline: "A Minimoog emulation for the M-Vave FM-1 (mono/poly)",
tagline: "A Minimoog emulation for the M-Vave FM-1 and SMK-37 (mono/poly)",
feat: "3 oscillators · ladder filter · 200 presets · arpeggiator · MIDI",
risk: "Use at your own risk", logT: "Details", fw: "Firmware",
fwdl: "Download this firmware (.fwsc): this page's version",
fwdl: "This page's firmwares (.fwsc), to download:",
},
};
/* ---- the site: texts (PT / EN / JA) and the parts it draws itself ---- */
const SITE = {
pt: {
nav_f: "Som", nav_s: "Telas", nav_ft: "Features", nav_ed: "Editor", nav_i: "Instalar",
sub: "Um firmware aberto que transforma o M-VAVE FM-1 em um sintetizador monofônico e polifônico. O FMini-1 usa a técnica de Analog Circuit Modelling, criada a partir dos esquemas reais do Minimoog para reproduzir com precisão o comportamento do instrumento original: três osciladores, filtro ladder, contornos, efeitos e tudo ao alcance dos botões do FM-1.",
sub: "Um firmware aberto que transforma o M-VAVE FM-1 e o SMK-37 em sintetizadores monofônicos e polifônicos. O FMini-1 usa a técnica de Analog Circuit Modelling, criada a partir dos esquemas reais do Minimoog para reproduzir com precisão o comportamento do instrumento original: três osciladores, filtro ladder, contornos, efeitos e tudo ao alcance dos botões e knobs do seu teclado.",
chip_f: "Filtro ladder", chip_p: "200 presets",
cta_install: "Instalar agora", cta_screens: "Ver as telas",
h_sound: "O som", l_sound: "Cada bloco do painel do Minimoog tem seu lugar na tela de 240 × 240 do FM-1, com quatro knobs físicos para tocar de verdade.",
h_sound: "O som", l_sound: "Cada bloco do painel do Minimoog tem seu lugar na tela de 240 × 240, a mesma no FM-1 e no SMK-37, com knobs físicos para tocar de verdade.",
f1t: "Banco de osciladores", f1d: "Três osciladores com faixas de LO a 2', forma de onda individual, ajuste fino (detune) independente nos osciladores 2 e 3 e uma leve deriva de afinação, como a dos VCOs analógicos.",
f2t: "Filtro ladder", f2d: "Ladder de 4 polos, 24 dB/oitava, com saturação em cada estágio e o atraso de realimentação do circuito do Minimoog. Com a ênfase a partir de 8 o filtro auto-oscila numa senoide pura que acompanha o teclado em 1 V/oitava. O corte é lido de −5 a +5, como no painel.",
f3t: "Contornos", f3d: "Dois contornos (filtro e volume) com ataque, decaimento e sustentação. O ataque é exponencial, como o do circuito original. Glide, LFO e modulação completam a seção.",
f4t: "200 presets", f4d: "Vinte grupos de dez: uma vitrine de estilos, hard leads, soft leads, baixos, pads e cordas, metais, plucks, teclas, atmosferas e efeitos sonoros.",
f5t: "Arpejador e sequenciador", f5d: "Um toque no ARP liga e desliga; segurar ativa o HOLD. O sequenciador grava até 64 notas (REC) e toca (PLAY). Os LEDs das teclas acendem junto com as notas.",
f5t: "Arpejador e sequenciador", f5d: "Um toque no ARP liga e desliga; segurar ativa o HOLD. O sequenciador grava até 64 notas (REC) e toca (PLAY). Os LEDs das teclas (no SMK-37, os pads) acendem junto com as notas.",
f6t: "Efeitos por preset", f6d: "Reverb, delay, chorus e drive, cada preset com a sua própria combinação, para que baixos, leads e pads tenham ambientes bem diferentes.",
h_screens: "As telas", l_screens: "O painel foi desenhado para a tela do FM-1, com knobs estriados, chaves vermelhas e azuis e gráficos de filtro e contornos. Escolha uma página:",
h_screens: "As telas", l_screens: "O painel foi desenhado para a tela do FM-1 e do SMK-37, com knobs estriados, chaves vermelhas e azuis e gráficos de filtro e contornos. Escolha uma página:",
views: [
{ t: "CTRL · Controladores", d: "Afinação geral, glide, quantidade de modulação e velocidade do LFO (botão LFO).", l: ["Quatro knobs: TUNE, GLIDE, MOD MIX e LFO RATE", "Chaves MOD OSC, MOD FLT, GLIDE e LFO SQR"] },
{ t: "OSC · Banco de osciladores", d: "Os três osciladores: faixa de oitava, forma de onda e detune dos osciladores 2 e 3.", l: ["Faixas LO, 32', 16', 8', 4' e 2'", "Seis formas de onda, desenhadas nas caixas da tela"] },
@@ -1209,26 +1309,35 @@ const SITE = {
ft2t: "Mono e 12 vozes", ft2d: "Monofônico como o Minimoog, ou polifônico com 12 vozes.",
ft3t: "Emulação perfeita", ft3d: "Três osciladores, mixer com saturação suave e filtro ladder de 24 dB/oitava com auto-oscilação, modelados no Minimoog Model D.",
ft4t: "Efeitos", ft4d: "5 reverbs (Room, Hall, Plate, Spring, Cloud), 7 delays (Analog, Digital, Tape, Ping-Pong, Multi, Slap, Reverse), 3 chorus (Stereo, Juno, Multi) e drive (Soft, Tube).",
ft5t: "MIDI CC para controladores", ft5d: "50 controles com CC próprio, que você pode trocar, e o FMini-1 aprende o CC que o controlador enviar. Entrada USB e TRS, filtro de canal, pitch bend e roda de modulação (vibrato).",
ft5t: "MIDI CC para controladores", ft5d: "50 controles com CC próprio, que você pode trocar, e o FMini-1 aprende o CC que o controlador enviar. Entrada USB (e TRS no FM-1), filtro de canal, pitch bend e roda de modulação (vibrato).",
ft6t: "Sequenciador de 64 notas", ft6d: "Grave até 64 notas (REC) e toque (PLAY).",
ft7t: "Arpegiador", ft7d: "Um toque liga e desliga, segurar ativa o HOLD.",
ft8t: "Editor web", ft8d: "Edite sons e presets pelo navegador, ligado ao FM-1 por USB-MIDI.",
ft9t: "Emulador online", ft9d: "Experimente o FMini-1 no navegador, sem instalar nada.",
h_install: "Instalar", l_install: "O instalador roda aqui mesmo, no navegador, e grava o firmware no FM-1 pelo cabo USB.",
ft9t: "Emuladores online", ft9d: "Experimente o FMini-1 no navegador, no FM-1 ou no SMK-37, sem instalar nada.",
h_install: "Instalar", l_install: "O instalador roda aqui mesmo, no navegador: reconhece se o aparelho é um FM-1 ou um SMK-37 e grava o firmware certo pelo cabo USB.",
h_smk: "Também no SMK-37", l_smk: "O mesmo FMini-1, a mesma tela e os mesmos 200 presets no teclado de 37 teclas da M-Vave, com tudo o que ele tem a mais: pads, faders, oito knobs e MIDI OUT completo.",
k1t: "37 teclas com velocity", k1d: "Três oitavas inteiras, com OCTAVE− e OCTAVE+. No PRESET SETTINGS, VELOCITY SENS. liga ou desliga a dinâmica de cada preset.",
k2t: "16 pads", k2d: "Escolhem os presets da página atual (o selecionado aceso) e, no sequenciador, mostram os 64 passos em quatro janelas coloridas.",
k3t: "4 faders, 4 bancos", k3d: "FADER BANK alterna entre A.ENV, F.ENV, MIX e os knobs da tela, com um aviso na tela a cada troca.",
k4t: "8 knobs, 4 bancos", k4d: "K1 é o volume, K2 a K4 trocam de preset e navegam, e K5 a K8 controlam FILTER, LFO, FX ou os knobs da tela (KNOB BANK).",
k5t: "MIDI OUT completo", k5d: "Teclas, pads, knobs, faders e as rodas saem por USB e pela saída TRS, com canal de saída próprio.",
k6t: "Pro, Elite e MKE-P37", k6d: "Um firmware para cada modelo. O instalador reconhece qual é o seu e grava o certo.",
btn_smkemu: "Testar o SMK-37 no navegador",
try_fm1: "emulador", try_smk: "emulador",
},
en: {
nav_f: "Sound", nav_s: "Screens", nav_ft: "Features", nav_ed: "Editor", nav_i: "Install",
sub: "An open firmware that turns the M-VAVE FM-1 into a monophonic and polyphonic synth. FMini-1 uses Analog Circuit Modelling, built from the actual Minimoog schematics to accurately reproduce the behaviour of the real instrument: three oscillators, a ladder filter, contours and effects, all within reach of the FM-1's buttons.",
sub: "An open firmware that turns the M-VAVE FM-1 and SMK-37 into monophonic and polyphonic synths. FMini-1 uses Analog Circuit Modelling, built from the actual Minimoog schematics to accurately reproduce the behaviour of the real instrument: three oscillators, a ladder filter, contours and effects, all within reach of your keyboard's buttons and knobs.",
chip_f: "Ladder filter", chip_p: "200 presets",
cta_install: "Install now", cta_screens: "See the screens",
h_sound: "The sound", l_sound: "Each block of the Minimoog panel has its place on the FM-1's 240 × 240 screen, with four real knobs to play it for real.",
h_sound: "The sound", l_sound: "Each block of the Minimoog panel has its place on the 240 × 240 screen, the same on the FM-1 and the SMK-37, with real knobs to play it for real.",
f1t: "Oscillator bank", f1d: "Three oscillators with ranges from LO to 2', a waveform each, independent detune on oscillators 2 and 3 and a touch of pitch drift, like analog VCOs.",
f2t: "Ladder filter", f2d: "A four-pole ladder, 24 dB/octave, with saturation in every stage and the feedback lag of the Minimoog circuit. From emphasis 8 up it self-oscillates as a pure sine that follows the keyboard at 1 V/octave. Cutoff reads -5 to +5, as on the panel.",
f3t: "Contours", f3d: "Two contours (filter and loudness) with attack, decay and sustain. The attack is exponential, like the original circuit. Glide, LFO and modulation complete the section.",
f4t: "200 presets", f4d: "Twenty groups of ten: a showcase of styles, hard leads, soft leads, basses, pads and strings, brass, plucks, keys, atmospheres and sound effects.",
f5t: "Arpeggiator and sequencer", f5d: "One tap on ARP turns it on and off; holding it sets HOLD. The sequencer records up to 64 notes (REC) and plays them (PLAY). The key LEDs light with the notes.",
f5t: "Arpeggiator and sequencer", f5d: "One tap on ARP turns it on and off; holding it sets HOLD. The sequencer records up to 64 notes (REC) and plays them (PLAY). The key LEDs (the pads on the SMK-37) light with the notes.",
f6t: "Effects per preset", f6d: "Reverb, delay, chorus and drive, each preset with its own combination, so basses, leads and pads live in very different spaces.",
h_screens: "The screens", l_screens: "The panel is drawn for the FM-1's screen, with fluted knobs, red and blue rocker switches and graphs of the filter and contours. Pick a page:",
h_screens: "The screens", l_screens: "The panel is drawn for the screen of the FM-1 and the SMK-37, with fluted knobs, red and blue rocker switches and graphs of the filter and contours. Pick a page:",
views: [
{ t: "CTRL · Controllers", d: "Master tune, glide, modulation amount and LFO speed (the LFO button).", l: ["Four knobs: TUNE, GLIDE, MOD MIX and LFO RATE", "Switches MOD OSC, MOD FLT, GLIDE and LFO SQR"] },
{ t: "OSC · Oscillator bank", d: "The three oscillators: octave range, waveform and detune for oscillators 2 and 3.", l: ["Ranges LO, 32', 16', 8', 4' and 2'", "Six waveforms, drawn in the boxes on the screen"] },
@@ -1253,25 +1362,34 @@ const SITE = {
ft2t: "Mono and 12 voices", ft2d: "Monophonic like the Minimoog, or polyphonic with 12 voices.",
ft3t: "Minimoog model", ft3d: "Three oscillators, a mixer that overloads softly and a 24 dB/oct ladder filter that self-oscillates, modelled on the Minimoog Model D.",
ft4t: "Effects", ft4d: "5 reverbs (Room, Hall, Plate, Spring, Cloud), 7 delays (Analog, Digital, Tape, Ping-Pong, Multi, Slap, Reverse), 3 choruses (Stereo, Juno, Multi) and drive (Soft, Tube).",
ft5t: "MIDI CC for controllers", ft5d: "50 controls with their own CC, which you can change, and the FMini-1 learns the CC your controller sends. USB and TRS input, channel filter, pitch bend and mod wheel (vibrato).",
ft5t: "MIDI CC for controllers", ft5d: "50 controls with their own CC, which you can change, and the FMini-1 learns the CC your controller sends. USB input (and TRS on the FM-1), channel filter, pitch bend and mod wheel (vibrato).",
ft6t: "64-note sequencer", ft6d: "Record up to 64 notes (REC) and play them back (PLAY).",
ft7t: "Arpeggiator", ft7d: "One tap turns it on and off, holding it enables HOLD.",
ft8t: "Web editor", ft8d: "Edit sounds and presets in the browser, connected to the FM-1 over USB-MIDI.",
ft9t: "Online emulator", ft9d: "Try the FMini-1 in your browser, with nothing to install.",
h_install: "Install", l_install: "The installer runs right here, in the browser, and writes the firmware to the FM-1 over the USB cable.",
ft9t: "Online emulators", ft9d: "Try the FMini-1 in your browser, on the FM-1 or the SMK-37, with nothing to install.",
h_install: "Install", l_install: "The installer runs right here, in the browser: it recognises whether the device is an FM-1 or an SMK-37 and writes the right firmware over the USB cable.",
h_smk: "On the SMK-37 too", l_smk: "The same FMini-1, the same screen and the same 200 presets on M-Vave's 37-key keyboard, with everything it adds: pads, faders, eight knobs and a full MIDI OUT.",
k1t: "37 keys with velocity", k1d: "Three whole octaves, with OCTAVE− and OCTAVE+. In PRESET SETTINGS, VELOCITY SENS. turns each preset's dynamics on or off.",
k2t: "16 pads", k2d: "They pick the presets of the current page (the chosen one lit) and, in the sequencer, show the 64 steps in four coloured windows.",
k3t: "4 faders, 4 banks", k3d: "FADER BANK switches between A.ENV, F.ENV, MIX and the screen's knobs, with a note on the screen at each change.",
k4t: "8 knobs, 4 banks", k4d: "K1 is the volume, K2 to K4 change presets and navigate, and K5 to K8 set FILTER, LFO, FX or the screen's knobs (KNOB BANK).",
k5t: "Full MIDI OUT", k5d: "Keys, pads, knobs, faders and the wheels go out over USB and the TRS jack, on their own output channel.",
k6t: "Pro, Elite and MKE-P37", k6d: "A firmware for each model. The installer recognises yours and writes the right one.",
btn_smkemu: "Try the SMK-37 in your browser",
try_fm1: "emulator", try_smk: "emulator",
},
};
for (const l in SITE) Object.assign(TEXT[l], SITE[l]);
const SITE2 = {
pt: { announce: "Firmware gratuito e de código aberto para o M-VAVE FM-1", e_sound: "Som", h_sound: "Três osciladores, um filtro ladder e muito corpo", e_screens: "Telas", h_screens: "Cada página, uma seção do painel",
pt: { announce: "Firmware gratuito e de código aberto para o M-VAVE FM-1 e SMK-37", e_sound: "Som", h_sound: "Três osciladores, um filtro ladder e muito corpo", e_screens: "Telas", h_screens: "Cada página, uma seção do painel",
e_feat: "Features", h_feat: "Tudo o que o FMini-1 faz", e_install: "Instalar", h_install: "Instale direto do navegador" },
en: { announce: "Free, open-source firmware for the M-VAVE FM-1", e_sound: "Sound", h_sound: "Three oscillators, a ladder filter and plenty of body", e_screens: "Screens", h_screens: "Every page, one section of the panel",
en: { announce: "Free, open-source firmware for the M-VAVE FM-1 and SMK-37", e_sound: "Sound", h_sound: "Three oscillators, a ladder filter and plenty of body", e_screens: "Screens", h_screens: "Every page, one section of the panel",
e_feat: "Features", h_feat: "Everything the FMini-1 does", e_install: "Install", h_install: "Install straight from the browser" },
};
for (const l in SITE2) Object.assign(TEXT[l], SITE2[l]);
const SITE3 = {
pt: { hero2_t: "Um clássico dentro do FM-1.", hero2_s: "Firmware gratuito. Instale direto do navegador e volte ao original quando quiser.", hint: "Role" },
en: { hero2_t: "A classic, inside the FM-1.", hero2_s: "Free firmware. Install straight from the browser and go back to the original whenever you like.", hint: "Scroll" },
pt: { hero2_t: "Um clássico dentro do FM-1 e do SMK-37.", hero2_s: "Firmware gratuito. Instale direto do navegador e volte ao original quando quiser.", hint: "Role" },
en: { hero2_t: "A classic, inside the FM-1 and the SMK-37.", hero2_s: "Free firmware. Install straight from the browser and go back to the original whenever you like.", hint: "Scroll" },
};
for (const l in SITE3) Object.assign(TEXT[l], SITE3[l]);
const SITE4 = {
@@ -1283,7 +1401,7 @@ for (const l in SITE4) Object.assign(TEXT[l], SITE4[l]);
const IMG = {"aenv": "data:image/webp;base64,UklGRs79AABXRUJQVlA4IML9AADwnQSdASrAA8ADPj0cjEQiIaGSmT18IAPEs7d6WL3fWpH+3/hv61vAHrxed70Y7WeBheRLLLzFr0556a3rmYfdFz8R52z+z+1W5gu4c7Ydef/zvzP/s/v6c5+bXuLw58Zvuj4hfE/+T/rfcz7/PMP+U/sH9y/Z/5zf9T/1/qr/vfnl/Xv+X/wPcE/Tn/W/1r+8fB38nvg7/YvQ7/Uf9n+3Huof+L96Pfr/Uv9r7B/9G/23///33/u+Lz/2ezv6Gf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W_TAB = ["CTRL", "OSC", "MIX", "FILT", "F.ENV", "A.ENV", "FX"];
const PRESET_NAMES = ["MINI LEAD", "MOOG BASS", "PLUCK ARP", "PAD SWELL", "SINE SOLO", "SPACE DRONE", "CS-80 BRASS", "LUSH STRINGS", "AURA ATMOS", "UFO"];
let viewIdx = 0;
@@ -1326,20 +1444,25 @@ const nl = (navigator.language || "en").toLowerCase();
let lang = nl.startsWith("pt") ? "pt" : "en";
const LANGS = ["pt", "en"];
const t = (k) => TEXT[lang][k];
let lastKey = null, lastArg = "";
let lastKey = null, lastArg = "", detKey = null; /* (detKey: the device step 1 found, shown again on a language change) */
function applyLang() {
document.documentElement.lang = lang;
document.querySelectorAll("[data-t]").forEach((e) => { e.textContent = t(e.dataset.t); });
$("tipx").textContent = t("tip_x");
$("lang").textContent = lang === "pt" ? "PT" : "EN";
if (lastKey) $("status").textContent = t(lastKey) + lastArg;
if (detKey) showDetected(detKey.label, detKey.ota, detKey.pk);
renderSite();
}
$("tipx").addEventListener("click", () => { $("tip").hidden = true; });
/* "Try in browser": the two emulators, FM-1 and SMK-37 */
$("trybtn").addEventListener("click", (e) => { e.stopPropagation(); const open = $("trymenu").hidden; $("trymenu").hidden = !open; $("trybtn").setAttribute("aria-expanded", String(open)); });
document.addEventListener("click", (e) => { if (!$("trymenu").hidden && !e.target.closest(".trywrap")) { $("trymenu").hidden = true; $("trybtn").setAttribute("aria-expanded", "false"); } });
addEventListener("keydown", (e) => { if (e.key === "Escape") { $("trymenu").hidden = true; $("trybtn").setAttribute("aria-expanded", "false"); } });
$("tip").addEventListener("click", (e) => { if (e.target.id === "tip") $("tip").hidden = true; });
$("lang").addEventListener("click", () => { lang = LANGS[(LANGS.indexOf(lang) + 1) % LANGS.length]; applyLang(); });
applyLang();
const sayK = (k, arg = "") => { lastKey = k; lastArg = arg; $("status").textContent = t(k) + arg; if (k === "done") $("tip").hidden = false; document.body.classList.toggle("bad", ["error","denied","notfound","model","lost","noloader","noreturn","mismatch","badpkg","stopped","loadfail","nomidi","fw_bad"].includes(k)); };
const sayK = (k, arg = "") => { lastKey = k; lastArg = arg; $("status").textContent = t(k) + arg; if (k === "done") $("tip").hidden = false; document.body.classList.toggle("bad", ["error","denied","notfound","model","unknown","lost","noloader","noreturn","mismatch","badpkg","stopped","loadfail","nomidi","fw_bad"].includes(k)); };
const say = (txt) => { lastKey = null; $("status").textContent = txt; };
const log = (t) => { $("log").textContent += t + "\n"; };
const PHASES = ["verify", "loader", "write", "reboot", "done"];
@@ -1373,12 +1496,20 @@ function writeBar(n) {
}, 100);
}
function stopCrawl() { if (crawl) clearInterval(crawl); crawl = null; }
let image = null;
const meta = {"version": "2.5.5", "product": "FM-1_900", "pkg": "data:application/octet-stream;base64,TfmffYdxdfjywadnzr9bl05dC0HgzSdOnBkTJkyYMGDAoUKECDFDhgwYMGDhwoRHCBAgQIAAIWPnzr1blw8/X5//358fLrd8+PDFo2fOjVKXDy41eNGDJ06cGRMmTJhPMGDAoUKECDFDhgwYMGDhwoQIECBAgAAhY+fOvVuXDz9fn1gQmaLrKG5QHOTIkAEwI0aMm9+eH2HafPjw9apnVqZbl68FPHjRgydOnBkTJkyYMGDAoUKECDFDhgwYMGA14cKECBAgQIAAIWPnzr1blw8/X59RCJn/4W9iOXLkyJABI0aM//////////////9k//////////////////////////////////////////////////////////////8///////////////////////////////////////////////////////////////83//////////////////////////////////////////////////////////////84//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99////////////////////////////////////////////////////////////////////////////////////////////////////////////////XgO/HTAuMDHwMaxn3q3/aEFDNzkxTl9TVE9SWf////9lumXFvz58+Dj5o2fOvVuXenxTF6WtRSHzbRPZs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3o/lOEiEb/qQ/9g4IALAO8QAPefdAQ04fsPRBcE/CQCNOH/P0QXBPwfBHTh8ACk4SAS4eEwEODhwA8QGOHhBiAQGDGhEBjB//VhwAEQGEHgfvjY7gFBceHwIKHhIDIxJ0Lgf/jY7gESVAR/BOKVwv8AZcABQCCoQSlCceF/EIuEgSAx1qlCAImQBcv/9WHAAQrhAbBEJQSfxBSiFgSXRSAhFgSPRyMWFgSJ1Line truncated
let product = meta.product; /* the package to install: the site's, or one chosen below */
document.querySelectorAll(".curver").forEach((e) => { e.textContent = "v" + meta.version; });
document.querySelectorAll(".curver-b").forEach((e) => { e.textContent = "(v" + meta.version + ")"; });
{ const dl = document.getElementById("fwdl"); if (dl) { dl.href = meta.pkg; dl.download = "FMini-1-" + meta.version + ".fwsc"; } }
/* the packages: the FM-1's and the SMK-37's (Pro, Elite, MKE-P37), each for exactly one model (fm1ota.js sameModel) */
const meta = {"version": "2.5.5", "smkVersion": "2.5.12", "pkgs": [{"product": "FM-1_900", "label": "FM-1", "file": "fmini-1-fm1-2.5.5.fwsc", "version": "2.5.5", "pkg": "data:application/octet-stream;base64,TfmffYdxdfjywadnzr9bl05dC0HgzSdOnBkTJkyYMGDAoUKECDFDhgwYMGDhwoRHCBAgQIAAIWPnzr1blw8/X5//358fLrd8+PDFo2fOjVKXDy41eNGDJ06cGRMmTJhPMGDAoUKECDFDhgwYMGDhwoQIECBAgAAhY+fOvVuXDz9fn1gQmaLrKG5QHOTIkAEwI0aMm9+eH2HafPjw9apnVqZbl68FPHjRgydOnBkTJkyYMGDAoUKECDFDhgwYMGA14cKECBAgQIAAIWPnzr1blw8/X59RCJn/4W9iOXLkyJABI0aM//////////////9k//////////////////////////////////////////////////////////////8///////////////////////////////////////////////////////////////83//////////////////////////////////////////////////////////////84//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99//////////////////////////////////////////////////////////////99////////////////////////////////////////////////////////////////////////////////////////////////////////////////XgO/HTAuMDHwMaxn3q3/aEFDNzkxTl9TVE9SWf////9lumXFvz58+Dj5o2fOvVuXenxTF6WtRSHzbRPZs2fPn5hCQAV3B3z43cGjZ8w9W5dmbVgnsuxJKPV+PU8i8TCfWaJg4B9+fPgPPlyYT0Jbl25uTCe16lUR9HxyQkxnz58i2WDgH85z+PDRo2fcvKRoZHtFJ7ziRE5j5uzZs2fPnwEAuDgAIMABEAAAACuuIU7Y6AcAwP/IIEtlQCBk4IABwP/gWMABQSDC/2ANAACiogIDgQXyXdToBwDE/zYgwAFk4IBAgQDt/+BcwAHu/+BgwAHA6ssLAADC/wA1AQBB6gAgBIMDB6Ng+T/xXCAAIGGAF4AAdQTF//RhwAFZQIFVxP/0YMABQShAFnGGSmR5P4LoCgAE6wYAEhkRP7LoAABBIbDoAABBIdlAERdAITHo/wBAIFUEwP/0YMABAGGw4UAEgAB2BARgBSTNQQVhUtgGY0AWxgBWBHkE4pAYFgYWTCLJ/0BmwAEEgVQY2O5AWQVbFfgZ/rTgQAkJgY+AUiBwFoDq1xlwFoDqzhlAGAyCcBZhFoDqeBnwSLTgQBmAFlIWgOrHGQSBRSBQFgKQWQR1BAQWxf/MVcABQiNRFoDqRxkQQlmEQiNAFoDqQRkAXlmIQiNAFoDqOxkAWlmMQiNAFoDqNRkAVkhAAPgViID4K6BU7kEAMeG/DxEXAfwSDgCkMOHwCwSTUChVBFApVQRQKlUEUCtVBElBUCYB+CWgUCdVBAEXAfgjoIH4HaRU7kIQVO5DIOHhChAhGDHh8B0B/gIeEBhVBAHhO1BCJUAWgOr+GABLAeFBUEIlQBaA6vcYARZQJwFBECpVBFAmVQRQIFUEwP8IAAEAAWCx8QgYAGDC/wBlwAEiaMEh9OEgEbDhDATAIfThEACAA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xg0P+H+e4VRxf1OYf56g3MIEQXzSCE+eUNYBe04BCjMCJL4AEAAPjVmRSd9OEBGROkEheJHgL8Dw5j4fgQiIgz6QhAAeH4EIiA2O4AAhEXlOGCEb/qav8L4QKwsOEhsNjuoADQVwSfVO4GFFTuByRQ7gUE4eEKEBIY6D8AFwHh8CAA/BAOZOH4EIuINOkIQAHh6CCLgNjuMAARF3o/lOEiEb/qQ/9g4IALAO8QAPefdAQ04fsPRBcE/CQCNOH/P0QXBPwfBHTh8ACk4SAS4eEwEODhwA8QGOHhBiAQGDGhEBjB//VhwAEQGEHgfvjY7gFBceHwIKHhLine truncated
const PKGS = meta.pkgs; /* [{product, label, file, version, pkg}] */
const modelOf = (product) => product.split("_")[0];
const images = {}; /* product -> the logical image */
let picked = null; /* "Install another firmware": {image, product} */
let ready = false;
document.querySelectorAll(".curver").forEach((e) => { e.textContent = "FM-1 v" + meta.version + " · SMK-37 v" + meta.smkVersion; });
document.querySelectorAll(".curver-b").forEach((e) => { e.textContent = ""; });
for (const p of PKGS) {
const li = document.createElement("li"), a = document.createElement("a"), sp = document.createElement("span");
a.href = p.pkg; a.download = p.file; a.textContent = p.label + " · v" + p.version; sp.textContent = p.file;
li.append(a, sp); $("fwlist").appendChild(li);
}
let writing = false;
let wake = null;
@@ -1405,28 +1536,41 @@ const holdPage = (on) => {
if (holdAudio) { holdAudio.close().catch(() => {}); holdAudio = null; }
}
};
const lockInstaller = (on) => { keepAwake(on); holdPage(on); writing = on; $("go").disabled = on || !image; };
const lockInstaller = (on) => { keepAwake(on); holdPage(on); writing = on; $("go").disabled = on || !ready; };
document.addEventListener("visibilitychange", () => { if (!document.hidden && writing) keepAwake(true); });
window.addEventListener("beforeunload", (e) => { if (writing) { e.preventDefault(); e.returnValue = t("leave"); } });
(async () => {
if (!navigator.requestMIDIAccess) { sayK("nomidi"); return; }
try {
const r = await fetch(meta.pkg);
if (!r.ok) throw new Error(`${meta.pkg}: HTTP ${r.status}`);
const pkg = new Uint8Array(await r.arrayBuffer());
if (productOf(pkg) !== product) { sayK("badpkg"); return; }
image = logicalImage(pkg);
for (const p of PKGS) {
const r = await fetch(p.pkg);
if (!r.ok) throw new Error(`${p.file}: HTTP ${r.status}`);
const pkg = new Uint8Array(await r.arrayBuffer());
if (productOf(pkg) !== p.product) { sayK("badpkg"); return; }
images[p.product] = logicalImage(pkg);
}
ready = true;
say(t("ready"));
$("go").disabled = false;
setBar(0, null);
} catch (e) { sayK("loadfail", e.message); }
})();
async function runInstall(portName) {
/* step 1 done: which device, and what goes on it */
function showDetected(label, ota, pk) {
detKey = { label, ota, pk };
const box = $("detected");
box.innerHTML = "";
const b = document.createElement("b"); b.textContent = label;
box.append(t("det"), b, (ota ? t("det_ota") : "") + (pk ? t("det_fw") + "v" + pk.version : ""));
box.hidden = false;
}
async function runInstall(portName, chosen) {
if (writing) return;
if ($("portpick").open) $("portpick").close();
lockInstaller(true);
$("detected").hidden = true; detKey = null;
let midi;
try { midi = await navigator.requestMIDIAccess({ sysex: true }); }
catch (e) { sayK("denied"); lockInstaller(false); return; }
@@ -1444,13 +1588,18 @@ async function runInstall(portName) {
if (k === "reboot") { stopCrawl(); sayK("reboot"); setBar(100, "reboot"); }
if (k === "done") { stopCrawl(); setBar(100, "done"); sayK("done"); }
};
const ota = await up.find((id) => /^ota-/i.test(id.model));
if (ota) {
ota.link.close();
sayK((await up.resume(image, step, product)) ? "done" : "stopped");
} else {
await up.install(image, product, step);
}
/* which device is it: its identity (the running firmware's, or the update loader's) */
const dev = await up.find(() => true);
if (!dev && !portName) { sayK("notfound"); offerPorts(midi); lockInstaller(false); return; }
const ota = !!dev && /^ota-/i.test(dev.id.model);
const model = dev ? dev.id.model.replace(/^ota-/i, "") : chosen;
if (dev) dev.link.close();
const pk = picked ? { product: picked.product, version: picked.version || "?", label: modelOf(picked.product) } : PKGS.find((p) => modelOf(p.product) === model);
if (!pk) { sayK("unknown", dev ? dev.id.text : String(model)); lockInstaller(false); return; }
showDetected(dev ? model : chosen, ota, pk);
const image = picked ? picked.image : images[pk.product];
if (ota) sayK((await up.resume(image, step, pk.product)) ? "done" : "stopped");
else await up.install(image, pk.product, step);
} catch (e) {
if (e && e.code && TEXT[lang][e.code]) sayK(e.code, e.detail || "");
else sayK("error", e && e.message);
@@ -1459,7 +1608,8 @@ async function runInstall(portName) {
}
lockInstaller(false);
}
// not found by name (another custom firmware may name its USB device differently): the player picks the MIDI port
// not found by name (another custom firmware may name its USB device differently): the player picks the MIDI port and
// the device
function offerPorts(midi) {
const names = [...new Set([...midi.inputs.values()].filter((i) => i.state !== "disconnected").map((i) => i.name).filter(Boolean))];
const sel = $("portsel");
@@ -1468,9 +1618,13 @@ function offerPorts(midi) {
sel.selectedIndex = 0;
if (names.length && $("portpick").showModal) $("portpick").showModal();
}
$("portgo").addEventListener("click", () => { const n = $("portsel").value; $("portpick").close(); if (n) runInstall(n); });
$("portgo").addEventListener("click", () => {
const n = $("portsel").value, d = (document.querySelector('#devsel input:checked') || {}).value || "FM-1";
$("portpick").close();
if (n) runInstall(n, d);
});
$("portno").addEventListener("click", () => $("portpick").close());
$("go").addEventListener("click", () => runInstall(null));
$("go").addEventListener("click", () => runInstall(null, null));
const hasMarker = (b) => { const m = "FELUCCA-LOADER-1"; for (let i = 0; i + m.length <= b.length; i++) { let k = 0; while (k < m.length && b[i + k] === m.charCodeAt(k)) k++; if (k === m.length) return true; } return false; };
$("fwpick").addEventListener("click", () => $("fwfile").click());
$("fwfile").addEventListener("change", async (e) => {
@@ -1480,63 +1634,93 @@ $("fwfile").addEventListener("change", async (e) => {
try {
const pkg = new Uint8Array(await file.arrayBuffer());
const prod = productOf(pkg);
if (!/^FM-1_9\d\d$/.test(prod) || !hasMarker(pkg)) { sayK("fw_bad"); $("go").disabled = true; image = null; return; }
image = logicalImage(pkg);
product = prod;
if (!/^(FM-1|SMK-37 Pro|SMK-37 Elite|MKE-P37)_9\d\d$/.test(prod) || !hasMarker(pkg)) { sayK("fw_bad"); picked = null; return; }
picked = { image: logicalImage(pkg), product: prod, version: (file.name.match(/(\d+\.\d+\.\d+)/) || [])[1] };
say(`${file.name} (${prod})`);
$("go").disabled = false;
$("go").disabled = !ready;
setBar(0, null);
} catch (_) { sayK("fw_bad"); $("go").disabled = true; image = null; }
} catch (_) { sayK("fw_bad"); picked = null; }
});
/* ---- hero: the Minimoog goes into the FM-1's screen as the page scrolls (reduced motion: the finished picture) ---- */
/* ---- hero: the Minimoog splits in two as the page scrolls: one dives into the FM-1's screen, the other into the
* SMK-37's; the two keyboards then show the real screens, each its own page (reduced motion: the finished picture) ---- */
(() => {
const hero = $("top"), stage = $("stage"), mm = $("mm"), fm = $("fm"), lcd = $("lcd"), copy1 = $("copy1"), copy2 = $("copy2"), hint = $("hint");
const A = $("lcd-a"), B = $("lcd-b");
const hero = $("top"), stage = $("stage"), mm = $("mm"), mm2 = $("mm2"), fm = $("fm"), smk = $("smkfig"), lcd = $("lcd"), lcd2 = $("lcd2");
const copy1 = $("copy1"), copy2 = $("copy2"), hint = $("hint");
const A = $("lcd-a"), B = $("lcd-b"), A2 = $("lcd2-a"), B2 = $("lcd2-b");
$("fm-body").src = IMG.fm1;
$("smk-body").src = IMG.smk37;
mm2.src = mm.src;
const ROT = ["splash", "ctrl", "osc", "mix", "filt", "fenv", "aenv", "fx"];
const rm = matchMedia("(prefers-reduced-motion: reduce)").matches;
if (rm) document.body.classList.add("rm");
A.src = IMG.splash; A.style.opacity = 1; B.style.opacity = 0;
A2.src = IMG.splash; A2.style.opacity = 1; B2.style.opacity = 0;
const clamp = (x, a = 0, b = 1) => Math.max(a, Math.min(b, x));
const ease = (x) => x * x * (3 - 2 * x);
let prog = 0, W = 0, H = 0, fmW = 0, fmH = 0, fmX = 0, fmY = 0, mmW0 = 0, mmX0 = 0, mmY0 = 0, p = -1, rot = 0, rotAt = 0;
const MR = 452 / 900, FR = 512 / 859;
/* the two pictures: the FM-1 (859 x 512) and the SMK-37 (1872 x 827); where each screen is in its picture */
const MR = 452 / 900, FR = 512 / 859, SR = 827 / 1872;
const FL = [0.3073, 0.1523, 0.1676, 0.283], SL = [0.13702, 0.11423, 0.17107, 0.38713];
let prog = 0, W = 0, H = 0, mob = false, p = -1, rot = 0, rotAt = 0;
let fmW = 0, fmH = 0, fmX = 0, fmY = 0, smW = 0, smH = 0, smX = 0, smY = 0, mmW0 = 0, mmX0 = 0, mmY0 = 0;
function layout() {
W = stage.clientWidth; H = stage.clientHeight;
const mob = W < 820;
const c2h = copy2.offsetHeight || 200, gap = mob ? 22 : 30;
fmY = mob ? H * 0.2 : Math.max(18, H * 0.05);
fmW = Math.min(W * (mob ? 0.94 : 0.86), 980, (H * (mob ? 0.5 : 0.62)) / FR, (H - fmY - c2h - gap - 28) / FR);
fmH = fmW * FR; fmX = (W - fmW) / 2;
mob = W < 820;
const c2h = copy2.offsetHeight || 200, gap = mob ? 18 : 30;
if (mob) { /* a phone: the FM-1 above, the SMK-37 below */
fmY = Math.max(12, H * 0.07);
fmW = W * 0.8; smW = W * 0.96;
const room = H - fmY - c2h - gap - 28, need = fmW * FR + 14 + smW * SR;
if (need > room) { const k = room / need; fmW *= k; smW *= k; }
fmH = fmW * FR; smH = smW * SR;
fmX = (W - fmW) / 2; smX = (W - smW) / 2; smY = fmY + fmH + 14;
copy2.style.top = smY + smH + gap + "px";
} else { /* side by side, the SMK-37 a little wider */
fmY = Math.max(18, H * 0.06);
const gx = Math.max(24, W * 0.03), tot = Math.min(W * 0.94, 1560);
fmW = Math.min((tot - gx) / 2.3, (H * 0.6) / FR, (H - fmY - c2h - gap - 28) / FR);
smW = fmW * 1.3;
fmH = fmW * FR; smH = smW * SR;
fmX = (W - fmW - gx - smW) / 2; smX = fmX + fmW + gx;
smY = fmY + (fmH - smH) / 2;
copy2.style.top = fmY + fmH + gap + "px";
}
fm.style.width = fmW + "px"; fm.style.left = fmX + "px"; fm.style.top = fmY + "px";
copy2.style.top = fmY + fmH + gap + "px";
smk.style.width = smW + "px"; smk.style.left = smX + "px"; smk.style.top = smY + "px";
mmW0 = mob ? W * 1.5 : Math.min(W * 0.98, 1500);
mmX0 = mob ? -W * 0.2 : Math.max(W * 0.5, W - 1.0 * mmW0 * 0.62);
mmY0 = mob ? H * 0.52 : (H - mmW0 * MR) / 2;
p = -1; draw(prog);
}
/* a Minimoog picture from where it starts to the screen of a figure (x, y, w its box; L the screen in it; sc its scale) */
function fly(img, q, x, y, w, h, L, sc, fade) {
const cx = x + w * (L[0] + L[2] / 2), cy = y + h * (L[1] + L[3] / 2);
const tw = w * L[2] * sc * 1.02;
const ex = x + w / 2 + (cx - x - w / 2) * sc, ey = y + h / 2 + (cy - y - h / 2) * sc;
const ww = mmW0 + (tw - mmW0) * q, hh = ww * MR;
const sx = mmX0 + mmW0 / 2, sy = mmY0 + mmW0 * MR / 2;
const mx = sx + (ex - sx) * q, my = sy + (ey - sy) * q;
img.style.width = ww + "px"; img.style.left = mx - ww / 2 + "px"; img.style.top = my - hh / 2 + "px";
img.style.opacity = fade;
}
function draw(np) {
if (np === undefined) np = p < 0 ? prog : p;
if (Math.abs(np - p) < 0.0004) return;
p = np;
const q = ease(clamp((p - 0.08) / 0.72));
const mob = W < 820;
const sc = 0.9 + 0.1 * q;
/* the SMK-37's half leaves a moment later and lands a moment later: the split shows */
const q2 = ease(clamp((p - 0.16) / 0.66));
const sc = 0.9 + 0.1 * q, sc2 = 0.9 + 0.1 * q2;
fm.style.opacity = clamp(q / 0.35);
fm.style.transform = "scale(" + sc + ")";
/* where the screen is now, in the stage */
const cx = fmX + fmW * (0.3073 + 0.0838), cy = fmY + fmH * (0.1523 + 0.1415);
const tw = fmW * 0.1676 * sc * 1.02;
const ex = fmX + fmW / 2 + (cx - fmX - fmW / 2) * sc, ey = fmY + fmH / 2 + (cy - fmY - fmH / 2) * sc;
const w = mmW0 + (tw - mmW0) * q, h = w * MR;
const sx = mmX0 + mmW0 / 2, sy = mmY0 + mmW0 * MR / 2;
const mx = sx + (ex - sx) * q, my = sy + (ey - sy) * q;
mm.style.width = w + "px"; mm.style.left = mx - w / 2 + "px"; mm.style.top = my - h / 2 + "px";
mm.style.opacity = 1 - clamp((q - 0.88) / 0.12);
lcd.style.opacity = 1;
smk.style.opacity = clamp(q2 / 0.35);
smk.style.transform = "scale(" + sc2 + ")";
fly(mm, q, fmX, fmY, fmW, fmH, FL, sc, 1 - clamp((q - 0.88) / 0.12));
fly(mm2, q2, smX, smY, smW, smH, SL, sc2, 1 - clamp((q2 - 0.88) / 0.12));
lcd.style.opacity = 1; lcd2.style.opacity = 1;
$("scr").style.opacity = clamp((p - 0.9) / 0.1);
$("scr2").style.opacity = clamp((p - 0.92) / 0.08);
copy1.style.opacity = 1 - clamp((p - 0.04) / 0.16);
copy1.style.transform = (mob ? "" : "translateY(-50%) ") + "translateX(" + (-clamp(p / 0.2) * 40) + "px)";
copy1.style.pointerEvents = p > 0.12 ? "none" : "";
@@ -1545,13 +1729,15 @@ $("fwfile").addEventListener("change", async (e) => {
hint.style.opacity = 1 - clamp(p / 0.05);
}
/* the first scroll down plays the film by itself; scrolling up at the top plays it backwards */
const DUR = 1400;
const DUR = 1600;
if (rm) prog = 1;
let state = rm ? 2 : 0, t0 = 0, dir = 1; /* 0 start picture, 1 playing forward, 2 finished, 3 playing backwards */
const hold = (e) => { if (state === 1 || state === 3) e.preventDefault(); };
function done() {
prog = 1; state = 2; draw(1);
A.src = IMG.splash; A.style.opacity = 1; B.style.opacity = 0; rot = 0; rotAt = performance.now();
A.src = IMG.splash; A.style.opacity = 1; B.style.opacity = 0;
A2.src = IMG.splash; A2.style.opacity = 1; B2.style.opacity = 0;
rot = 0; rotAt = performance.now();
}
function home() { prog = 0; state = 0; draw(0); }
function frame(now) {
@@ -1583,13 +1769,20 @@ $("fwfile").addEventListener("change", async (e) => {
document.querySelectorAll('a[href^="#"]').forEach((a) => a.addEventListener("click", () => { if (state !== 2) done(); }));
addEventListener("resize", layout);
if ((!rm && location.hash.length > 1) || scrollY > 40) { state = 2; prog = 1; } /* a reload further down, or a link to a section: the finished picture */
/* the finished FM-1 shows the real screens, one after the other */
function show(i) {
const on = A.style.opacity === "1" ? A : B, off = on === A ? B : A;
off.src = IMG[ROT[i]]; off.style.opacity = 1; on.style.opacity = 0;
/* the finished keyboards show the real screens, one after the other, the SMK-37 four pages ahead of the FM-1 */
function show(a, b, src) {
const on = a.style.opacity === "1" ? a : b, off = on === a ? b : a;
off.src = src; off.style.opacity = 1; on.style.opacity = 0;
}
const next = () => { rot = rot + 1 >= ROT.length ? 1 : rot + 1; show(rot); rotAt = performance.now(); };
const N = ROT.length - 1;
const next = () => {
rot = rot + 1 > N ? 1 : rot + 1;
show(A, B, IMG[ROT[rot]]);
show(A2, B2, IMG[ROT[1 + (rot - 1 + 4) % N]]);
rotAt = performance.now();
};
lcd.addEventListener("click", next);
lcd2.addEventListener("click", next);
if (!rm) setInterval(() => { if (state === 2 && performance.now() - rotAt >= 1000) next(); }, 100);
layout();
})();
+2
View File
@@ -27,7 +27,9 @@
#undef memset
#undef memcpy
#undef memcmp
#ifndef HOSTSIM_NO_FM1_IN /* (the SMK-37 emulator brings its own: web/emu/smk_web_input.h) */
static struct { volatile uint32_t notes, buttons; } fm1_in;
#endif
#include "../firmware/src/core.h"
#include "../firmware/src/engines.c"
#include "../firmware/src/fmini_rec.c"
+20 -7
View File
@@ -7,16 +7,29 @@
set -e
cd "$(dirname "$0")/../.."
: "${WASI_SDK:?set WASI_SDK to a wasi-sdk directory (wasi-sdk-25.0-x86_64-linux)}"
OUT=${OUT:-docs/emu}
# SMK=1 ...: FMini-1 on the SMK-37 (BOARD_SMK37, web/emu/smk_web_input.h; the panel web/emu/smk/) -> ${OUT:-docs/emu/smk}
[ -f build/gen/felucca_tables.h ] || { echo "emu: run ./build.sh once first (build/gen)"; exit 1; }
VERSION=$(sed -n 's/^#define FMINI_VERSION "\([^"]*\)".*/\1/p' firmware/src/core.h | head -n 1)
mkdir -p "$OUT/fonts"
if [ "${SMK:-0}" = 1 ]; then
OUT=${OUT:-docs/emu/smk}
VERSION=$(sed -n 's/^#define FMINI_SMK_VERSION "\([^"]*\)".*/\1/p' firmware/src/core.h | head -n 1)
BOARD="-DBOARD_SMK37=1 -Itests/smk_fake" # (smk_midi_out.c's TRS UART: the test's recorder)
PAGE=web/emu/smk
else
OUT=${OUT:-docs/emu}
VERSION=$(sed -n 's/^#define FMINI_VERSION "\([^"]*\)".*/\1/p' firmware/src/core.h | head -n 1)
BOARD=
PAGE=web/emu
fi
mkdir -p "$OUT"
"$WASI_SDK/bin/clang" --sysroot="$WASI_SDK/share/wasi-sysroot" --target=wasm32-wasi -mexec-model=reactor \
${EMU_OPT:--O2} -ffp-contract=off -std=gnu99 -w "-DFELUCCA_VERSION=\"$VERSION\"" \
${EMU_OPT:--O2} -ffp-contract=off -std=gnu99 -w "-DFELUCCA_VERSION=\"$VERSION\"" $BOARD \
-Ibuild/gen -Ifirmware/src -Iweb/emu/wasi_shim \
-Wl,--export-dynamic -Wl,-z,stack-size=1048576 -Wl,--initial-memory=33554432 \
web/emu/felucca_web.c -o "$OUT/felucca.wasm" -lm
sed -e "s/@VERSION@/FMini-1 $VERSION/g" -e "s/@PREVIEW@//g" web/emu/index.html > "$OUT/index.html"
cp web/emu/worklet.js "$OUT/"
cp web/emu/fonts/DotGothic16-subset.woff web/emu/fonts/OFL.txt "$OUT/fonts/"
sed -e "s/@VERSION@/FMini-1 $VERSION/g" -e "s/@PREVIEW@//g" "$PAGE/index.html" > "$OUT/index.html"
cp "$PAGE/worklet.js" "$OUT/"
if [ "${SMK:-0}" != 1 ]; then
mkdir -p "$OUT/fonts"
cp web/emu/fonts/DotGothic16-subset.woff web/emu/fonts/OFL.txt "$OUT/fonts/"
fi
echo "emu: $OUT ($(wc -c < "$OUT/felucca.wasm" | tr -d ' ') B wasm, $VERSION)"
+75 -3
View File
@@ -36,6 +36,13 @@
#endif
static uint8_t nor[0x100000]; /* the SPI NOR (erased: 0xFF) */
#if BOARD_SMK37
/* FMini-1 on the SMK-37 (web/emu/build_wasi.sh SMK=1): the SMK's input without its hardware, and the MIDI OUT
* (smk_midi_out.c, its TRS UART a recorder: tests/smk_fake), before hostsim.c (seq.c takes from both) */
#define HOSTSIM_NO_FM1_IN 1
#include "smk_web_input.h"
#include "../../firmware/src/smk_midi_out.c"
#endif
#define main hostsim_main
#include "../../tests/hostsim.c"
#undef main
@@ -58,7 +65,12 @@ static void fm1_audio_stop(void) {}
void isr_alnk0(void) {}
#include "../../firmware/src/audio.c"
static void fm1_wdt_feed(void) {}
static void fm1_irq_off(void) {}
static void fm1_irq_on(void) {}
/* ------------------------------------------------------------ the panel --- */
#if !BOARD_SMK37
#define FM1_NCOL 11u
static const int8_t FM1_KEYMAP[6][FM1_NCOL] = { /* as hal/fm1_input.h: key id at (column, row bit) */
{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
@@ -124,9 +136,7 @@ static uint32_t fm1_input_note_edges(void) { uint32_t n = web_notes_pressed; web
static int32_t fm1_enc_take(uint32_t e) { int32_t s = web_enc_steps[e % 7u]; web_enc_steps[e % 7u] = 0; return s; }
static void fm1_input_init(void) {}
static void fm1_input_tick(void) {}
static void fm1_wdt_feed(void) {}
static void fm1_irq_off(void) {}
static void fm1_irq_on(void) {}
#endif /* !BOARD_SMK37 */
/* ----------------------------------------------------------- the screen --- */
static uint16_t web_fb[240 * 240]; /* RGB565 as the panel gets it (high byte first) */
@@ -202,8 +212,17 @@ static int st_prog(uint32_t off, const void *src, uint32_t n) /* NOR: a wr
static uint32_t irq_save(void) { return 0; }
static void irq_restore(uint32_t f) { (void)f; }
static uint32_t fl_jedec_ram(void) { return 0x856014u; } /* the FM-1's part (project.c) */
#if BOARD_SMK37
#define FL_JEDEC_OK(id) ((id) == 0xEB6014u || (id) == 0x856014u || (id) == 0xB36014u) /* (SMK) */
#define FL_SMP_LO 0x000C2000u /* as hal/fm1_flash_map.h (SMK): the preset slots live there */
#define FL_SMP_HI 0x000EA000u
#define FL_STOCKTAG_LO 0x000EA000u
#define FL_STOCKTAG_OFF 0x000EAFF8u
static const uint8_t *fm1_xip_ptr(uint32_t off) { return nor + off; }
#else
#define FL_JEDEC_OK(id) ((id) == 0x856014u || (id) == 0xB36014u) /* as hal/fm1_flash_map.h (FM-1) */
#define FM1_OCT_BOTH 3u /* OCT- + OCT+, as hal/fm1_input.h (FM-1) */
#endif
static void fl_plain_window_init(void) {}
#define FL_FAR(fn) (fn)
#include "../../firmware/src/storage.c"
@@ -222,10 +241,12 @@ static fm1_crash_t fm1_crash; /* (none: main.c boot_leds run
static struct { uint8_t p3_rst, wdt_con; uint32_t rst_src; } fm1_boot;
uint32_t _data_start[1], _data_end[1], _data_load[1], _bss_start[1], _bss_end[1];
uint32_t _pool_start[1], _pool_end[1], _rt_start[1], _rt_end[1], _rt_load[1];
#if !BOARD_SMK37
static uint32_t web_master_adc = 700; /* MASTER, 0..1023 as the ADC reads it */
enum { FM1_ADC_BATT = 3, FM1_ADC_MASTER = 4 };
static int32_t fm1_adc_read(uint32_t ch) { return ch == FM1_ADC_MASTER ? (int32_t)web_master_adc : 620; }
static void fm1_adc_init(void) {}
#endif
static void fm1_timer5_ack(void) {}
static void fm1_timer5_start(void (*isr)(void), uint32_t prio) { (void)isr; (void)prio; }
void isr_timer5(void) {}
@@ -313,7 +334,14 @@ static void web_frame(void)
UI_INPUT();
settings_poll();
autosave_poll();
#if BOARD_SMK37
smk_grid();
#endif
UI_LEDS();
#if BOARD_SMK37
smk_faders();
smk_wheels();
#endif
UI_DRAW();
}
@@ -327,6 +355,9 @@ static void web_ms(void)
{
fm1_ms++;
web_ticks += 1000u * FM1_TICKS_PER_US;
#if BOARD_SMK37
fm1_in.frames++; /* (main.c's wheels and faders wait for settled readings) */
#endif
web_samples_due += FS;
while (web_samples_due >= 1000u * HALF_FRAMES) { /* an I2S half: the audio ISR renders it */
uint32_t k;
@@ -353,6 +384,10 @@ static void web_ms(void)
web_frame();
} else {
UI_INPUT(); /* main.c's wait loop */
#if BOARD_SMK37
smk_wheels();
smk_grid();
#endif
}
}
@@ -388,6 +423,42 @@ EXPORT void web_boot(void)
web_power_on();
}
#if BOARD_SMK37
/* the SMK-37's input, as its scan would find it: key k (0 = C3 .. 36 = C6) with velocity (0 = released), pad p
* (0..7 top row, 8..15 bottom row) hit with velocity or released, the 18 buttons (bit i = smk_input.h button i:
* KNOB BANK, FADER BANK, <, >, OCTAVE-, OCTAVE+, ARP, NOTE REPEAT, SCALE, CHORD, GLOBE, BT, PATCH, PARA, FX, SEQ,
* SEQ PLAY, SEQ REC), encoder e (0 = K1 .. 7 = K8) turned n detents, fader i 0..127, wheel i (0 pitch, 1 mod) raw
* 0..1023 (pitch rests ~535, ~445..640; mod 615 none .. 485 full). The LEDs back: the 19 button LEDs (bit i), the
* pads' colours (0x00RRGGBB, hardware pad order) */
EXPORT void web_smk_key(uint32_t k, uint32_t vel) { if (k < FM1_NKEY) smk__key_event(k, vel > 127u ? 127u : vel); }
EXPORT void web_smk_pad(uint32_t p, uint32_t vel) { if (p < SMK_NPAD) smk__padq(p, vel > 127u ? 127u : vel); }
EXPORT void web_smk_buttons(uint32_t m)
{
uint32_t old = fm1_in.buttons;
m &= (1u << FM1_NBTN) - 1u;
fm1_in.pressed |= m & ~old;
fm1_in.released |= old & ~m;
fm1_in.buttons = m;
}
EXPORT void web_smk_enc(uint32_t e, int32_t n) { if (e < FM1_NENC) fm1_in.enc_steps[e] = (int16_t)(fm1_in.enc_steps[e] + n); }
EXPORT void web_smk_fader(uint32_t i, uint32_t v) { if (i < 4u) fm1_in.fader[i] = (uint8_t)(v > 127u ? 127u : v); }
EXPORT void web_smk_wheel(uint32_t i, uint32_t raw) { if (i < 2u) fm1_in.wheel[i] = (uint16_t)(raw > 1023u ? 1023u : raw); }
EXPORT uint32_t web_smk_leds(void)
{
uint32_t i, m = 0;
for (i = 0; i < SMK_NLED; i++)
m |= (uint32_t)(fm1_led[i] != 0) << i;
return m;
}
EXPORT uint32_t *web_smk_pad_rgb(void) { return padled_rgb; }
EXPORT uint32_t web_smk_master(void) { return (uint32_t)smk_master; }
EXPORT uint32_t web_midi(uint32_t status, uint32_t d1, uint32_t d2) /* (as the FM-1's, below) */
{
if (status < 0x80u || status >= 0xF0u)
return 1;
return (uint32_t)midi_enqueue((status >> 4) | status << 8 | (d1 & 127u) << 16 | (d2 & 127u) << 24, 1);
}
#else
/* input, by the printed labels: buttons bit b = B_FX .. B_OCTUP (panel.c), keys bit k = key k (F3 .. G5),
* encoders by role (EN_SELECT .. EN_K4), MASTER 0..1023 */
static uint32_t web_btn_labels, web_key_mask;
@@ -472,6 +543,7 @@ EXPORT uint8_t *web_anim_levels(void)
web_anim_glow);
return lv;
}
#endif /* BOARD_SMK37 */
/* for the test and the bench (web/emu/emu_test.mjs), a heavy song straight into the tracks (as hostsim's
* renders set them): T1 FM6 PAD, T2 PHYS DRONE STRING (SYMP), T3 GRAIN CLOUD PAD, 4-note chords on all 16
+462
View File
@@ -0,0 +1,462 @@
<!doctype html>
<!-- SPDX-License-Identifier: GPL-3.0-only
FMini-1 on the M-Vave SMK-37, in the browser. The panel (its drawing, layout and gestures) is the SMK-37 simulator of
Felucca SMK by Chance Roth (https://github.com/ChanceTheMaker/felucca-smk, web/smk-simulator.js, smk-studio.css,
panel-glide.js, keyboard-glide.js; GPL-3.0), restyled for the FMini-1 site; what runs behind it is FMini-1's own
firmware built for the SMK-37 (web/emu/felucca_web.c with BOARD_SMK37). The FM-1 page (../index.html) is the pattern
for the start, the silent boot and the saved flash. -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>FMini-1 for SMK-37 — in your browser</title>
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 16%22%3E%3Crect width=%2216%22 height=%2216%22 rx=%223%22 fill=%22%23ff7a1a%22/%3E%3Crect x=%224%22 y=%224%22 width=%228%22 height=%228%22 fill=%22%230d0c10%22/%3E%3C/svg%3E">
<meta name="description" content="FMini-1, the Minimoog emulation firmware, on the M-Vave SMK-37, running in your browser: the same code the keyboard runs.">
<style>
:root { --bg: #0d0c10; --surface: #15131a; --surface2: #1c1922; --line: #2a2631; --fg: #f4f0ea; --dim: #a29cab; --mute: #6f6a78;
--or: #ff7a1a; --or2: #ff9a4d; --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
--mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--fg); font: 14px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--or2); }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
header.nav { position: sticky; top: 0; z-index: 30; background: rgba(13,12,16,.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
header.nav .wrap { display: flex; align-items: center; gap: 14px; height: 56px; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.brand { font-weight: 900; font-style: italic; letter-spacing: -.04em; font-size: 22px; color: var(--fg); text-decoration: none; }
.brand i { color: var(--or); }
.brand small { font: 600 12px/1 var(--mono); font-style: normal; letter-spacing: 0; color: var(--dim); margin-left: 8px; }
header.nav nav { display: flex; gap: 6px; margin-left: auto; }
header.nav nav a { color: var(--dim); text-decoration: none; font-size: 13.5px; font-weight: 600; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); }
header.nav nav a:hover { color: var(--fg); border-color: var(--mute); }
header.nav nav a.keep { color: #1a0e05; background: var(--or); border-color: var(--or); }
header.nav nav a.keep:hover { background: var(--or2); }
@media (max-width: 560px) { header.nav nav a:not(.keep) { display: none; } .brand small { display: none; } }
main { max-width: 1240px; margin: 0 auto; padding: 8px 20px 32px; }
/* the toolbar and the panel: after Felucca SMK's smk-studio.css (Chance Roth, GPL-3.0) */
#smk { position: relative; margin: 10px auto 20px; }
#smk.sim-expanded { max-width: none; }
#smk:fullscreen { box-sizing: border-box; width: 100%; height: 100%; margin: 0; padding: 18px clamp(12px,3vw,48px); overflow: auto; background: var(--bg); }
.sim-toolbar { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.sim-toolbar strong { margin-right: auto; font: 700 14px/1 var(--mono); letter-spacing: .02em; }
.sim-toolbar strong i { color: var(--or); font-style: normal; }
.sim-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 6px; border-radius: 8px;
color: var(--dim); background: var(--surface2); border: 1px solid var(--line); }
.sim-icon-button:hover { color: var(--fg); border-color: var(--mute); }
.sim-icon-button svg { display: block; width: 22px; height: 22px; }
.sim-finish-picker { position: relative; }
.sim-finish-toggle { width: 54px !important; gap: 5px; }
.sim-swatch { display: inline-block; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; border: 1px solid #0008; box-shadow: inset 0 1px 2px #ffffff66, 0 0 0 1px #ffffff33; }
.sim-caret { font-size: 12px; }
.sim-finish-menu { position: absolute; z-index: 60; right: 0; top: calc(100% + 8px); min-width: 170px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px #0008; }
.sim-finish-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; background: transparent; color: var(--fg); text-align: left; font-size: 12.5px; border-radius: 7px; }
.sim-finish-option[aria-selected=true] { outline: 1px solid var(--or); outline-offset: -2px; }
.sim-finish-option:is(:hover,:focus-visible) { background: var(--surface2); }
.sim-status { flex-basis: 100%; font-size: 12px; color: var(--dim); }
.smk-simulator-shell { --case:#b92832; --case-edge:#53141a; --ink:#fff2e5; position:relative; padding:24px 24px 20px; border:1px solid #0009; border-radius:22px 22px 15px 15px; color:var(--ink); background:linear-gradient(110deg,#ffffff22,transparent 30%,#0002),var(--case); box-shadow:inset 0 2px 1px #fff5,inset 0 -8px 0 var(--case-edge),0 18px 40px #000a; font-family:Arial,sans-serif; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }
.smk-simulator-shell[data-finish=white] { --case:#e8e7e0; --case-edge:#9b9c98; --ink:#303436; }
.smk-simulator-shell[data-finish=elite] { --case:#687481; --case-edge:#39434e; --ink:#f1f1e9; }
.smk-simulator-shell[data-finish=black] { --case:#16191b; --case-edge:#08090a; --ink:#e9eef0; }
.smk-simulator-shell[data-finish=pink] { --case:#e5a2b4; --case-edge:#9b6476; --ink:#392630; }
.smk-simulator-shell[data-finish=charcoal] { --case:#52575b; --case-edge:#2b2e31; --ink:#f2f0e6; }
.smk-simulator-shell::before,.smk-simulator-shell::after { content:''; position:absolute; top:10px; width:10px; height:10px; background:linear-gradient(135deg,#ddd,#666); border:1px solid #000b; border-radius:50%; box-shadow:0 1px 2px #0008; }
.smk-simulator-shell::before { left:10px; } .smk-simulator-shell::after { right:10px; }
.sim-top { display:grid; grid-template-columns:8% 21% 40% 1fr; gap:16px; align-items:start; }
.sim-left,.sim-center,.sim-right,.sim-wheels { min-width:0; }
.sim-bezel { position:relative; padding:12px; background:linear-gradient(135deg,#2e3032,#090a0b); border:2px solid #111; border-radius:18px; box-shadow:0 2px 5px #0006,inset 0 1px 2px #fff3; }
.sim-lcd { display:block; width:100%; height:auto; aspect-ratio:1; border-radius:7px; background:#000; }
.sim-knobs { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:6px; padding:4px 0 14px; }
.sim-encoder { display:grid; justify-items:center; gap:6px; min-width:0; font-size:10px; font-weight:bold; }
.sim-encoder small { font-size:8px; font-weight:normal; white-space:nowrap; }
.sim-dial { padding:0; min-width:0; width:100%; max-width:45px; aspect-ratio:1; border-radius:50%; border:2px solid #111; background:repeating-conic-gradient(#222 0deg 6deg,#36393b 6deg 12deg); box-shadow:0 4px 5px #0008,inset 0 1px 1px #fff6; position:relative; cursor:ns-resize; touch-action:none; }
.sim-dial::before { content:''; position:absolute; inset:5px; border-radius:50%; background:radial-gradient(ellipse at 35% 20%,#696b6c,#292b2d 65%,#181a1c); box-shadow:inset 0 1px #fff4; }
.sim-dial::after { content:''; position:absolute; top:12%; left:calc(50% - 1px); width:2px; height:26%; border-radius:2px; background:#e8e8e4; transform-origin:50% 146%; transform:rotate(var(--angle,0deg)); }
.sim-pads { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); gap:7px; padding:9px; background:#0002; border:1px solid #0004; border-radius:10px; box-shadow:inset 0 2px 6px #0003; }
.sim-pad { min-width:0; padding:0; aspect-ratio:.95; border-radius:6px; color:#bfc3c6; font-size:10px; border:2px solid #15191b; background:linear-gradient(135deg,#555a5e,#303437); box-shadow:inset 0 1px 2px #ffffff35,0 2px 2px #0006; touch-action:none; }
.sim-pad.lit { background:color-mix(in srgb,var(--led) var(--mix,100%),#303437); border-color:color-mix(in srgb,var(--led) var(--mix,100%),#15191b); color:#e8e6e2; box-shadow:0 0 calc(14px*var(--glow,1)) color-mix(in srgb,var(--led) 60%,transparent),inset 0 1px #fff4; }
.sim-pad.lit.full { color:#0d0c10; }
.sim-pad[aria-pressed=true] { box-shadow:inset 0 2px 5px #0009; filter:brightness(.85); }
.sim-faders { display:flex; gap:8px; justify-content:space-evenly; padding:4px 0 12px; }
.sim-fader,.sim-wheel { display:flex; flex-direction:column; align-items:center; gap:8px; font-size:9px; font-weight:bold; }
.sim-fader input { writing-mode:vertical-lr; direction:rtl; touch-action:none; appearance:none; -webkit-appearance:none; width:40px; height:124px; margin:0; border:0; background:repeating-linear-gradient(to top,transparent 0 11px,#ffffff40 11px 12px) left center/7px 108px no-repeat; cursor:ns-resize; }
.sim-fader input::-webkit-slider-runnable-track { width:6px; border:1px solid #090b0d; border-radius:5px; background:#141719; box-shadow:inset 1px 0 3px #000,1px 0 #ffffff30; }
.sim-fader input::-webkit-slider-thumb { -webkit-appearance:none; width:36px; height:23px; margin-left:-16px; border:1px solid #101214; border-radius:4px; background:linear-gradient(to bottom,#777c7f 0%,#414649 36%,#111416 43%,#dadcda 47%,#dadcda 53%,#171a1c 57%,#393e41 75%,#202427); box-shadow:0 3px 4px #0009,inset 0 1px #ffffff77; }
.sim-fader input::-moz-range-track { width:6px; height:100%; border:1px solid #090b0d; border-radius:5px; background:#141719; }
.sim-fader input::-moz-range-thumb { width:36px; height:23px; border:1px solid #101214; border-radius:4px; background:linear-gradient(#777c7f,#414649 36%,#111416 43%,#dadcda 47%,#dadcda 53%,#171a1c 57%,#202427); }
.sim-banks,.sim-buttons { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:5px; margin-top:8px; }
.sim-banks { grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; margin:0; }
.sim-button { min-width:0; min-height:27px; padding:7px 2px; font:700 8px/1.2 Arial,sans-serif; color:#e3e5e6; background:linear-gradient(#474b4e,#272b2e); border:1px solid #131617; border-radius:5px; box-shadow:0 2px 2px #0005,inset 0 1px #fff2; touch-action:none; }
.sim-button.lit { border-bottom:3px solid var(--or); padding-bottom:5px; color:#ffd8b0; box-shadow:0 2px 8px #ff7a1a66,inset 0 1px #fff2; }
.sim-button[aria-pressed=true] { background:#171b1e; box-shadow:inset 0 2px 4px #0009; }
.sim-banks .sim-button { min-height:23px; padding:4px 2px; font-size:7px; border-radius:4px; }
.sim-banks .sim-button.lit { padding-bottom:2px; }
.sim-bottom { margin-top:20px; }
.sim-wheels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; align-content:end; padding-top:4px; }
.sim-wheels > .sim-banks { grid-column:1/-1; width:100%; }
.sim-wheel { gap:6px; text-transform:uppercase; letter-spacing:.08em; }
.sim-wheel-housing { display:block; position:relative; width:min(42px,100%); height:104px; padding:5px 6px; overflow:hidden; border:1px solid #151819; border-radius:12px; background:#0b0d0f; box-shadow:inset 0 3px 6px #000,0 1px #ffffff40; }
.sim-wheel-tread { display:block; height:100%; border-radius:45% / 18%; background:linear-gradient(to bottom,#000e,transparent 30%,#ffffff15 48%,transparent 65%,#000e),linear-gradient(to right,#07090b,#4d5357 24%,#343a3e 55%,#14191d),repeating-linear-gradient(to bottom,#6b7378 0 2px,#202529 2px 5px); background-blend-mode:normal,soft-light,normal; background-position:0 0,0 0,0 var(--wheel-turn,0px); box-shadow:inset 1px 0 #ffffff30,inset -2px 0 #0008; }
.sim-wheel-housing::after { content:''; position:absolute; left:11px; right:11px; top:var(--wheel-position,50%); height:2px; background:#e0e4df; box-shadow:0 1px 2px #000; pointer-events:none; }
.sim-wheel-housing input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:ns-resize; writing-mode:vertical-lr; direction:rtl; touch-action:none; }
.sim-wheel-housing:focus-within { outline:2px solid var(--or); outline-offset:3px; }
.smk-simulator-shell[data-finish=elite] .sim-button { background:linear-gradient(#f78a4f,#cd4b16); color:#311f17; }
.smk-simulator-shell[data-finish=elite] .sim-key.black { background:linear-gradient(90deg,#ac3914,#ed733d 35%,#ce4e1e); border-color:#82341c; }
.smk-simulator-shell[data-finish=elite] .sim-pad:not(.lit) { background:linear-gradient(#fff5dc,#c5c3b1); color:#5e5950; }
.sim-piano { position:relative; height:180px; background:#111; border:5px solid #111; border-top:9px solid #111; border-radius:4px 4px 8px 8px; box-shadow:0 3px 4px #0006; overflow:hidden; touch-action:none; }
.sim-key { position:absolute; top:0; margin:0; padding:0 0 8px; border-radius:0 0 4px 4px; text-align:center; display:flex; align-items:end; justify-content:center; font:9px Arial,sans-serif; left:calc(var(--key-x)*100%/var(--white-count)); width:calc(100%/var(--white-count)); min-width:0; touch-action:none; }
.sim-key.white { height:100%; color:#777; background:linear-gradient(90deg,#d5d5d0,#fcfcf7 20%,#eee 85%,#b8b9b6); border:1px solid #777; border-top:0; box-shadow:inset 0 -6px 0 #c5c6c2; }
.sim-key.black { z-index:2; height:62%; width:calc(62%/var(--white-count)); color:#999; background:linear-gradient(90deg,#151618,#3d4042 30%,#222426 75%,#070808); border:1px solid #060708; border-bottom:6px solid #0b0c0d; box-shadow:2px 4px 3px #0006; }
.sim-key[aria-pressed=true] { background:linear-gradient(#e0661a,#ff9a4d); box-shadow:inset 0 3px 5px #0006; color:#1a0e05; }
.smk-simulator-shell[data-finish=black] .sim-key.white:not([aria-pressed=true]) { color:#aaa; background:linear-gradient(90deg,#16181a,#34383b 20%,#25292c 85%,#111315); border-color:#080a0b; box-shadow:inset 0 -6px 0 #121416; }
.smk-simulator-shell[data-finish=black] .sim-key.black:not([aria-pressed=true]) { color:#b7b9ba; background:linear-gradient(90deg,#08090a,#202326 30%,#121416 75%,#030405); border-color:#020303; }
.smk-simulator-shell :is(button,input):focus-visible { outline:2px solid var(--or); outline-offset:3px; }
@media(max-width:1050px) { .sim-top { gap:12px; } .smk-simulator-shell { padding:20px 14px; } .sim-encoder small { display:none; } .sim-pads { gap:6px; padding:8px; } .sim-piano { height:150px; } }
@media(max-width:700px) { #smk { overflow:auto; } .smk-simulator-shell { min-width:660px; } .sim-toolbar { position:sticky; left:0; } }
#smk.sim-screen-only .smk-simulator-shell { min-width:0; width:min(100%,640px); margin-inline:auto; padding:22px; }
#smk.sim-screen-only :is(.sim-wheels,.sim-center,.sim-right,.sim-bottom) { display:none; }
#smk.sim-screen-only .sim-top { display:block; }
.start { position:absolute; inset:0; z-index:5; display:grid; place-content:center; justify-items:center; gap:12px; background:rgba(13,12,16,.55); border-radius:22px 22px 15px 15px; }
.start button { font:800 17px/1 var(--sans); padding:14px 28px; background:var(--or); color:#1a0e05; border:0; border-radius:12px; }
.start button:disabled { opacity:.5; cursor:progress; }
.start p { margin:0; max-width:32em; text-align:center; color:var(--fg); }
.keys { margin:14px 0 0; color:var(--dim); text-align:center; font-size:12.5px; }
.keys span { white-space:nowrap; margin:0 8px; }
kbd { font:600 11px var(--mono); border:1px solid var(--line); border-radius:4px; padding:0 4px; color:var(--fg); }
footer { margin-top:18px; color:var(--mute); text-align:center; font-size:12px; line-height:1.7; }
footer a { color:var(--dim); }
</style>
</head>
<body>
<header class="nav"><div class="wrap">
<a class="brand" href="../../"><i>FM</i>ini-<i>1</i><small>SMK-37</small></a>
<nav><a href="../">FM-1 emulator</a><a href="../../" class="keep">FMini-1 website</a></nav>
</div></header>
<main>
<section id="smk" aria-label="SMK-37 running FMini-1"></section>
<p class="keys">
<span><kbd>A</kbd>–<kbd>;</kbd> <kbd>W</kbd>–<kbd>P</kbd> keys</span>
<span><kbd>Z</kbd> <kbd>X</kbd> OCTAVE</span>
<span>Knobs: drag, scroll or arrow keys</span>
<span>Faders and wheels: drag</span>
</p>
<footer>
<span class="version">@VERSION@</span><br>
FMini-1 by Guilherme Ruppert, a fork of Felucca by Leo Kuroshita, Hügelton Instruments · <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPL-3.0</a><br>
The SMK-37 panel is the simulator of <a href="https://github.com/ChanceTheMaker/felucca-smk">Felucca SMK</a> by Chance Roth (GPL-3.0), restyled; the firmware behind it is FMini-1's.<br>
<small>M-VAVE, SMK-37 and FM-1 are trademarks of their respective owners. FMini-1 is not affiliated with or endorsed by them.</small>
</footer>
</main>
<script type="module">
const $ = (id) => document.getElementById(id);
const STORE = "fmini-smk-emu-flash", FINISH = "fmini-smk-emu-finish";
let node = null;
const send = (m) => { if (node) node.port.postMessage(m); };
const el = (tag, cls, text) => { const n = document.createElement(tag); if (cls) n.className = cls; if (text) n.textContent = text; return n; };
const host = $("smk");
// ------------------------------------------------------------------ the panel (after Felucca SMK's smk-simulator.js)
const toolbar = el("div", "sim-toolbar"), title = el("strong");
title.innerHTML = "SMK-37 · <i>FMini-1</i>";
const finishes = [["red", "Pro Red", "#b92832"], ["white", "Pro White", "#e8e7e0"], ["elite", "Elite", "linear-gradient(135deg,#687481 55%,#e76522 55%)"],
["black", "Pro Black", "#16191b"], ["pink", "Pro Pink", "#e5a2b4"], ["charcoal", "Pro Charcoal", "#52575b"]];
const picker = el("div", "sim-finish-picker"), finish = el("button", "sim-icon-button sim-finish-toggle"), menu = el("div", "sim-finish-menu");
finish.type = "button"; finish.setAttribute("aria-haspopup", "listbox");
const swatch = el("span", "sim-swatch"); finish.append(swatch, el("span", "sim-caret", "⌄"));
menu.hidden = true; menu.setAttribute("role", "listbox"); picker.append(finish, menu);
const icon = (d, extra = "") => `<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">${extra}<path d="${d}"/></svg>`;
const screenOnly = el("button", "sim-icon-button"); screenOnly.type = "button"; screenOnly.title = "Screen only";
screenOnly.innerHTML = icon("M9 21h6m-3-4v4", '<rect x="3" y="3" width="18" height="14" rx="2"/>');
const expand = el("button", "sim-icon-button"); expand.type = "button"; expand.title = "Expand";
expand.innerHTML = icon("M9 4H4v5M15 4h5v5M4 15v5h5M20 15v5h-5");
const full = el("button", "sim-icon-button"); full.type = "button"; full.title = "Fullscreen"; full.hidden = !document.fullscreenEnabled;
full.innerHTML = icon("M7 12V8h4m2 8h4v-4M7 8l4 4m2 0 4 4", '<rect x="3" y="4" width="18" height="16" rx="2"/>');
const status = el("span", "sim-status"); status.setAttribute("role", "status"); status.hidden = true;
toolbar.append(title, picker, screenOnly, expand, full, status);
const shell = el("div", "smk-simulator-shell");
function chooseFinish(id, save = true) {
const f = finishes.find((x) => x[0] === id) || finishes[0];
shell.dataset.finish = f[0]; swatch.style.background = f[2]; finish.title = "Finish: " + f[1];
for (const b of menu.children) b.setAttribute("aria-selected", String(b.dataset.finish === f[0]));
if (save) try { localStorage.setItem(FINISH, f[0]); } catch {}
}
for (const [id, name, color] of finishes) {
const b = el("button", "sim-finish-option"); b.type = "button"; b.dataset.finish = id; b.setAttribute("role", "option");
const s = el("span", "sim-swatch"); s.style.background = color; b.append(s, el("span", "", name));
b.onclick = () => { chooseFinish(id); menu.hidden = true; }; menu.append(b);
}
finish.onclick = () => { menu.hidden = !menu.hidden; };
document.addEventListener("pointerdown", (e) => { if (!picker.contains(e.target)) menu.hidden = true; });
let saved = "red"; try { saved = localStorage.getItem(FINISH) || "red"; } catch {}
chooseFinish(saved, false);
screenOnly.onclick = () => { releaseAll(); host.classList.toggle("sim-screen-only"); };
expand.onclick = () => host.classList.toggle("sim-expanded");
full.onclick = async () => { releaseAll(); try { if (document.fullscreenElement === host) await document.exitFullscreen(); else await host.requestFullscreen(); } catch {} };
const top = el("div", "sim-top"), left = el("div", "sim-left"), center = el("div", "sim-center"), right = el("div", "sim-right");
const lcd = el("canvas", "sim-lcd"); lcd.width = lcd.height = 240; lcd.setAttribute("role", "img"); lcd.setAttribute("aria-label", "The screen");
const bezel = el("div", "sim-bezel"); bezel.append(lcd); left.append(bezel);
const ctx = lcd.getContext("2d"), img = ctx.createImageData(240, 240);
ctx.fillStyle = "#000"; ctx.fillRect(0, 0, 240, 240);
// press / release, counted per control: several pointers or keys may hold one
const owners = new Map(), counts = new Map();
let buttonMask = 0;
function act(kind, id, value) {
if (kind === "button") { buttonMask = value ? buttonMask | (1 << id) : buttonMask & ~(1 << id); send({ type: "buttons", mask: buttonMask }); }
else if (kind === "key") send({ type: "key", k: id, vel: value });
else if (kind === "pad") send({ type: "pad", p: id, vel: value });
}
function press(owner, kind, id, value, button) {
if (owners.has(owner)) return;
const key = kind + ":" + id, n = counts.get(key) || 0;
counts.set(key, n + 1); owners.set(owner, { key, kind, id, button });
if (!n) act(kind, id, value);
button?.setAttribute("aria-pressed", "true");
}
function release(owner) {
const v = owners.get(owner); if (!v) return;
owners.delete(owner);
const n = counts.get(v.key) - 1;
if (n) counts.set(v.key, n); else { counts.delete(v.key); act(v.kind, v.id, 0); }
v.button?.setAttribute("aria-pressed", String(n > 0));
}
// a gesture that crosses keys or pads plays each (Felucca SMK's keyboard-glide.js / panel-glide.js)
const glides = new Map();
const hitAt = (x, y) => { const t = document.elementFromPoint(x, y)?.closest(".sim-key,.sim-pad"); return t && host.contains(t) ? t : null; };
const velOf = (t, y) => { const r = t.getBoundingClientRect(); return Math.max(20, Math.min(127, Math.round(40 + 87 * (y - r.top) / r.height))); };
function glideVisit(id, g, x, y) {
const t = hitAt(x, y);
if (t === g.t) return;
g.t = t; release("p" + id);
if (t) press("p" + id, t.classList.contains("sim-pad") ? "pad" : "key", +(t.dataset.pad ?? t.dataset.key), velOf(t, y), t);
}
function glideMove(id, x, y) {
const g = glides.get(id); if (!g) return;
const dx = x - g.x, dy = y - g.y, steps = Math.max(1, Math.ceil(Math.hypot(dx, dy) / 4));
for (let i = 1; i <= steps; i++) glideVisit(id, g, g.x + dx * i / steps, g.y + dy * i / steps);
g.x = x; g.y = y;
}
function glideEnd(id) { if (glides.delete(id)) release("p" + id); }
function wire(button, kind, id) {
button.type = "button"; button.setAttribute("aria-pressed", "false");
const playable = kind === "key" || kind === "pad";
button.addEventListener("pointerdown", (e) => {
if (e.pointerType === "mouse" && e.button !== 0) return;
e.preventDefault(); button.setPointerCapture(e.pointerId);
if (playable) { glideEnd(e.pointerId); const g = { x: e.clientX, y: e.clientY, t: null }; glides.set(e.pointerId, g); glideVisit(e.pointerId, g, e.clientX, e.clientY); }
else press("p" + e.pointerId, kind, id, 1, button);
});
if (playable) button.addEventListener("pointermove", (e) => { if (e.pointerType === "mouse" && !(e.buttons & 1)) { glideEnd(e.pointerId); return; } glideMove(e.pointerId, e.clientX, e.clientY); });
for (const n of ["pointerup", "pointercancel", "lostpointercapture"])
button.addEventListener(n, (e) => { if (playable) glideEnd(e.pointerId); else release("p" + e.pointerId); });
button.onkeydown = (e) => { if (["Space", "Enter"].includes(e.code)) { e.preventDefault(); if (!e.repeat) press("k" + e.code, kind, id, 100, button); } };
button.onkeyup = (e) => { if (["Space", "Enter"].includes(e.code)) { e.preventDefault(); release("k" + e.code); } };
button.onblur = () => { release("kSpace"); release("kEnter"); };
}
// K1..K8: endless encoders (K1 MASTER; K2 PRESETS, K3 SELECT, K4 ALGORITHM; K5..K8 the screen's four, as KNOB BANK says)
const knobs = el("div", "sim-knobs");
["MASTER", "PRESETS", "SELECT", "ALGORITHM", "KNOB", "KNOB", "KNOB", "KNOB"].forEach((name, id) => {
const box = el("div", "sim-encoder"), dial = el("button", "sim-dial");
dial.type = "button"; dial.setAttribute("aria-label", `K${id + 1} (${name})`);
let angle = 0, drag;
const turn = (n) => { n = Math.max(-32, Math.min(32, n)); if (!n) return; send({ type: "enc", e: id, n }); angle += n * 12; dial.style.setProperty("--angle", angle + "deg"); };
dial.onpointerdown = (e) => { if (e.button) return; e.preventDefault(); dial.focus(); dial.setPointerCapture(e.pointerId); drag = { id: e.pointerId, y: e.clientY }; };
dial.onpointermove = (e) => { if (drag?.id !== e.pointerId) return; const step = e.shiftKey ? 24 : 7, n = Math.trunc((drag.y - e.clientY) / step); if (n) { turn(n); drag.y -= n * step; } };
for (const n of ["pointerup", "pointercancel", "lostpointercapture"]) dial.addEventListener(n, () => { drag = null; });
dial.onkeydown = (e) => { const n = { ArrowUp: 1, ArrowRight: 1, ArrowDown: -1, ArrowLeft: -1 }[e.key]; if (n) { e.preventDefault(); turn(n * (e.shiftKey ? 10 : 1)); } };
dial.addEventListener("wheel", (e) => { e.preventDefault(); turn(e.deltaY < 0 ? 1 : -1); }, { passive: false });
box.append(el("span", "", `K${id + 1}`), dial, el("small", "", id >= 4 ? `KNOB ${id - 3}` : name)); knobs.append(box);
});
// the 16 pads: 1..8 the top row (hardware pads 0..7), 9..16 the bottom row
const padGrid = el("div", "sim-pads"), pads = [];
for (let i = 0; i < 16; i++) { const b = el("button", "sim-pad", String(i + 1)); b.dataset.pad = String(i); b.setAttribute("aria-label", `Pad ${i + 1}`); wire(b, "pad", i); pads.push(b); padGrid.append(b); }
center.append(knobs, padGrid);
// the 4 faders: 0..127
const faderRow = el("div", "sim-faders"), faders = [];
let faderVals = [0, 0, 0, 0];
for (let i = 0; i < 4; i++) {
const label = el("label", "sim-fader", `F${i + 1}`), f = el("input");
f.type = "range"; f.min = 0; f.max = 127; f.value = 0; f.setAttribute("aria-label", `Fader ${i + 1}`);
f.oninput = () => { faderVals[i] = +f.value; send({ type: "fader", i, v: +f.value }); };
label.append(f); faders.push(f); faderRow.append(label);
}
right.append(faderRow);
// the 18 buttons, in smk_input.h's order (bit i = button i)
const BUTTONS = ["KNOB BANK", "FADER BANK", "◀", "▶", "OCT−", "OCT+", "ARP", "NOTE REPEAT", "SCALE", "CHORD", "GLOBE", "BT", "PATCH", "PARA", "FX", "SEQ", "SEQ PLAY", "SEQ REC"];
const SHORT = { 7: "REPEAT", 16: "PLAY", 17: "REC" };
const bankRow = el("div", "sim-banks"), panelBtns = el("div", "sim-buttons"), buttons = [];
BUTTONS.forEach((name, id) => {
const b = el("button", "sim-button", SHORT[id] || name); b.setAttribute("aria-label", name); b.title = name;
wire(b, "button", id); buttons.push(b); (id < 6 ? bankRow : panelBtns).append(b);
});
right.append(panelBtns);
// the wheels: raw values as the SMK's mux reads them (pitch rests ~535, ~445..640; mod 615 none .. 485 full)
const wheels = el("div", "sim-wheels");
for (const [id, name, min, max] of [[0, "Pitch", -100, 100], [1, "Mod", 0, 127]]) {
const label = el("label", "sim-wheel", name), housing = el("span", "sim-wheel-housing"), tread = el("span", "sim-wheel-tread"), input = el("input");
input.type = "range"; input.min = min; input.max = max; input.value = 0; input.setAttribute("aria-label", name + " wheel");
const paint = () => { const p = (+input.value - min) / (max - min); housing.style.setProperty("--wheel-turn", (p * 48) + "px"); housing.style.setProperty("--wheel-position", (12 + (1 - p) * 76) + "%"); };
const out = () => send({ type: "wheel", i: id, raw: id ? Math.round(615 - +input.value * 130 / 127) : 535 + Math.round(+input.value * .95) });
input.oninput = () => { paint(); out(); };
if (!id) { const back = () => { input.value = 0; paint(); out(); }; for (const n of ["pointerup", "pointercancel", "keyup", "blur"]) input.addEventListener(n, back); }
paint(); housing.append(tread, input); label.append(housing); wheels.append(label);
}
wheels.append(bankRow);
// the 37 keys, C3..C6
const piano = el("div", "sim-piano"), keys = [];
const NOTES = ["C", "C♯", "D", "D♯", "E", "F", "F♯", "G", "G♯", "A", "A♯", "B"];
let white = 0;
for (let i = 0; i < 37; i++) {
const n = i + 48, black = [1, 3, 6, 8, 10].includes(n % 12), b = el("button", "sim-key " + (black ? "black" : "white"), black ? "" : NOTES[n % 12] + (Math.floor(n / 12) - 1));
b.setAttribute("aria-label", NOTES[n % 12] + (Math.floor(n / 12) - 1)); b.dataset.key = String(i); wire(b, "key", i);
b.style.setProperty("--key-x", String(black ? white - .31 : white++)); keys.push(b); piano.append(b);
}
piano.style.setProperty("--white-count", white);
top.append(wheels, left, center, right);
const bottom = el("div", "sim-bottom"); bottom.append(piano);
shell.append(top, bottom);
const start = el("div", "start"), go = el("button", "", "Switch on"), msg = el("p"); msg.hidden = true;
go.type = "button"; start.append(go, msg); shell.append(start);
host.replaceChildren(toolbar, shell);
// the computer keyboard: A W S E D F T G Y H U J K O L P ; from the second C (C4), Z / X the octave buttons
const TYPING = ["KeyA", "KeyW", "KeyS", "KeyE", "KeyD", "KeyF", "KeyT", "KeyG", "KeyY", "KeyH", "KeyU", "KeyJ", "KeyK", "KeyO", "KeyL", "KeyP", "Semicolon"];
document.addEventListener("keydown", (e) => {
if (e.ctrlKey || e.metaKey || e.altKey || e.repeat || e.target.closest("input,select,textarea")) return;
const i = TYPING.indexOf(e.code);
if (i >= 0) { e.preventDefault(); press("q" + e.code, "key", 12 + i, 100, keys[12 + i]); }
else if (e.code === "KeyZ") press("q" + e.code, "button", 4, 1, buttons[4]);
else if (e.code === "KeyX") press("q" + e.code, "button", 5, 1, buttons[5]);
});
document.addEventListener("keyup", (e) => release("q" + e.code));
function releaseAll() { for (const id of [...glides.keys()]) glideEnd(id); for (const o of [...owners.keys()]) release(o); }
addEventListener("blur", releaseAll);
document.addEventListener("visibilitychange", () => { if (document.hidden) releaseAll(); send({ type: "visible", on: !document.hidden }); });
// ------------------------------------------------------------------ what the firmware shows
function drawScreen(fb) {
const d = img.data;
for (let i = 0; i < 240 * 240; i++) {
const v = fb[i], p = ((v >> 8) | (v << 8)) & 0xFFFF;
d[i * 4] = ((p >> 11) & 31) * 255 / 31; d[i * 4 + 1] = ((p >> 5) & 63) * 255 / 63; d[i * 4 + 2] = (p & 31) * 255 / 31; d[i * 4 + 3] = 255;
}
ctx.putImageData(img, 0, 0);
}
function drawLights(leds, rgbs) {
buttons.forEach((b, i) => b.classList.toggle("lit", !!(leds & (1 << i))));
pads.forEach((b, i) => {
const c = rgbs[i] >>> 0, r = (c >> 16) & 255, g = (c >> 8) & 255, bl = c & 255, m = Math.max(r, g, bl);
b.classList.toggle("lit", m > 0);
b.classList.toggle("full", m > 160);
if (m > 0) { // the LED's colour, mixed into the dark pad by its level (perceived: the square root)
const k = 255 / m, lv = m / 255;
b.style.setProperty("--led", `rgb(${Math.round(r * k)},${Math.round(g * k)},${Math.round(bl * k)})`);
b.style.setProperty("--mix", Math.round(100 * Math.min(1, 0.15 + 0.85 * Math.sqrt(lv))) + "%");
b.style.setProperty("--glow", lv.toFixed(2));
}
});
}
// ------------------------------------------------------------------ the flash, kept in this browser
function loadFlash() {
try {
const raw = JSON.parse(localStorage.getItem(STORE) || "{}"), out = {};
for (const [off, b64] of Object.entries(raw)) out[off] = Uint8Array.from(atob(b64), (c) => c.charCodeAt(0));
return out;
} catch { return {}; }
}
function saveFlash(sectors) {
try {
const raw = {};
for (const [off, u8] of Object.entries(sectors)) {
let s = "";
for (let i = 0; i < u8.length; i += 4096) s += String.fromCharCode.apply(null, u8.subarray(i, i + 4096));
raw[off] = btoa(s);
}
localStorage.setItem(STORE, JSON.stringify(raw));
return true;
} catch { return false; }
}
// ------------------------------------------------------------------ Web MIDI in (channel messages) to the firmware
async function midiOn() {
if (!navigator.requestMIDIAccess) return;
try {
const access = await navigator.requestMIDIAccess();
const bind = () => { for (const input of access.inputs.values()) input.onmidimessage = (e) => { const d = e.data; if (d.length >= 2 && d[0] >= 0x80 && d[0] < 0xF0) send({ type: "midi", data: [d[0], d[1], d[2] || 0] }); }; };
access.onstatechange = bind; bind();
} catch { /* no permission: the panel only */ }
}
// ------------------------------------------------------------------ switching on
const say = (t) => { msg.textContent = t; msg.hidden = !t; };
function onNodeMessage(m, st) {
if (m.type !== "frame") return;
if (m.fb) drawScreen(m.fb);
if (m.leds !== undefined) drawLights(m.leds, m.pads);
if (m.sectors && !saveFlash(m.sectors) && !st.warned) { st.warned = true; console.warn("FMini-1: this browser does not keep the saves."); }
}
function loadNode(n, wasm, st) {
return new Promise((res, rej) => {
n.port.onmessage = (e) => { const m = e.data; if (m.type === "ready") res(); else if (m.type === "error") rej(new Error(m.message)); else onNodeMessage(m, st); };
n.port.postMessage({ type: "load", wasm, sectors: loadFlash(), faders: faderVals }, [wasm]);
});
}
const sync = () => { send({ type: "buttons", mask: buttonMask }); send({ type: "visible", on: !document.hidden }); };
async function startWorklet(ac, wasm) {
await ac.audioWorklet.addModule("worklet.js");
const n = new AudioWorkletNode(ac, "fmini-smk", { numberOfInputs: 0, numberOfOutputs: 1, outputChannelCount: [2] });
n.connect(ac.destination);
await loadNode(n, wasm, { warned: false });
node = n;
}
// no click yet: the firmware runs silently on this thread (the screen alive); the first click starts the sound
async function startSilent(ac, wasm) {
const { FMiniSMKCore } = await import("./worklet.js");
const core = new FMiniSMKCore();
const out = [[new Float32Array(128), new Float32Array(128)]];
const n = { port: { onmessage: null, postMessage: (m) => core.onMessage(m) } };
core.port = { postMessage: (m) => n.port.onmessage && n.port.onmessage({ data: m }), set onmessage(f) {} };
await loadNode(n, wasm.slice(0), { warned: false });
node = n;
let last = performance.now(), owed = 0;
const timer = setInterval(() => { const t = performance.now(); owed += Math.min(100, t - last) * 44.1 / 128; last = t; for (; owed >= 1; owed--) core.process([], out); }, 8);
const wake = async () => {
try { await ac.resume(); } catch (_) {}
if (ac.state !== "running") return;
for (const t of ["pointerdown", "keydown", "touchstart"]) removeEventListener(t, wake, true);
clearInterval(timer); node = null;
await startWorklet(ac, wasm);
sync();
};
for (const t of ["pointerdown", "keydown", "touchstart"]) addEventListener(t, wake, true);
}
async function switchOn() {
go.disabled = true; go.textContent = "Starting…";
try {
const ac = new AudioContext({ sampleRate: 44100, latencyHint: "interactive" });
ac.resume().catch(() => {});
const [wasm] = await Promise.all([
fetch("felucca.wasm").then((r) => { if (!r.ok) throw new Error(`felucca.wasm: ${r.status}`); return r.arrayBuffer(); }),
new Promise((r) => setTimeout(r, 250))]);
if (ac.state === "running") await startWorklet(ac, wasm); else await startSilent(ac, wasm);
start.hidden = true;
sync();
midiOn();
} catch (err) {
node = null; go.disabled = false; go.textContent = "Switch on";
say("Could not start: " + (err && err.message || err) + ". A current Chrome, Edge, Firefox or Safari should work.");
}
}
go.addEventListener("click", switchOn);
switchOn();
</script>
</body>
</html>
+133
View File
@@ -0,0 +1,133 @@
// SPDX-License-Identifier: GPL-3.0-only
// FMini-1 on the SMK-37 in an AudioWorklet: felucca.wasm is the whole firmware built for the SMK-37 (web/emu/felucca_web.c
// with BOARD_SMK37, its input from web/emu/smk_web_input.h). Each render quantum asks it for 128 frames, which runs the
// device's clock forward; between quanta the page's input goes in and, about 30 times a second (4 when the page is
// hidden), the screen, the button lights, the pads' colours and any changed flash go out. The FM-1 one (../worklet.js)
// is the pattern.
// The flash the page keeps: the SMK-37's data area (settings, projects, the autosave: 0x9D000..0xBAFFF) and the preset
// slots in the user sample area (0xC2000..0xE9FFF), only the sectors that hold something. {offset: bytes}
export const STORE_AREAS = [[0x9D000, 0xBB000], [0xC2000, 0xEA000]];
export function storeSectors(nor) {
const out = {};
for (const [a, b] of STORE_AREAS)
for (let off = a; off < b; off += 4096) {
const s = nor.subarray(off, off + 4096);
if (s.some((v) => v !== 0xFF)) out[off] = s.slice();
}
return out;
}
export function restoreSectors(nor, sectors) {
for (const [k, v] of Object.entries(sectors || {})) {
const off = +k, b = v instanceof Uint8Array ? v : new Uint8Array(v);
if (STORE_AREAS.some(([a, e]) => off >= a && off + 4096 <= e && off % 4096 === 0) && b.length === 4096)
nor.set(b, off);
}
}
export const HOLD_MS = 24; // a button change stays this long (device time) before the next: the UI reads them a frame
const clock = globalThis.performance ? () => globalThis.performance.now() : () => Date.now();
const nowSec = () => (typeof currentTime === "number" ? currentTime : clock() / 1000);
const Base = typeof AudioWorkletProcessor === "function" ? AudioWorkletProcessor : class { constructor() { this.port = { postMessage() {}, onmessage: null }; } };
{
class FMiniSMK extends Base {
constructor() {
super();
this.ex = null;
this.sentDraws = -1;
this.sentWrites = -1;
this.sentLeds = "";
this.lastFrame = 0;
this.period = 1 / 30;
this.queue = [];
this.nextOk = 0;
this.port.onmessage = (e) => this.onMessage(e.data);
}
async onMessage(m) {
if (m.type === "load") {
try {
const { instance } = await WebAssembly.instantiate(m.wasm, {});
const ex = instance.exports;
ex._initialize();
ex.web_nor_erase();
restoreSectors(new Uint8Array(ex.memory.buffer, ex.web_nor(), ex.web_nor_size()), m.sectors);
ex.web_smk_wheel(0, 535);
ex.web_smk_wheel(1, 615);
for (let i = 0; i < 4; i++) ex.web_smk_fader(i, m.faders ? m.faders[i] : 0);
ex.web_boot();
this.ex = ex;
this.sentWrites = ex.web_flash_writes_count();
this.port.postMessage({ type: "ready", rate: ex.web_sample_rate() });
} catch (err) {
this.port.postMessage({ type: "error", message: String(err && err.message || err) });
}
return;
}
const ex = this.ex;
if (!ex) return;
if (m.type === "buttons") this.queue.push(m);
else if (m.type === "key") ex.web_smk_key(m.k, m.vel | 0);
else if (m.type === "pad") ex.web_smk_pad(m.p, m.vel | 0);
else if (m.type === "enc") ex.web_smk_enc(m.e, m.n | 0);
else if (m.type === "fader") ex.web_smk_fader(m.i, m.v | 0);
else if (m.type === "wheel") ex.web_smk_wheel(m.i, m.raw | 0);
else if (m.type === "midi") ex.web_midi(m.data[0] | 0, m.data[1] | 0, m.data[2] | 0);
else if (m.type === "visible") this.period = m.on ? 1 / 30 : 1 / 4;
}
publish() {
const ex = this.ex, mem = ex.memory.buffer;
const msg = { type: "frame" };
const pads = Array.from(new Uint32Array(mem, ex.web_smk_pad_rgb(), 16));
const leds = ex.web_smk_leds();
const key = leds + ";" + pads.join(",");
if (key !== this.sentLeds) {
this.sentLeds = key;
msg.leds = leds;
msg.pads = pads;
}
const transfer = [];
const draws = ex.web_screen_draws();
if (draws !== this.sentDraws) {
this.sentDraws = draws;
msg.fb = new Uint16Array(mem, ex.web_screen(), 240 * 240).slice();
transfer.push(msg.fb.buffer);
}
const writes = ex.web_flash_writes_count();
if (writes !== this.sentWrites) {
this.sentWrites = writes;
msg.sectors = storeSectors(new Uint8Array(mem, ex.web_nor(), ex.web_nor_size()));
}
if (msg.leds !== undefined || msg.fb || msg.sectors) this.port.postMessage(msg, transfer);
}
input() {
const ex = this.ex, now = ex.web_now_ms();
while (this.queue.length && now - this.nextOk >= 0) {
const m = this.queue.shift();
ex.web_smk_buttons(m.mask >>> 0);
this.nextOk = now + HOLD_MS;
}
}
process(inputs, outputs) {
const ex = this.ex;
if (!ex) return true;
if (this.queue.length) this.input();
const out = outputs[0], n = out[0].length;
ex.web_render(n);
out[0].set(new Float32Array(ex.memory.buffer, ex.web_out_l(), n));
if (out[1]) out[1].set(new Float32Array(ex.memory.buffer, ex.web_out_r(), n));
if (nowSec() - this.lastFrame >= this.period) {
this.lastFrame = nowSec();
this.publish();
}
return true;
}
}
if (typeof registerProcessor === "function") registerProcessor("fmini-smk", FMiniSMK);
globalThis.FMiniSMKCore = FMiniSMK;
}
export const FMiniSMKCore = globalThis.FMiniSMKCore;
+215
View File
@@ -0,0 +1,215 @@
/* SPDX-License-Identifier: GPL-3.0-only */
/* The SMK-37 in the browser (felucca_web.c with BOARD_SMK37): what firmware/hal/smk_input.h gives the firmware, without
* the hardware. The page hands over what the scan would find: a key with its velocity, a pad hit or release, the
* 18 buttons, encoder detents, the faders (0..127) and the wheels (raw 0..1023, as mux C reads them); the logic past
* the scan (the outer keys' queue, the UI-owned pads, the edges, the virtual MASTER pot on K1) is smk_input.h's, copied.
* Included before tests/hostsim.c: seq.c and the MIDI OUT (smk_midi_out.c) take from it. */
#pragma once
#include <stdint.h>
#define FM1_INPUT_IDLE() ((void)0)
#define FM1_NBTN 18u
#define FM1_NKEY 37u
#define FM1_NENC 8u
#define SMK_NPAD 16u
#define SMK_NLED 19u
#define SMK_KEY_F3 5u
enum { FM1_BTN_OCT_DOWN = 4, FM1_BTN_OCT_UP = 5 };
enum { SMK_BTN_KNOB_BANK = 0, SMK_BTN_FADER_BANK = 1, SMK_BTN_LEFT = 2, SMK_BTN_RIGHT = 3 };
#define FM1_OCT_BOTH (1u << FM1_BTN_OCT_DOWN | 1u << FM1_BTN_OCT_UP)
#ifndef FM1_TICKS_PER_US
#define FM1_TICKS_PER_US 24u
#endif
static uint32_t fm1_ticks(void);
static const uint8_t SMK_WHITE_NOTE[SMK_NPAD] = {0, 2, 4, 6, 7, 9, 11, 12, 14, 16, 18, 19, 21, 23, 24, 26};
static volatile uint8_t smk_pad_grid;
#define SMK_PAD_OF_WHITE(w) (smk_pad_grid ? (w) : (w) < 8u ? (w) + 8u : (w) - 8u)
static const int8_t SMK_PIANO_NOTE[SMK_NPAD] = {7, 9, 11, 12, 14, 16, 18, 19, 8, 10, -1, 13, 15, 17, -1, 20};
static volatile uint8_t smk_pad_piano;
static volatile uint8_t smk_pad_ui;
static volatile uint16_t smk_pad_hits;
#define SMK_PADMQ 32u
static volatile uint16_t smk_padmq[SMK_PADMQ];
static volatile uint8_t smk_padmq_w, smk_padmq_r;
static uint8_t smk_pad_note[SMK_NPAD];
#define SMK_WHITE_OF_PAD(p) (smk_pad_grid ? (p) : (p) < 8u ? (p) + 8u : (p) - 8u)
#define SMK_TRIM_FLASH 0xC1000u
static int smk_trim_load(const uint8_t *rec) { (void)rec; return -1; }
static volatile struct {
uint32_t notes, knotes, pnotes, buttons, pressed, released, notes_pressed;
uint64_t keys;
uint8_t key_vel[FM1_NKEY];
int16_t enc_steps[FM1_NENC];
uint8_t fader[4];
uint16_t wheel[2], pedal, batt;
uint32_t frames;
} fm1_in;
#define SMK_EXTQ 32u
static volatile uint16_t smk_extq[SMK_EXTQ];
static volatile uint8_t smk_extq_w, smk_extq_r;
static uint8_t fm1_led[SMK_NLED];
static void smk__extq(uint32_t k, uint32_t vel)
{
uint8_t w = smk_extq_w;
if ((uint8_t)(w + 1u) % SMK_EXTQ == smk_extq_r)
return;
smk_extq[w] = (uint16_t)(k << 8 | vel);
smk_extq_w = (uint8_t)((w + 1u) % SMK_EXTQ);
}
static void smk__key_event(uint32_t k, uint32_t vel) /* vel 0 = release */
{
if (vel)
fm1_in.key_vel[k] = (uint8_t)vel;
if (k >= SMK_KEY_F3 && k < SMK_KEY_F3 + 27u) {
uint32_t bit = 1u << (k - SMK_KEY_F3);
if (vel) {
fm1_in.knotes |= bit;
fm1_in.notes_pressed |= bit;
} else {
fm1_in.knotes &= ~bit;
}
fm1_in.notes = fm1_in.knotes | fm1_in.pnotes;
} else {
smk__extq(k, vel);
}
if (vel)
fm1_in.keys |= (uint64_t)1u << k;
else
fm1_in.keys &= ~((uint64_t)1u << k);
}
static void smk__padq(uint32_t pad, uint32_t vel)
{
int32_t n0 = smk_pad_piano ? SMK_PIANO_NOTE[pad] : (int32_t)SMK_WHITE_NOTE[SMK_WHITE_OF_PAD(pad)];
uint32_t n, bit;
if (smk_pad_ui && !smk_pad_note[pad]) {
uint8_t w = smk_padmq_w;
if (vel)
smk_pad_hits |= (uint16_t)(1u << pad);
if ((uint8_t)(w + 1u) % SMK_PADMQ != smk_padmq_r) {
smk_padmq[w] = (uint16_t)(pad << 8 | (vel & 0x7Fu));
smk_padmq_w = (uint8_t)((w + 1u) % SMK_PADMQ);
}
return;
}
if (vel) {
if (n0 < 0)
return;
smk_pad_note[pad] = (uint8_t)(n0 + 1);
} else {
if (!smk_pad_note[pad])
return;
n0 = smk_pad_note[pad] - 1;
smk_pad_note[pad] = 0;
}
n = (uint32_t)n0;
bit = 1u << n;
if (vel) {
fm1_in.key_vel[SMK_KEY_F3 + n] = (uint8_t)vel;
fm1_in.pnotes |= bit;
fm1_in.notes_pressed |= bit;
} else {
fm1_in.pnotes &= ~bit;
}
fm1_in.notes = fm1_in.knotes | fm1_in.pnotes;
}
static void fm1_input_init(void) {}
static void fm1_input_tick(void) {}
static void fm1_input_scan(void) {}
static int32_t fm1_enc_take(uint32_t e)
{
int32_t s = fm1_in.enc_steps[e % FM1_NENC];
fm1_in.enc_steps[e % FM1_NENC] = 0;
return s;
}
static uint32_t fm1_input_edges(uint32_t *released)
{
uint32_t p = fm1_in.pressed;
if (released)
*released = fm1_in.released;
fm1_in.pressed = fm1_in.released = 0;
return p;
}
static uint32_t fm1_input_note_edges(void)
{
uint32_t p = fm1_in.notes_pressed;
fm1_in.notes_pressed = 0;
return p;
}
static int32_t smk_padmidi_take(void)
{
int32_t v = -1;
if (smk_padmq_r != smk_padmq_w) {
v = smk_padmq[smk_padmq_r];
smk_padmq_r = (uint8_t)((smk_padmq_r + 1u) % SMK_PADMQ);
}
return v;
}
static int32_t smk_extkey_take(void)
{
int32_t v = -1;
if (smk_extq_r != smk_extq_w) {
v = smk_extq[smk_extq_r];
smk_extq_r = (uint8_t)((smk_extq_r + 1u) % SMK_EXTQ);
}
return v;
}
static void fm1_led_key(uint32_t id, int on)
{
if (id < SMK_NLED)
fm1_led[id] = (uint8_t)(on != 0);
}
/* the virtual MASTER pot on K1, as smk_input.h fm1_adc_read */
enum { FM1_ADC_BATT = 3, FM1_ADC_MASTER = 4 };
#define SMK_ENC_MASTER 0u
#define SMK_MASTER_SLOW_MS 150u
static int32_t smk_master = 724;
static void fm1_adc_init(void) {}
static int32_t fm1_adc_read(uint32_t ch)
{
if (ch == FM1_ADC_BATT)
return 620;
if (ch == FM1_ADC_MASTER) {
static uint32_t t_last;
int32_t s = fm1_enc_take(SMK_ENC_MASTER);
if (s) {
uint32_t now = fm1_ticks(), dt = (now - t_last) / (1000u * FM1_TICKS_PER_US);
t_last = now;
if ((s == 1 || s == -1) && dt >= SMK_MASTER_SLOW_MS) {
int32_t pct = smk_master * 100 / 1023 + s;
pct = pct < 0 ? 0 : pct > 100 ? 100 : pct;
smk_master = (pct * 1023 + 99) / 100;
} else
smk_master += s * 24;
smk_master = smk_master < 0 ? 0 : smk_master > 1023 ? 1023 : smk_master;
}
return smk_master;
}
return -1;
}
/* hal/smk_compat.h: no FM-1 LED glow or animations on the SMK */
static void fm1_led_dim_level(uint32_t lo) { (void)lo; }
static void fm1_led_anim_start(uint32_t glow) { (void)glow; }
static int fm1_led_anim_on(void) { return 0; }
static void fm1_led_idle_start(uint32_t glow) { (void)glow; }
static int fm1_led_idle_on(void) { return 0; }
static void fm1_led_anim_stop(void) {}
/* lcd.c's RGB pads: their colours for the page (0x00RRGGBB per hardware pad) */
#define PADLED_N 16u
static uint32_t padled_rgb[PADLED_N];
static uint32_t padled_hold_until;
static void padled_set(uint32_t pad, uint8_t r, uint8_t g, uint8_t b)
{
if (pad < PADLED_N)
padled_rgb[pad] = (uint32_t)r << 16 | (uint32_t)g << 8 | b;
}
static void padled_flush(void) {}
+29 -10
View File
@@ -1,8 +1,11 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
# FMini-1: the official site, one self-contained page (site_fmini.html: the Minimoog-styled site with the screens, the presets,
# MIDI and the Felucca installer's logic; the firmware package and every picture are embedded).
# web/make_fmini_installer.py build/fmini-1-fm1-<version>.fwsc OUT.html [VERSION]
# MIDI and the Felucca installer's logic; the firmware packages and every picture are embedded). The installer carries the
# FM-1's package and the SMK-37's three (Pro, Elite, MKE-P37), each for exactly its model; the device found picks it.
# web/make_fmini_installer.py build/fmini-1-fm1-<version>.fwsc OUT.html [VERSION [SMK_VERSION]]
# The SMK-37 packages are build/fmini-1-smk37[-elite|-mke]-<SMK_VERSION>.fwsc (BOARD=smk37 [MODEL=...] ./build.sh);
# SMK_VERSION defaults to FMINI_SMK_VERSION in firmware/src/core.h.
# Serve it over https or http://localhost (Web MIDI with SysEx needs a secure context), in Chrome / Edge.
import base64
import json
@@ -13,16 +16,32 @@ from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from make_site import HERE, strip_module, product_of # noqa: E402
SMK_STEMS = (("fmini-1-smk37", "SMK-37 Pro"), ("fmini-1-smk37-elite", "SMK-37 Elite"), ("fmini-1-smk37-mke", "MKE-P37"))
def main(pkg, out, version="1.4.2"):
raw = Path(pkg).read_bytes()
def package(path, want, label, version):
raw = Path(path).read_bytes()
product = product_of(raw)
if not re.fullmatch(r"FM-1_9\d\d", product) or b"FELUCCA-LOADER-1" not in raw:
raise SystemExit(f"{pkg}: not a Felucca-loader package (identity {product!r})")
if not re.fullmatch(re.escape(want) + r"_9\d\d", product) or b"FELUCCA-LOADER-1" not in raw:
raise SystemExit(f"{path}: not a Felucca-loader package for {want} (identity {product!r})")
return {"product": product, "label": label, "file": Path(path).name, "version": version,
"pkg": "data:application/octet-stream;base64," + base64.b64encode(raw).decode()}
def main(pkg, out, version="1.4.2", smk_version=None):
if smk_version is None:
m = re.search(r'#define FMINI_SMK_VERSION "v(\d+\.\d+\.\d+)"', (HERE.parent / "firmware" / "src" / "core.h").read_text())
smk_version = m.group(1) if m else version
build = Path(pkg).resolve().parent
pkgs = [package(pkg, "FM-1", "FM-1", version)]
for stem, model in SMK_STEMS:
f = build / f"{stem}-{smk_version}.fwsc"
if not f.exists():
raise SystemExit(f"{f}: missing (BOARD=smk37 [MODEL=elite|mke] ./build.sh)")
pkgs.append(package(f, model, model, smk_version))
html = (HERE / "site_fmini.html").read_text(encoding="utf-8")
lib = "\n".join(strip_module((HERE / f).read_text(encoding="utf-8")) for f in ("fm1pkg.js", "fm1ota.js", "fm1backup.js"))
url = "data:application/octet-stream;base64," + base64.b64encode(raw).decode()
meta = json.dumps({"version": version, "product": product, "pkg": url})
meta = json.dumps({"version": version, "smkVersion": smk_version, "pkgs": pkgs})
hero = "data:image/jpeg;base64," + base64.b64encode((HERE.parent / "assets" / "fmini-installer-hero.jpg").read_bytes()).decode()
imgs = {p.stem: ("data:image/" + ("webp" if p.suffix == ".webp" else "png") + ";base64,") + base64.b64encode(p.read_bytes()).decode() for p in sorted((HERE.parent / "assets" / "site").glob("*.*"))}
names = re.findall(r'"([A-Z0-9 .\'/+&-]{2,12})"', (HERE.parent / "firmware" / "src" / "eng_fmini_presets.h").read_text())[:10]
@@ -33,10 +52,10 @@ def main(pkg, out, version="1.4.2"):
html = html.replace("/*LIB*/", lib).replace("/*META*/", meta).replace("/*HERO*/", hero)
html = html.replace('<span class="ver" id="ver">v1.1.0</span>', f'<span class="ver" id="ver">v{version}</span>', 1)
Path(out).write_text(html, encoding="utf-8")
print(f"{out}: {len(html)} B, {product}, package {len(raw)} B embedded")
print(f"{out}: {len(html)} B, " + ", ".join(f"{p['product']} v{p['version']}" for p in pkgs))
if __name__ == "__main__":
if len(sys.argv) not in (3, 4):
if len(sys.argv) not in (3, 4, 5):
sys.exit(__doc__)
main(*sys.argv[1:])
+271 -123
View File
@@ -6,8 +6,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<meta name="description" content="FMini-1: a Minimoog emulation firmware for the M-Vave FM-1, mono and polyphonic. Analog Circuit Modelling, 3 oscillators, ladder filter, 200 presets, arpeggiator, sequencer, MIDI.">
<title>FMini-1 — a Minimoog emulation for the M-Vave FM-1</title>
<meta name="description" content="FMini-1: a Minimoog emulation firmware for the M-Vave FM-1 and SMK-37, mono and polyphonic. Analog Circuit Modelling, 3 oscillators, ladder filter, 200 presets, arpeggiator, sequencer, MIDI.">
<title>FMini-1 — a Minimoog emulation for the M-Vave FM-1 and SMK-37</title>
<style>
:root {
--bg: #0d0c10; --surface: #15131a; --surface2: #1c1922; --line: #2a2631; --fg: #f4f0ea; --dim: #a29cab; --mute: #6f6a78;
@@ -36,17 +36,25 @@
header.nav nav a.keep:hover { background: var(--or2); }
.lang { font: 600 12px/1 var(--mono); color: var(--dim); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; cursor: pointer; }
.lang:hover { color: var(--fg); border-color: var(--mute); }
header.nav nav a.try .ts { display: none; }
header.nav nav a.try .ts, header.nav nav .try .ts { display: none; }
.trywrap { position: relative; }
header.nav nav button.try { font: 500 14px/1.65 var(--sans); color: var(--dim); background: transparent; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
header.nav nav button.try:hover, header.nav nav button.try[aria-expanded=true] { color: var(--fg); background: var(--surface2); }
header.nav nav button.try .car { font-size: 10px; margin-left: 5px; opacity: .7; }
.trymenu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.55); z-index: 40; }
header.nav nav .trymenu a { display: flex; align-items: baseline; gap: 10px; color: var(--fg); padding: 10px 12px; border-radius: 8px; font-weight: 600; }
header.nav nav .trymenu a small { color: var(--mute); font: 500 11.5px/1 var(--mono); }
header.nav nav .trymenu a:hover { background: var(--surface2); }
header.nav nav a.donate { color: var(--or2); }
/* a phone: the section links go, the emulator's ("Try in browser") and Install stay; on a narrow one the short label */
@media (max-width: 720px) {
header.nav nav a:not(.keep):not(.try) { display: none; }
header.nav nav > a:not(.keep):not(.try) { display: none; }
header.nav .wrap { gap: 10px; }
header.nav nav a { padding: 8px 9px; font-size: 13px; }
header.nav nav a.keep { margin-left: 2px; }
header.nav nav a.try { color: var(--fg); border: 1px solid var(--line); }
header.nav nav a.try, header.nav nav button.try { color: var(--fg); border: 1px solid var(--line); padding: 8px 9px; font-size: 13px; }
}
@media (max-width: 430px) { header.nav nav a.try .tl { display: none; } header.nav nav a.try .ts { display: inline; } }
@media (max-width: 430px) { header.nav nav .try .tl { display: none; } header.nav nav .try .ts { display: inline; } }
.tipbg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.tipbg[hidden] { display: none; }
.tipbox { background: var(--surface2, #1b1917); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 380px; color: var(--fg); }
@@ -92,7 +100,8 @@
.fm .body { display: block; width: 100%; height: auto; filter: drop-shadow(0 30px 50px rgba(0,0,0,.6)); }
.fm .lcd { position: absolute; left: 30.73%; top: 15.23%; width: 16.76%; height: 28.3%; background: #000; overflow: hidden; border-radius: 1.5%; opacity: 0;
box-shadow: 0 0 18px rgba(255,122,26,.18); cursor: pointer; }
.fm .lcd #scr { position: absolute; inset: 0; }
.fm .lcd .scr { position: absolute; inset: 0; }
.fm.smk .lcd { left: 13.702%; top: 11.423%; width: 17.107%; height: 38.713%; border-radius: 1.2%; }
.fm .lcd img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity .6s ease; }
.copy2 { position: absolute; z-index: 3; left: 0; right: 0; text-align: center; opacity: 0; pointer-events: none; padding: 0 24px; }
.copy2 h2 { margin: 0 auto; font-size: clamp(26px, 4vw, 40px); }
@@ -201,12 +210,13 @@
#install .steps { margin-bottom: 12px; }
#install #go { padding: 13px 20px; }
@media (min-width: 900px) { /* the install block on one screen: steps and button left, notes and details right */
#install .card { display: grid; grid-template-columns: 1.3fr 1fr; column-gap: 32px; row-gap: 12px; align-items: start; }
#install .card { display: grid; grid-template-columns: 1.3fr 1fr; grid-template-rows: auto auto auto auto auto 1fr; column-gap: 32px; row-gap: 12px; align-items: start; }
#install .steps { grid-column: 1; grid-row: 1; margin: 0; }
#install #go { grid-column: 1; grid-row: 2; }
#install .busywarn { grid-column: 1; grid-row: 3; margin: 0; }
#install .prog { grid-column: 1; grid-row: 4; margin: 0; }
#install .side { grid-column: 2; grid-row: 1 / span 4; display: flex; flex-direction: column; gap: 12px; }
#install .detected { grid-column: 1; grid-row: 2; margin: 0; }
#install #go { grid-column: 1; grid-row: 3; }
#install .busywarn { grid-column: 1; grid-row: 4; margin: 0; }
#install .prog { grid-column: 1; grid-row: 5; margin: 0; }
#install .side { grid-column: 2; grid-row: 1 / span 6; display: flex; flex-direction: column; gap: 12px; }
#install .side .note { margin: 0; }
}
.meter { position: relative; height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
@@ -230,6 +240,16 @@
body.finished #phases li.done::before { background: var(--ok); }
.note { color: var(--dim); font-size: 14.5px; margin: 10px 0 0; }
.detected { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--or); background: rgba(255,122,26,.10); font-size: 15px; line-height: 1.45; }
.detected b { color: var(--or2); }
.fwlist { list-style: none; margin: 8px 0 0; padding: 0; }
.fwlist li { margin: 6px 0; font-size: 14px; }
.fwlist li span { color: var(--mute); font: 500 12px/1 var(--mono); margin-left: 8px; }
.portpick label { display: block; margin-top: 14px; color: var(--dim); font-size: 13px; }
.devs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.devs label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg); font-size: 14px; cursor: pointer; }
.devs label:has(input:checked) { border-color: var(--or); background: rgba(255,122,26,.10); }
.devs input { accent-color: var(--or); margin: 0; }
.fwother { margin: 6px 0 0; }
#fwpick { background: transparent; color: var(--dim); border: 1px solid var(--line); font-size: 13px; padding: 6px 10px; cursor: pointer; }
.note.warn { color: #ffb37a; }
@@ -259,8 +279,10 @@
<a href="#features" data-t="nav_f"></a>
<a href="#screens" data-t="nav_s"></a>
<a href="#feat" data-t="nav_ft"></a>
<a href="#smk37">SMK-37</a>
<a href="editor/" data-t="nav_ed"></a>
<a href="emu/" class="try"><span class="tl" data-t="nav_try"></span><span class="ts" data-t="nav_try_s"></span></a>
<div class="trywrap"><button type="button" class="try" id="trybtn" aria-haspopup="true" aria-expanded="false"><span class="tl" data-t="nav_try"></span><span class="ts" data-t="nav_try_s"></span><span class="car">▾</span></button>
<div class="trymenu" id="trymenu" hidden><a href="emu/">FM-1 <small data-t="try_fm1"></small></a><a href="emu/smk/">SMK-37 <small data-t="try_smk"></small></a></div></div>
<a href="https://ko-fi.com/ruppert" class="try donate" target="_blank" rel="noopener"><span class="tl" data-t="donate"></span><span class="ts" data-t="donate_s"></span></a>
<a href="#install" class="keep" data-t="nav_i"></a>
</nav>
@@ -287,8 +309,13 @@
<img class="mm" id="mm" alt="Minimoog" src="/*HERO*/">
<figure class="fm" id="fm">
<img class="body" id="fm-body" alt="M-VAVE FM-1" src="">
<div class="lcd" id="lcd"><div id="scr"><img id="lcd-a" alt=""><img id="lcd-b" alt=""></div></div>
<div class="lcd" id="lcd"><div class="scr" id="scr"><img id="lcd-a" alt=""><img id="lcd-b" alt=""></div></div>
</figure>
<figure class="fm smk" id="smkfig">
<img class="body" id="smk-body" alt="M-VAVE SMK-37" src="">
<div class="lcd" id="lcd2"><div class="scr" id="scr2"><img id="lcd2-a" alt=""><img id="lcd2-b" alt=""></div></div>
</figure>
<img class="mm" id="mm2" alt="" aria-hidden="true">
<div class="copy2" id="copy2">
<h2 data-t="hero2_t"></h2>
<p data-t="hero2_s"></p>
@@ -322,6 +349,21 @@
</div>
</section>
<section class="s wrap" id="smk37">
<p class="eyebrow">SMK-37</p>
<h2 data-t="h_smk"></h2>
<p class="lead" data-t="l_smk"></p>
<div class="grid">
<article class="feat"><span class="n">01</span><h3 data-t="k1t"></h3><p data-t="k1d"></p></article>
<article class="feat"><span class="n">02</span><h3 data-t="k2t"></h3><p data-t="k2d"></p></article>
<article class="feat"><span class="n">03</span><h3 data-t="k3t"></h3><p data-t="k3d"></p></article>
<article class="feat"><span class="n">04</span><h3 data-t="k4t"></h3><p data-t="k4d"></p></article>
<article class="feat"><span class="n">05</span><h3 data-t="k5t"></h3><p data-t="k5d"></p></article>
<article class="feat"><span class="n">06</span><h3 data-t="k6t"></h3><p data-t="k6d"></p></article>
</div>
<p class="cta"><a class="btn sec2" href="emu/smk/" data-t="btn_smkemu"></a></p>
</section>
<section class="s wrap" id="screens">
<p class="eyebrow" data-t="e_screens"></p>
<h2 data-t="h_screens"></h2>
@@ -373,9 +415,14 @@
<li><b><i>3</i><span data-t="step3"></span></b><span class="d" data-t="s3"></span></li>
</ol>
<div class="detected" id="detected" role="status" hidden></div>
<button id="go" disabled><span data-t="install"></span> <small class="curver-b"></small></button>
<dialog class="portpick" id="portpick"><b data-t="pick_t"></b><p data-t="pick_d"></p><select id="portsel" size="5" aria-label="MIDI"></select><button id="portgo" type="button" data-t="pick_b"></button><button id="portno" type="button" class="ghost" data-t="pick_c"></button></dialog>
<dialog class="portpick" id="portpick"><b data-t="pick_t"></b><p data-t="pick_d"></p>
<label data-t="pick_port"></label><select id="portsel" size="4" aria-label="MIDI"></select>
<label data-t="pick_dev"></label>
<div class="devs" id="devsel"><label><input type="radio" name="dev" value="FM-1" checked> FM-1</label><label><input type="radio" name="dev" value="SMK-37 Pro"> SMK-37 Pro</label><label><input type="radio" name="dev" value="SMK-37 Elite"> SMK-37 Elite</label><label><input type="radio" name="dev" value="MKE-P37"> MKE-P37</label></div>
<button id="portgo" type="button" data-t="pick_b"></button><button id="portno" type="button" class="ghost" data-t="pick_c"></button></dialog>
<div class="busywarn" role="alert"><b data-t="busy_t"></b><span data-t="busy_d"></span></div>
<div class="prog">
<div class="meter" id="bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="fill" id="fill"></div></div>
@@ -388,13 +435,15 @@
<div class="side">
<p class="note" data-t="intro"></p>
<p class="note" data-t="compat"></p>
<p class="note" data-t="smknote"></p>
<p class="note warn" data-t="warn"></p>
<p class="note" data-t="direct"></p>
<p class="note" data-t="beta"></p>
<details>
<summary data-t="logT"></summary>
<p><a id="fwdl" class="fwdl" href="#" download data-t="fwdl"></a></p>
<p data-t="fwdl"></p>
<ul class="fwlist" id="fwlist"></ul>
<p class="fwother"><button id="fwpick" type="button" data-t="fw_pick"></button><input type="file" id="fwfile" accept=".fwsc" hidden></p>
<pre id="log"></pre>
</details>
@@ -419,89 +468,95 @@
const $ = (id) => document.getElementById(id);
const TEXT = {
pt: {
intro: "Conecte o FM-1 por USB. (Funciona no Chrome ou no Edge.)",
intro: "Conecte o FM-1 ou o SMK-37 por USB. O instalador reconhece o aparelho e grava o firmware certo. (Funciona no Chrome ou no Edge.)",
compat: "Compatível com as novas versões do FM-1 (com o chip de flash UC25HQ80).",
warn: "Não desconecte o cabo USB durante a gravação.",
install: "Instalar", other: "English",
fw_pick: "Instalar outro firmware (.fwsc)…", fw_bad: "Este arquivo não é um firmware FM-1 válido.",
fw_pick: "Instalar outro firmware (.fwsc)…", fw_bad: "Este arquivo não é um firmware válido para o FM-1 ou o SMK-37.",
smknote: "SMK-37 (Pro, Elite e MKE-P37): a primeira inicialização apaga as configurações do firmware original. Para voltar ao original, use o firmware e o atualizador da M-Vave para o seu modelo.",
det: "Dispositivo detectado: ", det_ota: " (em modo de atualização)", det_fw: " · instalando o FMini-1 ",
editor: "Editor",
direct: "Ligue o cabo USB direto no computador. Não precisa de Probe nem de Transporter.",
beta: "O FMini-1 é uma versão experimental. O autor não se responsabiliza se o seu FM-1 for danificado ou se comportar de forma estranha por causa deste firmware personalizado. Use por sua conta e risco.",
beta: "O FMini-1 é uma versão experimental. O autor não se responsabiliza se o seu FM-1 ou SMK-37 for danificado ou se comportar de forma estranha por causa deste firmware personalizado. Use por sua conta e risco.",
nomidi: "Este navegador não consegue. Abra a página no Chrome ou no Edge.", loadfail: "Não foi possível carregar: ",
start: "Iniciando", verify: "Verificando", loader: "Entrando no modo de atualização", write: "Gravando",
reboot: "Reiniciando", done: "Pronto! O FM-1 agora é um FMini-1", e_support: "Apoio", h_support: "Suporte o projeto", l_support: "Foram mais de cem horas de trabalho voluntário (mesmo com a ajuda de IA). E sigo corrigindo bugs e implementando novas funções. Seria ótimo se você me apoiasse para continuar este trabalho!!!", btn_support: "Doar", tip_t: "Firmware instalado!", tip_b: "Se você gostar dele, considere dar uma ajuda para o projeto para continuar o aprimoramento dele. Obrigado!", tip_go: "Apoiar no Ko-fi", tip_x: "Fechar", donate: "Apoiar", donate_s: "☕", stopped: "Interrompido. Desconecte e reconecte o USB e aperte Instalar de novo.",
reboot: "Reiniciando", done: "Pronto! Seu teclado agora é um FMini-1", e_support: "Apoio", h_support: "Suporte o projeto", l_support: "Foram mais de cem horas de trabalho voluntário (mesmo com a ajuda de IA). E sigo corrigindo bugs e implementando novas funções. Seria ótimo se você me apoiasse para continuar este trabalho!!!", btn_support: "Doar", tip_t: "Firmware instalado!", tip_b: "Se você gostar dele, considere dar uma ajuda para o projeto para continuar o aprimoramento dele. Obrigado!", tip_go: "Apoiar no Ko-fi", tip_x: "Fechar", donate: "Apoiar", donate_s: "☕", stopped: "Interrompido. Desconecte e reconecte o USB e aperte Instalar de novo.",
error: "Erro: ",
denied: "O acesso ao MIDI (SysEx) não foi permitido. Permita o MIDI nas configurações do site (barra de endereço) e aperte Instalar de novo.",
notfound: "FM-1 não encontrado. Confira o cabo USB (precisa ser de dados), feche outros apps que usam MIDI e aperte Instalar de novo.",
model: "O aparelho conectado não é um FM-1.",
notfound: "Nenhum FM-1 ou SMK-37 encontrado. Confira o cabo USB (precisa ser de dados), feche outros apps que usam MIDI e aperte Instalar de novo.",
model: "O firmware não combina com o aparelho conectado: ",
unknown: "O aparelho conectado não é um FM-1 nem um SMK-37: ",
lost: "A conexão USB caiu. Reconecte e aperte Instalar de novo.",
noloader: "O FM-1 em modo de atualização não foi encontrado. Reconecte o USB e aperte Instalar de novo (ele fica em modo de atualização até terminar).",
noreturn: "O FM-1 não voltou. Desligue e ligue de novo.",
mismatch: "Gravado, mas o FM-1 informa outra versão: ",
noloader: "O aparelho em modo de atualização não foi encontrado. Reconecte o USB e aperte Instalar de novo (ele fica em modo de atualização até terminar).",
noreturn: "O aparelho não voltou. Desligue e ligue de novo.",
mismatch: "Gravado, mas o aparelho informa outra versão: ",
badpkg: "O arquivo a instalar está danificado. Recarregue a página.",
leave: "Gravando. Não feche a página.",
pick_t: "Qual destes é o seu FM-1?", pick_d: "Não achei o FM-1 pelo nome: outro firmware personalizado pode dar outro nome ao USB. Escolha na lista o dispositivo MIDI que é o FM-1 (com o USB dele conectado):", pick_b: "Instalar neste dispositivo", pick_c: "Cancelar",
busy_t: "Instalação em andamento: não feche esta página!", busy_d: "Pode trocar de aba ou de programa. Não feche a página, não desconecte o USB nem desligue o FM-1 até aparecer \"Pronto\". A tela do FM-1 pode ficar apagada ou reiniciar durante o processo: é normal.",
pick_t: "Qual é o seu teclado?", pick_d: "Não achei o FM-1 nem o SMK-37 pelo nome: outro firmware personalizado pode dar outro nome ao USB. Escolha a entrada MIDI do aparelho (com o USB dele conectado) e qual é o aparelho:", pick_port: "Entrada MIDI", pick_dev: "Dispositivo", pick_b: "Instalar neste dispositivo", pick_c: "Cancelar",
busy_t: "Instalação em andamento: não feche esta página!", busy_d: "Pode trocar de aba ou de programa. Não feche a página, não desconecte o USB nem desligue o teclado até aparecer \"Pronto\". A tela pode ficar apagada ou reiniciar durante o processo: é normal.",
license: "GPL-3.0, sem garantia. Código-fonte:",
ready: "Pronto. Conecte o FM-1 e aperte Instalar.",
ready: "Pronto. Conecte o FM-1 ou o SMK-37 e aperte Instalar.",
step1: "Conectar", step2: "Instalar", step3: "Tocar",
s1: "Ligue o FM-1 ao computador com um cabo USB de dados.", s2: "Aperte Instalar e mantenha o cabo conectado até aparecer Pronto.", s3: "O FM-1 reinicia como FMini-1, com a tela de abertura.",
s1: "Ligue o FM-1 ou o SMK-37 ao computador com um cabo USB de dados.", s2: "Aperte Instalar: o aparelho é detectado e o firmware certo é gravado. Mantenha o cabo conectado até aparecer Pronto.", s3: "O teclado reinicia como FMini-1, com a tela de abertura.",
ph_verify: "Verificar", ph_loader: "Modo de atualização", ph_write: "Gravar", ph_reboot: "Reiniciar", ph_done: "Pronto",
tagline: "Emulação do Minimoog para o FM-1 (mono/poly)",
tagline: "Emulação do Minimoog para o FM-1 e o SMK-37 (mono/poly)",
feat: "3 osciladores · filtro ladder · 200 presets · arpejador · MIDI",
risk: "Use por sua conta e risco", logT: "Detalhes", fw: "Firmware",
fwdl: "Baixar este firmware (.fwsc): a versão desta página",
fwdl: "Os firmwares desta página (.fwsc), para baixar:",
},
en: {
intro: "Connect the FM-1 by USB. (Works in Chrome or Edge.)",
intro: "Connect the FM-1 or the SMK-37 by USB. The installer recognises it and writes the right firmware. (Works in Chrome or Edge.)",
compat: "Supports the new FM-1 versions (with the UC25HQ80 flash chip).",
warn: "Do not unplug the USB cable while writing.",
install: "Install", other: "Português",
fw_pick: "Install another firmware (.fwsc)…", fw_bad: "This file is not a valid FM-1 firmware.",
fw_pick: "Install another firmware (.fwsc)…", fw_bad: "This file is not a valid firmware for the FM-1 or the SMK-37.",
smknote: "SMK-37 (Pro, Elite and MKE-P37): the first start clears the stock firmware's settings. To go back to the stock firmware, use M-Vave's firmware and updater for your model.",
det: "Detected device: ", det_ota: " (in update mode)", det_fw: " · installing FMini-1 ",
editor: "Editor (after installing: edit sounds and sequences from the computer)",
direct: "Connect the USB cable directly to the computer. No probe or Transporter is needed.",
beta: "FMini-1 is an experimental release. The author accepts no responsibility if your FM-1 is damaged or misbehaves because of this custom firmware. Use it at your own risk.",
beta: "FMini-1 is an experimental release. The author accepts no responsibility if your FM-1 or SMK-37 is damaged or misbehaves because of this custom firmware. Use it at your own risk.",
nomidi: "This browser cannot do it. Open the page in Chrome or Edge.", loadfail: "Could not load: ",
start: "Starting", verify: "Verifying", loader: "Switching to update mode", write: "Writing",
reboot: "Restarting", done: "Done", e_support: "Support", h_support: "Buy me a Coffee", l_support: "It took over a hundred hours for this voluntary work (even with the help of AI). And I am still fixing bugs and implementing new features. It would be great if you support me to continue this work!!!", btn_support: "Tip", tip_t: "Firmware installed!", tip_b: "If you like it, consider a tip to support the project. Thank you!", tip_go: "Support on Ko-fi", tip_x: "Close", donate: "Support", donate_s: "☕", stopped: "Stopped. Replug the USB cable and press Install again.",
reboot: "Restarting", done: "Done! Your keyboard is now an FMini-1", e_support: "Support", h_support: "Buy me a Coffee", l_support: "It took over a hundred hours for this voluntary work (even with the help of AI). And I am still fixing bugs and implementing new features. It would be great if you support me to continue this work!!!", btn_support: "Tip", tip_t: "Firmware installed!", tip_b: "If you like it, consider a tip to support the project. Thank you!", tip_go: "Support on Ko-fi", tip_x: "Close", donate: "Support", donate_s: "☕", stopped: "Stopped. Replug the USB cable and press Install again.",
error: "Error: ",
denied: "MIDI (SysEx) access was not allowed. Allow MIDI in the site settings (address bar) and press Install again.",
notfound: "FM-1 not found. Check the USB cable (a data cable), close other apps that use MIDI, and press Install again.",
model: "The connected device is not an FM-1.",
notfound: "No FM-1 or SMK-37 found. Check the USB cable (a data cable), close other apps that use MIDI, and press Install again.",
model: "The firmware does not match the connected device: ",
unknown: "The connected device is neither an FM-1 nor an SMK-37: ",
lost: "The USB connection was lost. Replug it and press Install again.",
noloader: "The FM-1 in update mode was not found. Replug the USB cable and press Install again (it stays in update mode until it is finished).",
noreturn: "The FM-1 did not come back. Power-cycle it.",
mismatch: "Written, but the FM-1 reports another version: ",
noloader: "The device in update mode was not found. Replug the USB cable and press Install again (it stays in update mode until it is finished).",
noreturn: "The device did not come back. Power-cycle it.",
mismatch: "Written, but the device reports another version: ",
badpkg: "The file to install is damaged. Reload the page.",
leave: "Writing. Do not close the page.",
pick_t: "Which one is your FM-1?", pick_d: "I could not find the FM-1 by name: another custom firmware may name its USB device differently. Pick the MIDI device that is the FM-1 from the list (with its USB connected):", pick_b: "Install on this device", pick_c: "Cancel",
busy_t: "Installing: do not close this page!", busy_d: "You can switch tabs or apps. Do not close the page, unplug the USB cable or power off the FM-1 until it says Done. The FM-1 screen may go blank or restart meanwhile: that is normal.",
pick_t: "Which is your keyboard?", pick_d: "I could not find the FM-1 or the SMK-37 by name: another custom firmware may name its USB device differently. Pick the device's MIDI input (with its USB connected) and which device it is:", pick_port: "MIDI input", pick_dev: "Device", pick_b: "Install on this device", pick_c: "Cancel",
busy_t: "Installing: do not close this page!", busy_d: "You can switch tabs or apps. Do not close the page, unplug the USB cable or power off the keyboard until it says Done. The screen may go blank or restart meanwhile: that is normal.",
license: "GPL-3.0, no warranty. Source:",
ready: "Ready. Connect your FM-1 and press Install.",
ready: "Ready. Connect your FM-1 or SMK-37 and press Install.",
step1: "Connect", step2: "Install", step3: "Play",
s1: "Plug the FM-1 into the computer with a USB data cable.", s2: "Press Install and keep the cable connected until it says Done.", s3: "The FM-1 restarts as FMini-1 with its splash screen.",
s1: "Plug the FM-1 or the SMK-37 into the computer with a USB data cable.", s2: "Press Install: the device is detected and the right firmware is written. Keep the cable connected until it says Done.", s3: "The keyboard restarts as FMini-1 with its splash screen.",
ph_verify: "Verify", ph_loader: "Update mode", ph_write: "Write", ph_reboot: "Restart", ph_done: "Done",
tagline: "A Minimoog emulation for the M-Vave FM-1 (mono/poly)",
tagline: "A Minimoog emulation for the M-Vave FM-1 and SMK-37 (mono/poly)",
feat: "3 oscillators · ladder filter · 200 presets · arpeggiator · MIDI",
risk: "Use at your own risk", logT: "Details", fw: "Firmware",
fwdl: "Download this firmware (.fwsc): this page's version",
fwdl: "This page's firmwares (.fwsc), to download:",
},
};
/* ---- the site: texts (PT / EN / JA) and the parts it draws itself ---- */
const SITE = {
pt: {
nav_f: "Som", nav_s: "Telas", nav_ft: "Features", nav_ed: "Editor", nav_i: "Instalar",
sub: "Um firmware aberto que transforma o M-VAVE FM-1 em um sintetizador monofônico e polifônico. O FMini-1 usa a técnica de Analog Circuit Modelling, criada a partir dos esquemas reais do Minimoog para reproduzir com precisão o comportamento do instrumento original: três osciladores, filtro ladder, contornos, efeitos e tudo ao alcance dos botões do FM-1.",
sub: "Um firmware aberto que transforma o M-VAVE FM-1 e o SMK-37 em sintetizadores monofônicos e polifônicos. O FMini-1 usa a técnica de Analog Circuit Modelling, criada a partir dos esquemas reais do Minimoog para reproduzir com precisão o comportamento do instrumento original: três osciladores, filtro ladder, contornos, efeitos e tudo ao alcance dos botões e knobs do seu teclado.",
chip_f: "Filtro ladder", chip_p: "200 presets",
cta_install: "Instalar agora", cta_screens: "Ver as telas",
h_sound: "O som", l_sound: "Cada bloco do painel do Minimoog tem seu lugar na tela de 240 × 240 do FM-1, com quatro knobs físicos para tocar de verdade.",
h_sound: "O som", l_sound: "Cada bloco do painel do Minimoog tem seu lugar na tela de 240 × 240, a mesma no FM-1 e no SMK-37, com knobs físicos para tocar de verdade.",
f1t: "Banco de osciladores", f1d: "Três osciladores com faixas de LO a 2', forma de onda individual, ajuste fino (detune) independente nos osciladores 2 e 3 e uma leve deriva de afinação, como a dos VCOs analógicos.",
f2t: "Filtro ladder", f2d: "Ladder de 4 polos, 24 dB/oitava, com saturação em cada estágio e o atraso de realimentação do circuito do Minimoog. Com a ênfase a partir de 8 o filtro auto-oscila numa senoide pura que acompanha o teclado em 1 V/oitava. O corte é lido de −5 a +5, como no painel.",
f3t: "Contornos", f3d: "Dois contornos (filtro e volume) com ataque, decaimento e sustentação. O ataque é exponencial, como o do circuito original. Glide, LFO e modulação completam a seção.",
f4t: "200 presets", f4d: "Vinte grupos de dez: uma vitrine de estilos, hard leads, soft leads, baixos, pads e cordas, metais, plucks, teclas, atmosferas e efeitos sonoros.",
f5t: "Arpejador e sequenciador", f5d: "Um toque no ARP liga e desliga; segurar ativa o HOLD. O sequenciador grava até 64 notas (REC) e toca (PLAY). Os LEDs das teclas acendem junto com as notas.",
f5t: "Arpejador e sequenciador", f5d: "Um toque no ARP liga e desliga; segurar ativa o HOLD. O sequenciador grava até 64 notas (REC) e toca (PLAY). Os LEDs das teclas (no SMK-37, os pads) acendem junto com as notas.",
f6t: "Efeitos por preset", f6d: "Reverb, delay, chorus e drive, cada preset com a sua própria combinação, para que baixos, leads e pads tenham ambientes bem diferentes.",
h_screens: "As telas", l_screens: "O painel foi desenhado para a tela do FM-1, com knobs estriados, chaves vermelhas e azuis e gráficos de filtro e contornos. Escolha uma página:",
h_screens: "As telas", l_screens: "O painel foi desenhado para a tela do FM-1 e do SMK-37, com knobs estriados, chaves vermelhas e azuis e gráficos de filtro e contornos. Escolha uma página:",
views: [
{ t: "CTRL · Controladores", d: "Afinação geral, glide, quantidade de modulação e velocidade do LFO (botão LFO).", l: ["Quatro knobs: TUNE, GLIDE, MOD MIX e LFO RATE", "Chaves MOD OSC, MOD FLT, GLIDE e LFO SQR"] },
{ t: "OSC · Banco de osciladores", d: "Os três osciladores: faixa de oitava, forma de onda e detune dos osciladores 2 e 3.", l: ["Faixas LO, 32', 16', 8', 4' e 2'", "Seis formas de onda, desenhadas nas caixas da tela"] },
@@ -526,26 +581,35 @@ const SITE = {
ft2t: "Mono e 12 vozes", ft2d: "Monofônico como o Minimoog, ou polifônico com 12 vozes.",
ft3t: "Emulação perfeita", ft3d: "Três osciladores, mixer com saturação suave e filtro ladder de 24 dB/oitava com auto-oscilação, modelados no Minimoog Model D.",
ft4t: "Efeitos", ft4d: "5 reverbs (Room, Hall, Plate, Spring, Cloud), 7 delays (Analog, Digital, Tape, Ping-Pong, Multi, Slap, Reverse), 3 chorus (Stereo, Juno, Multi) e drive (Soft, Tube).",
ft5t: "MIDI CC para controladores", ft5d: "50 controles com CC próprio, que você pode trocar, e o FMini-1 aprende o CC que o controlador enviar. Entrada USB e TRS, filtro de canal, pitch bend e roda de modulação (vibrato).",
ft5t: "MIDI CC para controladores", ft5d: "50 controles com CC próprio, que você pode trocar, e o FMini-1 aprende o CC que o controlador enviar. Entrada USB (e TRS no FM-1), filtro de canal, pitch bend e roda de modulação (vibrato).",
ft6t: "Sequenciador de 64 notas", ft6d: "Grave até 64 notas (REC) e toque (PLAY).",
ft7t: "Arpegiador", ft7d: "Um toque liga e desliga, segurar ativa o HOLD.",
ft8t: "Editor web", ft8d: "Edite sons e presets pelo navegador, ligado ao FM-1 por USB-MIDI.",
ft9t: "Emulador online", ft9d: "Experimente o FMini-1 no navegador, sem instalar nada.",
h_install: "Instalar", l_install: "O instalador roda aqui mesmo, no navegador, e grava o firmware no FM-1 pelo cabo USB.",
ft9t: "Emuladores online", ft9d: "Experimente o FMini-1 no navegador, no FM-1 ou no SMK-37, sem instalar nada.",
h_install: "Instalar", l_install: "O instalador roda aqui mesmo, no navegador: reconhece se o aparelho é um FM-1 ou um SMK-37 e grava o firmware certo pelo cabo USB.",
h_smk: "Também no SMK-37", l_smk: "O mesmo FMini-1, a mesma tela e os mesmos 200 presets no teclado de 37 teclas da M-Vave, com tudo o que ele tem a mais: pads, faders, oito knobs e MIDI OUT completo.",
k1t: "37 teclas com velocity", k1d: "Três oitavas inteiras, com OCTAVE− e OCTAVE+. No PRESET SETTINGS, VELOCITY SENS. liga ou desliga a dinâmica de cada preset.",
k2t: "16 pads", k2d: "Escolhem os presets da página atual (o selecionado aceso) e, no sequenciador, mostram os 64 passos em quatro janelas coloridas.",
k3t: "4 faders, 4 bancos", k3d: "FADER BANK alterna entre A.ENV, F.ENV, MIX e os knobs da tela, com um aviso na tela a cada troca.",
k4t: "8 knobs, 4 bancos", k4d: "K1 é o volume, K2 a K4 trocam de preset e navegam, e K5 a K8 controlam FILTER, LFO, FX ou os knobs da tela (KNOB BANK).",
k5t: "MIDI OUT completo", k5d: "Teclas, pads, knobs, faders e as rodas saem por USB e pela saída TRS, com canal de saída próprio.",
k6t: "Pro, Elite e MKE-P37", k6d: "Um firmware para cada modelo. O instalador reconhece qual é o seu e grava o certo.",
btn_smkemu: "Testar o SMK-37 no navegador",
try_fm1: "emulador", try_smk: "emulador",
},
en: {
nav_f: "Sound", nav_s: "Screens", nav_ft: "Features", nav_ed: "Editor", nav_i: "Install",
sub: "An open firmware that turns the M-VAVE FM-1 into a monophonic and polyphonic synth. FMini-1 uses Analog Circuit Modelling, built from the actual Minimoog schematics to accurately reproduce the behaviour of the real instrument: three oscillators, a ladder filter, contours and effects, all within reach of the FM-1's buttons.",
sub: "An open firmware that turns the M-VAVE FM-1 and SMK-37 into monophonic and polyphonic synths. FMini-1 uses Analog Circuit Modelling, built from the actual Minimoog schematics to accurately reproduce the behaviour of the real instrument: three oscillators, a ladder filter, contours and effects, all within reach of your keyboard's buttons and knobs.",
chip_f: "Ladder filter", chip_p: "200 presets",
cta_install: "Install now", cta_screens: "See the screens",
h_sound: "The sound", l_sound: "Each block of the Minimoog panel has its place on the FM-1's 240 × 240 screen, with four real knobs to play it for real.",
h_sound: "The sound", l_sound: "Each block of the Minimoog panel has its place on the 240 × 240 screen, the same on the FM-1 and the SMK-37, with real knobs to play it for real.",
f1t: "Oscillator bank", f1d: "Three oscillators with ranges from LO to 2', a waveform each, independent detune on oscillators 2 and 3 and a touch of pitch drift, like analog VCOs.",
f2t: "Ladder filter", f2d: "A four-pole ladder, 24 dB/octave, with saturation in every stage and the feedback lag of the Minimoog circuit. From emphasis 8 up it self-oscillates as a pure sine that follows the keyboard at 1 V/octave. Cutoff reads -5 to +5, as on the panel.",
f3t: "Contours", f3d: "Two contours (filter and loudness) with attack, decay and sustain. The attack is exponential, like the original circuit. Glide, LFO and modulation complete the section.",
f4t: "200 presets", f4d: "Twenty groups of ten: a showcase of styles, hard leads, soft leads, basses, pads and strings, brass, plucks, keys, atmospheres and sound effects.",
f5t: "Arpeggiator and sequencer", f5d: "One tap on ARP turns it on and off; holding it sets HOLD. The sequencer records up to 64 notes (REC) and plays them (PLAY). The key LEDs light with the notes.",
f5t: "Arpeggiator and sequencer", f5d: "One tap on ARP turns it on and off; holding it sets HOLD. The sequencer records up to 64 notes (REC) and plays them (PLAY). The key LEDs (the pads on the SMK-37) light with the notes.",
f6t: "Effects per preset", f6d: "Reverb, delay, chorus and drive, each preset with its own combination, so basses, leads and pads live in very different spaces.",
h_screens: "The screens", l_screens: "The panel is drawn for the FM-1's screen, with fluted knobs, red and blue rocker switches and graphs of the filter and contours. Pick a page:",
h_screens: "The screens", l_screens: "The panel is drawn for the screen of the FM-1 and the SMK-37, with fluted knobs, red and blue rocker switches and graphs of the filter and contours. Pick a page:",
views: [
{ t: "CTRL · Controllers", d: "Master tune, glide, modulation amount and LFO speed (the LFO button).", l: ["Four knobs: TUNE, GLIDE, MOD MIX and LFO RATE", "Switches MOD OSC, MOD FLT, GLIDE and LFO SQR"] },
{ t: "OSC · Oscillator bank", d: "The three oscillators: octave range, waveform and detune for oscillators 2 and 3.", l: ["Ranges LO, 32', 16', 8', 4' and 2'", "Six waveforms, drawn in the boxes on the screen"] },
@@ -570,25 +634,34 @@ const SITE = {
ft2t: "Mono and 12 voices", ft2d: "Monophonic like the Minimoog, or polyphonic with 12 voices.",
ft3t: "Minimoog model", ft3d: "Three oscillators, a mixer that overloads softly and a 24 dB/oct ladder filter that self-oscillates, modelled on the Minimoog Model D.",
ft4t: "Effects", ft4d: "5 reverbs (Room, Hall, Plate, Spring, Cloud), 7 delays (Analog, Digital, Tape, Ping-Pong, Multi, Slap, Reverse), 3 choruses (Stereo, Juno, Multi) and drive (Soft, Tube).",
ft5t: "MIDI CC for controllers", ft5d: "50 controls with their own CC, which you can change, and the FMini-1 learns the CC your controller sends. USB and TRS input, channel filter, pitch bend and mod wheel (vibrato).",
ft5t: "MIDI CC for controllers", ft5d: "50 controls with their own CC, which you can change, and the FMini-1 learns the CC your controller sends. USB input (and TRS on the FM-1), channel filter, pitch bend and mod wheel (vibrato).",
ft6t: "64-note sequencer", ft6d: "Record up to 64 notes (REC) and play them back (PLAY).",
ft7t: "Arpeggiator", ft7d: "One tap turns it on and off, holding it enables HOLD.",
ft8t: "Web editor", ft8d: "Edit sounds and presets in the browser, connected to the FM-1 over USB-MIDI.",
ft9t: "Online emulator", ft9d: "Try the FMini-1 in your browser, with nothing to install.",
h_install: "Install", l_install: "The installer runs right here, in the browser, and writes the firmware to the FM-1 over the USB cable.",
ft9t: "Online emulators", ft9d: "Try the FMini-1 in your browser, on the FM-1 or the SMK-37, with nothing to install.",
h_install: "Install", l_install: "The installer runs right here, in the browser: it recognises whether the device is an FM-1 or an SMK-37 and writes the right firmware over the USB cable.",
h_smk: "On the SMK-37 too", l_smk: "The same FMini-1, the same screen and the same 200 presets on M-Vave's 37-key keyboard, with everything it adds: pads, faders, eight knobs and a full MIDI OUT.",
k1t: "37 keys with velocity", k1d: "Three whole octaves, with OCTAVE− and OCTAVE+. In PRESET SETTINGS, VELOCITY SENS. turns each preset's dynamics on or off.",
k2t: "16 pads", k2d: "They pick the presets of the current page (the chosen one lit) and, in the sequencer, show the 64 steps in four coloured windows.",
k3t: "4 faders, 4 banks", k3d: "FADER BANK switches between A.ENV, F.ENV, MIX and the screen's knobs, with a note on the screen at each change.",
k4t: "8 knobs, 4 banks", k4d: "K1 is the volume, K2 to K4 change presets and navigate, and K5 to K8 set FILTER, LFO, FX or the screen's knobs (KNOB BANK).",
k5t: "Full MIDI OUT", k5d: "Keys, pads, knobs, faders and the wheels go out over USB and the TRS jack, on their own output channel.",
k6t: "Pro, Elite and MKE-P37", k6d: "A firmware for each model. The installer recognises yours and writes the right one.",
btn_smkemu: "Try the SMK-37 in your browser",
try_fm1: "emulator", try_smk: "emulator",
},
};
for (const l in SITE) Object.assign(TEXT[l], SITE[l]);
const SITE2 = {
pt: { announce: "Firmware gratuito e de código aberto para o M-VAVE FM-1", e_sound: "Som", h_sound: "Três osciladores, um filtro ladder e muito corpo", e_screens: "Telas", h_screens: "Cada página, uma seção do painel",
pt: { announce: "Firmware gratuito e de código aberto para o M-VAVE FM-1 e SMK-37", e_sound: "Som", h_sound: "Três osciladores, um filtro ladder e muito corpo", e_screens: "Telas", h_screens: "Cada página, uma seção do painel",
e_feat: "Features", h_feat: "Tudo o que o FMini-1 faz", e_install: "Instalar", h_install: "Instale direto do navegador" },
en: { announce: "Free, open-source firmware for the M-VAVE FM-1", e_sound: "Sound", h_sound: "Three oscillators, a ladder filter and plenty of body", e_screens: "Screens", h_screens: "Every page, one section of the panel",
en: { announce: "Free, open-source firmware for the M-VAVE FM-1 and SMK-37", e_sound: "Sound", h_sound: "Three oscillators, a ladder filter and plenty of body", e_screens: "Screens", h_screens: "Every page, one section of the panel",
e_feat: "Features", h_feat: "Everything the FMini-1 does", e_install: "Install", h_install: "Install straight from the browser" },
};
for (const l in SITE2) Object.assign(TEXT[l], SITE2[l]);
const SITE3 = {
pt: { hero2_t: "Um clássico dentro do FM-1.", hero2_s: "Firmware gratuito. Instale direto do navegador e volte ao original quando quiser.", hint: "Role" },
en: { hero2_t: "A classic, inside the FM-1.", hero2_s: "Free firmware. Install straight from the browser and go back to the original whenever you like.", hint: "Scroll" },
pt: { hero2_t: "Um clássico dentro do FM-1 e do SMK-37.", hero2_s: "Firmware gratuito. Instale direto do navegador e volte ao original quando quiser.", hint: "Role" },
en: { hero2_t: "A classic, inside the FM-1 and the SMK-37.", hero2_s: "Free firmware. Install straight from the browser and go back to the original whenever you like.", hint: "Scroll" },
};
for (const l in SITE3) Object.assign(TEXT[l], SITE3[l]);
const SITE4 = {
@@ -643,20 +716,25 @@ const nl = (navigator.language || "en").toLowerCase();
let lang = nl.startsWith("pt") ? "pt" : "en";
const LANGS = ["pt", "en"];
const t = (k) => TEXT[lang][k];
let lastKey = null, lastArg = "";
let lastKey = null, lastArg = "", detKey = null; /* (detKey: the device step 1 found, shown again on a language change) */
function applyLang() {
document.documentElement.lang = lang;
document.querySelectorAll("[data-t]").forEach((e) => { e.textContent = t(e.dataset.t); });
$("tipx").textContent = t("tip_x");
$("lang").textContent = lang === "pt" ? "PT" : "EN";
if (lastKey) $("status").textContent = t(lastKey) + lastArg;
if (detKey) showDetected(detKey.label, detKey.ota, detKey.pk);
renderSite();
}
$("tipx").addEventListener("click", () => { $("tip").hidden = true; });
/* "Try in browser": the two emulators, FM-1 and SMK-37 */
$("trybtn").addEventListener("click", (e) => { e.stopPropagation(); const open = $("trymenu").hidden; $("trymenu").hidden = !open; $("trybtn").setAttribute("aria-expanded", String(open)); });
document.addEventListener("click", (e) => { if (!$("trymenu").hidden && !e.target.closest(".trywrap")) { $("trymenu").hidden = true; $("trybtn").setAttribute("aria-expanded", "false"); } });
addEventListener("keydown", (e) => { if (e.key === "Escape") { $("trymenu").hidden = true; $("trybtn").setAttribute("aria-expanded", "false"); } });
$("tip").addEventListener("click", (e) => { if (e.target.id === "tip") $("tip").hidden = true; });
$("lang").addEventListener("click", () => { lang = LANGS[(LANGS.indexOf(lang) + 1) % LANGS.length]; applyLang(); });
applyLang();
const sayK = (k, arg = "") => { lastKey = k; lastArg = arg; $("status").textContent = t(k) + arg; if (k === "done") $("tip").hidden = false; document.body.classList.toggle("bad", ["error","denied","notfound","model","lost","noloader","noreturn","mismatch","badpkg","stopped","loadfail","nomidi","fw_bad"].includes(k)); };
const sayK = (k, arg = "") => { lastKey = k; lastArg = arg; $("status").textContent = t(k) + arg; if (k === "done") $("tip").hidden = false; document.body.classList.toggle("bad", ["error","denied","notfound","model","unknown","lost","noloader","noreturn","mismatch","badpkg","stopped","loadfail","nomidi","fw_bad"].includes(k)); };
const say = (txt) => { lastKey = null; $("status").textContent = txt; };
const log = (t) => { $("log").textContent += t + "\n"; };
const PHASES = ["verify", "loader", "write", "reboot", "done"];
@@ -690,12 +768,20 @@ function writeBar(n) {
}, 100);
}
function stopCrawl() { if (crawl) clearInterval(crawl); crawl = null; }
let image = null;
/* the packages: the FM-1's and the SMK-37's (Pro, Elite, MKE-P37), each for exactly one model (fm1ota.js sameModel) */
const meta = /*META*/;
let product = meta.product; /* the package to install: the site's, or one chosen below */
document.querySelectorAll(".curver").forEach((e) => { e.textContent = "v" + meta.version; });
document.querySelectorAll(".curver-b").forEach((e) => { e.textContent = "(v" + meta.version + ")"; });
{ const dl = document.getElementById("fwdl"); if (dl) { dl.href = meta.pkg; dl.download = "FMini-1-" + meta.version + ".fwsc"; } }
const PKGS = meta.pkgs; /* [{product, label, file, version, pkg}] */
const modelOf = (product) => product.split("_")[0];
const images = {}; /* product -> the logical image */
let picked = null; /* "Install another firmware": {image, product} */
let ready = false;
document.querySelectorAll(".curver").forEach((e) => { e.textContent = "FM-1 v" + meta.version + " · SMK-37 v" + meta.smkVersion; });
document.querySelectorAll(".curver-b").forEach((e) => { e.textContent = ""; });
for (const p of PKGS) {
const li = document.createElement("li"), a = document.createElement("a"), sp = document.createElement("span");
a.href = p.pkg; a.download = p.file; a.textContent = p.label + " · v" + p.version; sp.textContent = p.file;
li.append(a, sp); $("fwlist").appendChild(li);
}
let writing = false;
let wake = null;
@@ -722,28 +808,41 @@ const holdPage = (on) => {
if (holdAudio) { holdAudio.close().catch(() => {}); holdAudio = null; }
}
};
const lockInstaller = (on) => { keepAwake(on); holdPage(on); writing = on; $("go").disabled = on || !image; };
const lockInstaller = (on) => { keepAwake(on); holdPage(on); writing = on; $("go").disabled = on || !ready; };
document.addEventListener("visibilitychange", () => { if (!document.hidden && writing) keepAwake(true); });
window.addEventListener("beforeunload", (e) => { if (writing) { e.preventDefault(); e.returnValue = t("leave"); } });
(async () => {
if (!navigator.requestMIDIAccess) { sayK("nomidi"); return; }
try {
const r = await fetch(meta.pkg);
if (!r.ok) throw new Error(`${meta.pkg}: HTTP ${r.status}`);
const pkg = new Uint8Array(await r.arrayBuffer());
if (productOf(pkg) !== product) { sayK("badpkg"); return; }
image = logicalImage(pkg);
for (const p of PKGS) {
const r = await fetch(p.pkg);
if (!r.ok) throw new Error(`${p.file}: HTTP ${r.status}`);
const pkg = new Uint8Array(await r.arrayBuffer());
if (productOf(pkg) !== p.product) { sayK("badpkg"); return; }
images[p.product] = logicalImage(pkg);
}
ready = true;
say(t("ready"));
$("go").disabled = false;
setBar(0, null);
} catch (e) { sayK("loadfail", e.message); }
})();
async function runInstall(portName) {
/* step 1 done: which device, and what goes on it */
function showDetected(label, ota, pk) {
detKey = { label, ota, pk };
const box = $("detected");
box.innerHTML = "";
const b = document.createElement("b"); b.textContent = label;
box.append(t("det"), b, (ota ? t("det_ota") : "") + (pk ? t("det_fw") + "v" + pk.version : ""));
box.hidden = false;
}
async function runInstall(portName, chosen) {
if (writing) return;
if ($("portpick").open) $("portpick").close();
lockInstaller(true);
$("detected").hidden = true; detKey = null;
let midi;
try { midi = await navigator.requestMIDIAccess({ sysex: true }); }
catch (e) { sayK("denied"); lockInstaller(false); return; }
@@ -761,13 +860,18 @@ async function runInstall(portName) {
if (k === "reboot") { stopCrawl(); sayK("reboot"); setBar(100, "reboot"); }
if (k === "done") { stopCrawl(); setBar(100, "done"); sayK("done"); }
};
const ota = await up.find((id) => /^ota-/i.test(id.model));
if (ota) {
ota.link.close();
sayK((await up.resume(image, step, product)) ? "done" : "stopped");
} else {
await up.install(image, product, step);
}
/* which device is it: its identity (the running firmware's, or the update loader's) */
const dev = await up.find(() => true);
if (!dev && !portName) { sayK("notfound"); offerPorts(midi); lockInstaller(false); return; }
const ota = !!dev && /^ota-/i.test(dev.id.model);
const model = dev ? dev.id.model.replace(/^ota-/i, "") : chosen;
if (dev) dev.link.close();
const pk = picked ? { product: picked.product, version: picked.version || "?", label: modelOf(picked.product) } : PKGS.find((p) => modelOf(p.product) === model);
if (!pk) { sayK("unknown", dev ? dev.id.text : String(model)); lockInstaller(false); return; }
showDetected(dev ? model : chosen, ota, pk);
const image = picked ? picked.image : images[pk.product];
if (ota) sayK((await up.resume(image, step, pk.product)) ? "done" : "stopped");
else await up.install(image, pk.product, step);
} catch (e) {
if (e && e.code && TEXT[lang][e.code]) sayK(e.code, e.detail || "");
else sayK("error", e && e.message);
@@ -776,7 +880,8 @@ async function runInstall(portName) {
}
lockInstaller(false);
}
// not found by name (another custom firmware may name its USB device differently): the player picks the MIDI port
// not found by name (another custom firmware may name its USB device differently): the player picks the MIDI port and
// the device
function offerPorts(midi) {
const names = [...new Set([...midi.inputs.values()].filter((i) => i.state !== "disconnected").map((i) => i.name).filter(Boolean))];
const sel = $("portsel");
@@ -785,9 +890,13 @@ function offerPorts(midi) {
sel.selectedIndex = 0;
if (names.length && $("portpick").showModal) $("portpick").showModal();
}
$("portgo").addEventListener("click", () => { const n = $("portsel").value; $("portpick").close(); if (n) runInstall(n); });
$("portgo").addEventListener("click", () => {
const n = $("portsel").value, d = (document.querySelector('#devsel input:checked') || {}).value || "FM-1";
$("portpick").close();
if (n) runInstall(n, d);
});
$("portno").addEventListener("click", () => $("portpick").close());
$("go").addEventListener("click", () => runInstall(null));
$("go").addEventListener("click", () => runInstall(null, null));
const hasMarker = (b) => { const m = "FELUCCA-LOADER-1"; for (let i = 0; i + m.length <= b.length; i++) { let k = 0; while (k < m.length && b[i + k] === m.charCodeAt(k)) k++; if (k === m.length) return true; } return false; };
$("fwpick").addEventListener("click", () => $("fwfile").click());
$("fwfile").addEventListener("change", async (e) => {
@@ -797,63 +906,93 @@ $("fwfile").addEventListener("change", async (e) => {
try {
const pkg = new Uint8Array(await file.arrayBuffer());
const prod = productOf(pkg);
if (!/^FM-1_9\d\d$/.test(prod) || !hasMarker(pkg)) { sayK("fw_bad"); $("go").disabled = true; image = null; return; }
image = logicalImage(pkg);
product = prod;
if (!/^(FM-1|SMK-37 Pro|SMK-37 Elite|MKE-P37)_9\d\d$/.test(prod) || !hasMarker(pkg)) { sayK("fw_bad"); picked = null; return; }
picked = { image: logicalImage(pkg), product: prod, version: (file.name.match(/(\d+\.\d+\.\d+)/) || [])[1] };
say(`${file.name} (${prod})`);
$("go").disabled = false;
$("go").disabled = !ready;
setBar(0, null);
} catch (_) { sayK("fw_bad"); $("go").disabled = true; image = null; }
} catch (_) { sayK("fw_bad"); picked = null; }
});
/* ---- hero: the Minimoog goes into the FM-1's screen as the page scrolls (reduced motion: the finished picture) ---- */
/* ---- hero: the Minimoog splits in two as the page scrolls: one dives into the FM-1's screen, the other into the
* SMK-37's; the two keyboards then show the real screens, each its own page (reduced motion: the finished picture) ---- */
(() => {
const hero = $("top"), stage = $("stage"), mm = $("mm"), fm = $("fm"), lcd = $("lcd"), copy1 = $("copy1"), copy2 = $("copy2"), hint = $("hint");
const A = $("lcd-a"), B = $("lcd-b");
const hero = $("top"), stage = $("stage"), mm = $("mm"), mm2 = $("mm2"), fm = $("fm"), smk = $("smkfig"), lcd = $("lcd"), lcd2 = $("lcd2");
const copy1 = $("copy1"), copy2 = $("copy2"), hint = $("hint");
const A = $("lcd-a"), B = $("lcd-b"), A2 = $("lcd2-a"), B2 = $("lcd2-b");
$("fm-body").src = IMG.fm1;
$("smk-body").src = IMG.smk37;
mm2.src = mm.src;
const ROT = ["splash", "ctrl", "osc", "mix", "filt", "fenv", "aenv", "fx"];
const rm = matchMedia("(prefers-reduced-motion: reduce)").matches;
if (rm) document.body.classList.add("rm");
A.src = IMG.splash; A.style.opacity = 1; B.style.opacity = 0;
A2.src = IMG.splash; A2.style.opacity = 1; B2.style.opacity = 0;
const clamp = (x, a = 0, b = 1) => Math.max(a, Math.min(b, x));
const ease = (x) => x * x * (3 - 2 * x);
let prog = 0, W = 0, H = 0, fmW = 0, fmH = 0, fmX = 0, fmY = 0, mmW0 = 0, mmX0 = 0, mmY0 = 0, p = -1, rot = 0, rotAt = 0;
const MR = 452 / 900, FR = 512 / 859;
/* the two pictures: the FM-1 (859 x 512) and the SMK-37 (1872 x 827); where each screen is in its picture */
const MR = 452 / 900, FR = 512 / 859, SR = 827 / 1872;
const FL = [0.3073, 0.1523, 0.1676, 0.283], SL = [0.13702, 0.11423, 0.17107, 0.38713];
let prog = 0, W = 0, H = 0, mob = false, p = -1, rot = 0, rotAt = 0;
let fmW = 0, fmH = 0, fmX = 0, fmY = 0, smW = 0, smH = 0, smX = 0, smY = 0, mmW0 = 0, mmX0 = 0, mmY0 = 0;
function layout() {
W = stage.clientWidth; H = stage.clientHeight;
const mob = W < 820;
const c2h = copy2.offsetHeight || 200, gap = mob ? 22 : 30;
fmY = mob ? H * 0.2 : Math.max(18, H * 0.05);
fmW = Math.min(W * (mob ? 0.94 : 0.86), 980, (H * (mob ? 0.5 : 0.62)) / FR, (H - fmY - c2h - gap - 28) / FR);
fmH = fmW * FR; fmX = (W - fmW) / 2;
mob = W < 820;
const c2h = copy2.offsetHeight || 200, gap = mob ? 18 : 30;
if (mob) { /* a phone: the FM-1 above, the SMK-37 below */
fmY = Math.max(12, H * 0.07);
fmW = W * 0.8; smW = W * 0.96;
const room = H - fmY - c2h - gap - 28, need = fmW * FR + 14 + smW * SR;
if (need > room) { const k = room / need; fmW *= k; smW *= k; }
fmH = fmW * FR; smH = smW * SR;
fmX = (W - fmW) / 2; smX = (W - smW) / 2; smY = fmY + fmH + 14;
copy2.style.top = smY + smH + gap + "px";
} else { /* side by side, the SMK-37 a little wider */
fmY = Math.max(18, H * 0.06);
const gx = Math.max(24, W * 0.03), tot = Math.min(W * 0.94, 1560);
fmW = Math.min((tot - gx) / 2.3, (H * 0.6) / FR, (H - fmY - c2h - gap - 28) / FR);
smW = fmW * 1.3;
fmH = fmW * FR; smH = smW * SR;
fmX = (W - fmW - gx - smW) / 2; smX = fmX + fmW + gx;
smY = fmY + (fmH - smH) / 2;
copy2.style.top = fmY + fmH + gap + "px";
}
fm.style.width = fmW + "px"; fm.style.left = fmX + "px"; fm.style.top = fmY + "px";
copy2.style.top = fmY + fmH + gap + "px";
smk.style.width = smW + "px"; smk.style.left = smX + "px"; smk.style.top = smY + "px";
mmW0 = mob ? W * 1.5 : Math.min(W * 0.98, 1500);
mmX0 = mob ? -W * 0.2 : Math.max(W * 0.5, W - 1.0 * mmW0 * 0.62);
mmY0 = mob ? H * 0.52 : (H - mmW0 * MR) / 2;
p = -1; draw(prog);
}
/* a Minimoog picture from where it starts to the screen of a figure (x, y, w its box; L the screen in it; sc its scale) */
function fly(img, q, x, y, w, h, L, sc, fade) {
const cx = x + w * (L[0] + L[2] / 2), cy = y + h * (L[1] + L[3] / 2);
const tw = w * L[2] * sc * 1.02;
const ex = x + w / 2 + (cx - x - w / 2) * sc, ey = y + h / 2 + (cy - y - h / 2) * sc;
const ww = mmW0 + (tw - mmW0) * q, hh = ww * MR;
const sx = mmX0 + mmW0 / 2, sy = mmY0 + mmW0 * MR / 2;
const mx = sx + (ex - sx) * q, my = sy + (ey - sy) * q;
img.style.width = ww + "px"; img.style.left = mx - ww / 2 + "px"; img.style.top = my - hh / 2 + "px";
img.style.opacity = fade;
}
function draw(np) {
if (np === undefined) np = p < 0 ? prog : p;
if (Math.abs(np - p) < 0.0004) return;
p = np;
const q = ease(clamp((p - 0.08) / 0.72));
const mob = W < 820;
const sc = 0.9 + 0.1 * q;
/* the SMK-37's half leaves a moment later and lands a moment later: the split shows */
const q2 = ease(clamp((p - 0.16) / 0.66));
const sc = 0.9 + 0.1 * q, sc2 = 0.9 + 0.1 * q2;
fm.style.opacity = clamp(q / 0.35);
fm.style.transform = "scale(" + sc + ")";
/* where the screen is now, in the stage */
const cx = fmX + fmW * (0.3073 + 0.0838), cy = fmY + fmH * (0.1523 + 0.1415);
const tw = fmW * 0.1676 * sc * 1.02;
const ex = fmX + fmW / 2 + (cx - fmX - fmW / 2) * sc, ey = fmY + fmH / 2 + (cy - fmY - fmH / 2) * sc;
const w = mmW0 + (tw - mmW0) * q, h = w * MR;
const sx = mmX0 + mmW0 / 2, sy = mmY0 + mmW0 * MR / 2;
const mx = sx + (ex - sx) * q, my = sy + (ey - sy) * q;
mm.style.width = w + "px"; mm.style.left = mx - w / 2 + "px"; mm.style.top = my - h / 2 + "px";
mm.style.opacity = 1 - clamp((q - 0.88) / 0.12);
lcd.style.opacity = 1;
smk.style.opacity = clamp(q2 / 0.35);
smk.style.transform = "scale(" + sc2 + ")";
fly(mm, q, fmX, fmY, fmW, fmH, FL, sc, 1 - clamp((q - 0.88) / 0.12));
fly(mm2, q2, smX, smY, smW, smH, SL, sc2, 1 - clamp((q2 - 0.88) / 0.12));
lcd.style.opacity = 1; lcd2.style.opacity = 1;
$("scr").style.opacity = clamp((p - 0.9) / 0.1);
$("scr2").style.opacity = clamp((p - 0.92) / 0.08);
copy1.style.opacity = 1 - clamp((p - 0.04) / 0.16);
copy1.style.transform = (mob ? "" : "translateY(-50%) ") + "translateX(" + (-clamp(p / 0.2) * 40) + "px)";
copy1.style.pointerEvents = p > 0.12 ? "none" : "";
@@ -862,13 +1001,15 @@ $("fwfile").addEventListener("change", async (e) => {
hint.style.opacity = 1 - clamp(p / 0.05);
}
/* the first scroll down plays the film by itself; scrolling up at the top plays it backwards */
const DUR = 1400;
const DUR = 1600;
if (rm) prog = 1;
let state = rm ? 2 : 0, t0 = 0, dir = 1; /* 0 start picture, 1 playing forward, 2 finished, 3 playing backwards */
const hold = (e) => { if (state === 1 || state === 3) e.preventDefault(); };
function done() {
prog = 1; state = 2; draw(1);
A.src = IMG.splash; A.style.opacity = 1; B.style.opacity = 0; rot = 0; rotAt = performance.now();
A.src = IMG.splash; A.style.opacity = 1; B.style.opacity = 0;
A2.src = IMG.splash; A2.style.opacity = 1; B2.style.opacity = 0;
rot = 0; rotAt = performance.now();
}
function home() { prog = 0; state = 0; draw(0); }
function frame(now) {
@@ -900,13 +1041,20 @@ $("fwfile").addEventListener("change", async (e) => {
document.querySelectorAll('a[href^="#"]').forEach((a) => a.addEventListener("click", () => { if (state !== 2) done(); }));
addEventListener("resize", layout);
if ((!rm && location.hash.length > 1) || scrollY > 40) { state = 2; prog = 1; } /* a reload further down, or a link to a section: the finished picture */
/* the finished FM-1 shows the real screens, one after the other */
function show(i) {
const on = A.style.opacity === "1" ? A : B, off = on === A ? B : A;
off.src = IMG[ROT[i]]; off.style.opacity = 1; on.style.opacity = 0;
/* the finished keyboards show the real screens, one after the other, the SMK-37 four pages ahead of the FM-1 */
function show(a, b, src) {
const on = a.style.opacity === "1" ? a : b, off = on === a ? b : a;
off.src = src; off.style.opacity = 1; on.style.opacity = 0;
}
const next = () => { rot = rot + 1 >= ROT.length ? 1 : rot + 1; show(rot); rotAt = performance.now(); };
const N = ROT.length - 1;
const next = () => {
rot = rot + 1 > N ? 1 : rot + 1;
show(A, B, IMG[ROT[rot]]);
show(A2, B2, IMG[ROT[1 + (rot - 1 + 4) % N]]);
rotAt = performance.now();
};
lcd.addEventListener("click", next);
lcd2.addEventListener("click", next);
if (!rm) setInterval(() => { if (state === 2 && performance.now() - rotAt >= 1000) next(); }, 100);
layout();
})();