Files
skiff/web/emu/index.html
T
illuminus5 c4bb2b4e90 Skiff 1.3.2: a stereo HALL reverb, Skiff in your browser, update mode on the screen and a finer vibrato
- HALL is Felucca's stereo HALL now: eight lines that feed each other, with their own left and right (#19).
- Try Skiff in your browser at https://illuminus5.github.io/skiff/try/: the firmware compiled to WebAssembly on a
  drawn FM-1 (#18).
- The update loader shows UPDATE MODE and the way out, WRITING with a bar, and UPDATE FAILED; the README's
  "If the FM-1 does not start" begins with update mode.
- LFO DEST PITCH's depth is squared: +1 % was already a 19-cent vibrato; now the low end is fine and the vibrato
  smooth. The factory sounds with a vibrato are retuned to sound as before.
- MENU's STEP PREVIEW and SCREEN OFF show a new value at once; the README's sound-type counts add up again.
2026-10-18 09:56:44 -05:00

418 lines
21 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<!-- SPDX-License-Identifier: GPL-3.0-only
Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
The page follows X0X's browser page, web/emu/index.html of charlesvestal/fm1-x0x (GPL-3.0), a Felucca fork. -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Try Skiff</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%23111%22/%3E%3Crect x=%223%22 y=%229%22 width=%223%22 height=%224%22 fill=%22%23ff5a36%22/%3E%3Crect x=%227%22 y=%226%22 width=%223%22 height=%227%22 fill=%22%2322c3b4%22/%3E%3Crect x=%2211%22 y=%223%22 width=%223%22 height=%2210%22 fill=%22%23ffbf00%22/%3E%3C/svg%3E">
<meta name="description" content="Skiff, the six-track groovebox firmware for the M-VAVE FM-1, running in your browser: the same code the unit runs.">
<style>
/* DotGothic16 (SIL OFL 1.1, fonts/OFL.txt), cut to printable ASCII, for the knob labels */
@font-face { font-family: "DotGothic16"; src: url("fonts/DotGothic16-subset.woff") format("woff"); font-display: swap; }
:root { --bg: #8e8e93; --fg: #111; --dim: #2c2c2e; --rule: #5a5a5e;
--body: #1d1d1f; --tray: #141415; --part: #2a2a2d; --edge: #3a3a3e; --label: #d6d6d8;
--lit: #fff4d6; --green: #5fe08a; color-scheme: light; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--fg); font: 13px/1.6 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 32px; }
@media (orientation: portrait) and (max-width: 700px) { main { padding: 8px 8px 24px; } }
a { color: inherit; }
.device { position: relative; width: 100%; aspect-ratio: 1000 / 624; user-select: none; -webkit-user-select: none;
-webkit-touch-callout: none; touch-action: manipulation; }
.device svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.device canvas { position: absolute; image-rendering: crisp-edges; image-rendering: pixelated; background: #000; }
.hit { position: absolute; touch-action: none; cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: 10px; }
.hit.knob { cursor: ns-resize; border-radius: 50%; }
.hit:focus-visible { outline: 2px solid var(--lit); outline-offset: 2px; }
.face { transition: fill .05s; }
.dim .face.btn { fill: #3a3934; }
.lit .face.btn { fill: var(--lit); }
.lit text { fill: #1d1d1f; }
.green .face.btn { fill: var(--green); }
.green text { fill: #0d2414; }
.face.key { fill: #0c0c0d; stroke: var(--edge); stroke-width: 1.5; }
.slit { fill: #3a3a3c; transition: fill .05s; }
.dim .slit { fill: #77777b; }
.lit .slit { fill: #ececee; filter: drop-shadow(0 0 3px rgba(255, 255, 255, .6)); }
/* #119: what can be pressed breathes, dark .. ~60 % of lit and back (hal/fm1_input.h fm1_led_breath, ~1.1 s; MENU >
* LEDS DIM LO ~30 %): the peaks between dark and lit at ~0.8 / ~0.58 on screen (the LED's share, gamma-encoded) */
@keyframes breath-btn { 0%, 100% { fill: #3a3934; } 50% { fill: #d8cfb6; } }
@keyframes breath-slit { 0%, 100% { fill: #3a3a3c; } 50% { fill: #c8c8ca; } }
@keyframes breath-btn-lo { 0%, 100% { fill: #3a3934; } 50% { fill: #aca592; } }
@keyframes breath-slit-lo { 0%, 100% { fill: #3a3a3c; } 50% { fill: #a1a1a3; } }
.breath .face.btn { animation: breath-btn 1.13s ease-in-out infinite; }
.breath .slit { animation: breath-slit 1.13s ease-in-out infinite; }
.dimlo .breath .face.btn { animation-name: breath-btn-lo; }
.dimlo .breath .slit { animation-name: breath-slit-lo; }
@media (prefers-reduced-motion: reduce) {
.breath .face.btn, .breath .slit { animation: none; }
.breath .face.btn { fill: #aca592; }
.breath .slit { fill: #a1a1a3; }
}
/* the DRUM grid's beats (hal/fm1_input.h fm1_led_mid): a steady level between the glow and lit, ~15 % (DIM LO ~10 %) */
.mid .slit { fill: #9a9a9e; }
.dimlo .mid .slit { fill: #8a8a8e; }
.held .face { stroke: var(--lit); stroke-width: 3; }
.latched .face { stroke: #79b8ff; stroke-width: 3; }
.start { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
background: rgba(0, 0, 0, .5); border-radius: 4% / 6%; }
.start[hidden] { display: none; }
.start button { font: inherit; font-size: 18px; padding: 12px 28px; background: #fff; color: #000; border: 0; cursor: pointer; }
.start button:disabled { opacity: .4; cursor: progress; }
.start p { margin: 0; max-width: 32em; text-align: center; color: #fff; }
.keys, footer { margin: 16px 0 0; color: var(--dim); text-align: center; }
.keys span { white-space: nowrap; margin: 0 8px; }
kbd { font: 600 11px ui-monospace, Menlo, monospace; border: 1px solid var(--rule); padding: 0 4px; color: var(--fg); }
footer { margin-top: 12px; font-size: 12px; }
footer nav a { margin: 0 6px; }
footer small { font-size: 11px; opacity: .8; }
</style>
</head>
<body>
<main>
<div class="device" id="device">
<svg id="panel" viewBox="0 0 1000 624" aria-hidden="true"></svg>
<canvas id="screen" width="240" height="240" role="img" aria-label="The screen"></canvas>
<div class="start" id="start"><button id="go" type="button">Switch on</button><p id="status" hidden></p></div>
</div>
<p class="keys">
<span><kbd>Z</kbd>–<kbd>'</kbd> <kbd>Q</kbd>–<kbd>O</kbd> keys</span>
<span><kbd>1</kbd>–<kbd>=</kbd> FX … REC</span>
<span><kbd>[</kbd> <kbd>]</kbd> OCT</span>
<span><kbd>↑</kbd> <kbd>↓</kbd> SELECT</span>
<span><kbd>←</kbd> <kbd>→</kbd> ALGORITHM</span>
<span><kbd>Shift</kbd>-click holds a button</span>
</p>
<footer>
<small class="version">@VERSION@@PREVIEW@</small><br>
Skiff by illuminus5, built on Felucca by Leo Kuroshita, Hügelton Instruments · <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPL-3.0</a> · browser build after charlesvestal's <a href="https://github.com/charlesvestal/fm1-x0x">X0X</a> · DotGothic16 font, <a href="fonts/OFL.txt">SIL OFL 1.1</a><br>
Saves stay in this browser. Not here: USB (the editor, MIDI out, audio), the TRS MIDI jack.<br>
<nav><a href="../webapp/installer/">Install</a><a href="../webapp/editor/">Editor</a><a href="../learn/">Learn</a><a href="https://github.com/illuminus5/skiff">Source</a></nav>
<small>M-VAVE and FM-1 are trademarks of their respective owners. Skiff is not affiliated with or endorsed by them.</small>
</footer>
</main>
<script src="../panel.js"></script>
<script type="module">
// the panel's controls and its drawing: ../panel.js (window.PANEL, shared with the Learn page)
const { B, EN, PLAY_GREEN, WHITE, ROW1, ROW2, KNOBS } = window.PANEL;
const STORE = "skiff-emu-flash";
// ------------------------------------------------------------------ the panel
// Two drawings of the same controls (PANEL.draw): WIDE after the FM-1's own layout, TALL for a phone held upright.
// Rebuilt when the orientation changes; the state stays.
const svg = document.getElementById("panel"), device = document.getElementById("device"), canvas = document.getElementById("screen");
const SANS = "-apple-system, 'Helvetica Neue', Arial, sans-serif", DOT = "'DotGothic16', " + SANS;
let node = null, btnMask = 0, keyMask = 0, latched = 0, masterValue = 700, lastLeds = [0, 0, 0, 0, 0], layout = null;
const angle = Object.fromEntries(KNOBS.map((n) => [n, 0]));
angle.MASTER = -135 + 270 * masterValue / 1023;
const knobs = [], buttons = [], keys = [];
const btnBy = new Map(), keyBy = new Map(); // pointer / key code -> label bit or key
const send = (m) => { if (node) node.port.postMessage(m); };
function build(name) {
layout = name;
for (const d of device.querySelectorAll(".hit")) d.remove();
const P = window.PANEL.draw(svg, name, { knobFont: DOT }), L = P.L;
device.style.aspectRatio = `${L.w} / ${L.h}`;
const [sx, sy, ss] = P.screen; // the 240 x 240 panel inside its bezel
Object.assign(canvas.style, { left: `${sx / L.w * 100}%`, top: `${sy / L.h * 100}%`,
width: `${ss / L.w * 100}%`, height: `${ss / L.h * 100}%` });
knobs.length = buttons.length = keys.length = 0;
knobs.push(...P.knobs);
buttons.push(...P.buttons);
P.keys.forEach((k, i) => { keys[i] = k; });
// HTML targets over the drawing (pointer-events: none): touch-action and pointer capture work on them everywhere
const hit = (c, cls, role) => {
const b = c.g.getBBox(), d = document.createElement("div");
d.className = "hit" + (cls ? " " + cls : "");
Object.assign(d.style, { left: `${b.x / L.w * 100}%`, top: `${b.y / L.h * 100}%`,
width: `${b.width / L.w * 100}%`, height: `${b.height / L.h * 100}%` });
d.setAttribute("role", role);
d.setAttribute("aria-label", c.name);
d.title = c.name;
d.tabIndex = 0;
d.addEventListener("touchstart", (e) => e.preventDefault(), { passive: false });
d.addEventListener("contextmenu", (e) => e.preventDefault());
device.insertBefore(d, document.getElementById("start"));
c.hit = d;
};
knobs.forEach((k) => { hit(k, "knob", "slider"); bindKnob(k); drawKnob(k); });
buttons.forEach((b) => { hit(b, "", "button"); bindButton(b); });
keys.forEach((k, i) => { hit(k, "", "button"); bindKey(k, i); });
syncButtons(true);
syncKeys(true);
drawLights(lastLeds);
}
// ------------------------------------------------------------------ input
function syncButtons(redraw) {
let m = latched;
for (const b of btnBy.values()) m |= 1 << b;
if (m !== btnMask) { btnMask = m; send({ type: "buttons", mask: m }); }
else if (!redraw) return;
for (const b of buttons) {
const on = !!(m & (1 << b.bit));
b.g.classList.toggle("held", on);
b.g.classList.toggle("latched", !!(latched & (1 << b.bit)));
b.hit.setAttribute("aria-pressed", on);
}
}
function syncKeys(redraw) {
let m = 0;
for (const k of keyBy.values()) m |= 1 << k;
if (m !== keyMask) { keyMask = m; send({ type: "keys", mask: m }); }
else if (!redraw) return;
keys.forEach((k, i) => k.g.classList.toggle("held", !!(m & (1 << i))));
}
function bindButton(b) {
b.hit.addEventListener("pointerdown", (e) => {
e.preventDefault();
if (e.shiftKey || e.button === 2) { latched ^= 1 << b.bit; syncButtons(true); return; }
if (latched & (1 << b.bit)) { latched &= ~(1 << b.bit); syncButtons(true); return; }
b.hit.setPointerCapture(e.pointerId);
btnBy.set("p" + e.pointerId, b.bit);
syncButtons();
});
b.hit.addEventListener("keydown", (e) => {
if ((e.key === "Enter" || e.key === " ") && !e.repeat) { btnBy.set("f" + b.bit, b.bit); syncButtons(); e.preventDefault(); e.stopPropagation(); }
});
b.hit.addEventListener("keyup", () => { if (btnBy.delete("f" + b.bit)) syncButtons(); });
}
function bindKey(k, i) {
k.hit.addEventListener("pointerdown", (e) => {
e.preventDefault();
k.hit.setPointerCapture(e.pointerId);
keyBy.set("p" + e.pointerId, i);
syncKeys();
});
}
function release(e) {
const id = "p" + e.pointerId;
if (btnBy.delete(id)) syncButtons();
if (keyBy.delete(id)) syncKeys();
}
for (const t of ["pointerup", "pointercancel", "lostpointercapture"]) device.addEventListener(t, release);
function drawKnob(k) { if (k.ind) k.ind.setAttribute("transform", `rotate(${angle[k.name]} ${k.x} ${k.y})`); }
function turn(k, n) {
if (!n) return;
if (k.role === "master") {
masterValue = Math.max(0, Math.min(1023, masterValue + n * 16));
angle.MASTER = -135 + 270 * masterValue / 1023;
send({ type: "master", value: masterValue });
} else {
angle[k.name] = (angle[k.name] + n * 18) % 360; // 20 detents a turn
send({ type: "enc", role: k.role, n });
}
drawKnob(k);
}
function bindKnob(k) {
let drag = null, wheel = 0;
k.hit.addEventListener("pointerdown", (e) => {
e.preventDefault();
k.hit.setPointerCapture(e.pointerId);
drag = { y: e.clientY, acc: 0 };
});
k.hit.addEventListener("pointermove", (e) => {
if (!drag) return;
drag.acc += drag.y - e.clientY;
drag.y = e.clientY;
const step = k.role === "master" ? 3 : 8, n = Math.trunc(drag.acc / step);
if (n) { drag.acc -= n * step; turn(k, n); }
});
const end = () => { drag = null; };
k.hit.addEventListener("pointerup", end);
k.hit.addEventListener("pointercancel", end);
k.hit.addEventListener("wheel", (e) => {
e.preventDefault();
const dy = e.deltaMode === 1 ? e.deltaY * 33 : e.deltaY;
if (Math.abs(dy) >= 50) { turn(k, dy < 0 ? 1 : -1); wheel = 0; return; } // a wheel notch: one detent
wheel -= dy; // a trackpad: by distance
const n = Math.trunc(wheel / 25);
if (n) { wheel -= n * 25; turn(k, n); }
}, { passive: false });
k.hit.addEventListener("keydown", (e) => {
const d = { ArrowUp: 1, ArrowRight: 1, ArrowDown: -1, ArrowLeft: -1 }[e.key];
if (d) { turn(k, d); e.preventDefault(); e.stopPropagation(); }
});
}
const tall = matchMedia("(orientation: portrait) and (max-width: 700px)");
build(tall.matches ? "tall" : "wide");
tall.addEventListener("change", () => build(tall.matches ? "tall" : "wide"));
document.fonts?.load("16px DotGothic16").then(() => build(layout), () => {}); // the labels' width: the hit areas
// the computer keyboard, every key one control: F3..A#4 on the Z (white) and A (black) rows, B4..G5 on Q..O
// in semitones, the twelve buttons on the number row in the panel's order (held while the key is), [ ] OCT
const KEYMAP = {};
["KeyZ", "KeyX", "KeyC", "KeyV", "KeyB", "KeyN", "KeyM", "Comma", "Period", "Slash"].forEach((c, i) => KEYMAP[c] = { key: WHITE[i] });
[["KeyS", 1], ["KeyD", 3], ["KeyF", 5], ["KeyH", 8], ["KeyJ", 10], ["KeyL", 13], ["Semicolon", 15], ["Quote", 17]].forEach(([c, k]) => KEYMAP[c] = { key: k });
["KeyQ", "KeyW", "KeyE", "KeyR", "KeyT", "KeyY", "KeyU", "KeyI", "KeyO"].forEach((c, i) => KEYMAP[c] = { key: 18 + i });
["Digit1", "Digit2", "Digit3", "Digit4", "Digit5", "Digit6", "Digit7", "Digit8", "Digit9", "Digit0", "Minus", "Equal"]
.forEach((c, i) => KEYMAP[c] = { btn: B[[...ROW1, ...ROW2][i]] });
Object.assign(KEYMAP, { BracketLeft: { btn: B["OCT-"] }, BracketRight: { btn: B["OCT+"] } });
const ARROWS = { ArrowUp: [EN.SELECT, 1], ArrowDown: [EN.SELECT, -1], ArrowRight: [EN.ALGORITHM, 1], ArrowLeft: [EN.ALGORITHM, -1] };
addEventListener("keydown", (e) => {
if (!node || e.metaKey || e.ctrlKey || e.altKey || e.target.closest?.(".hit.knob")) return;
if (ARROWS[e.code]) { const [r, n] = ARROWS[e.code]; turn(knobs.find((k) => k.role === r), n); e.preventDefault(); return; }
const m = KEYMAP[e.code];
if (!m) return;
e.preventDefault();
if (e.repeat) return;
if (m.key !== undefined) { keyBy.set("k" + e.code, m.key); syncKeys(); }
else { btnBy.set("k" + e.code, m.btn); syncButtons(); }
});
addEventListener("keyup", (e) => {
const id = "k" + e.code;
if (keyBy.delete(id)) syncKeys();
if (btnBy.delete(id)) syncButtons();
});
addEventListener("blur", () => {
for (const id of [...btnBy.keys()]) if (id[0] !== "p") btnBy.delete(id);
for (const id of [...keyBy.keys()]) if (id[0] !== "p") keyBy.delete(id);
syncButtons();
syncKeys();
});
// ------------------------------------------------------------------ screen and lights
const ctx = document.getElementById("screen").getContext("2d");
const img = ctx.createImageData(240, 240);
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; // the panel's byte order -> RGB565
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);
}
// the power-on sweep (hal/fm1_led_anim.h): a level per LED, lit frames /64 (| 128: the glow under them), drawn as the
// LED's share of lit between its dark (or glowing) colour and the lit one, mixed in linear light
const lin = (h) => [1, 3, 5].map((i) => (parseInt(h.slice(i, i + 2), 16) / 255) ** 2.2);
const ANIM = { btn: [lin("#3a3934"), lin("#3a3934"), lin("#fff4d6")], slit: [lin("#3a3a3c"), lin("#77777b"), lin("#ececee")] };
function animFill(kind, q) {
const [dark, glow, lit] = ANIM[kind], s = Math.min(q & 127, 64) / 64, base = q & 128 ? glow : dark;
const c = base.map((v, i) => Math.round(255 * (v + (lit[i] - v) * s) ** (1 / 2.2)));
return `rgb(${c.join(",")})`;
}
function drawAnim(anim) {
for (const b of buttons) b.g.querySelector(".face").style.fill = anim ? animFill("btn", anim[b.bit]) : "";
keys.forEach((k, i) => { k.g.querySelector(".slit").style.fill = anim ? animFill("slit", anim[14 + i]) : ""; });
}
function drawLights([litB, litK, dimB, dimK, dimLo = 0, brB = 0, brK = 0, midK = 0], anim = null) {
drawAnim(anim);
document.documentElement.classList.toggle("dimlo", !!dimLo); // (the breath's lower peak)
for (const b of buttons) {
const bit = 1 << b.bit, green = b.bit === B.PLAY && (litB & (1 << PLAY_GREEN));
b.g.classList.toggle("lit", !!(litB & bit) && !green);
b.g.classList.toggle("green", !!green);
b.g.classList.toggle("dim", !!(dimB & bit));
b.g.classList.toggle("breath", !!(brB & bit));
}
keys.forEach((k, i) => {
k.g.classList.toggle("lit", !!(litK & (1 << i)));
k.g.classList.toggle("dim", !!(dimK & (1 << i)));
k.g.classList.toggle("breath", !!(brK & (1 << i)));
k.g.classList.toggle("mid", !!(midK & (1 << i)));
});
}
// ------------------------------------------------------------------ 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; } // private mode, full: this session only
}
// ------------------------------------------------------------------ Web MIDI in (channel messages)
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 status = document.getElementById("status");
const say = (t) => { status.textContent = t; status.hidden = !t; };
async function switchOn() {
const go = document.getElementById("go");
go.disabled = true;
go.textContent = "Starting…";
try {
const ac = new AudioContext({ sampleRate: 44100, latencyHint: "interactive" });
const [wasm] = await Promise.all([
fetch("felucca.wasm").then((r) => { if (!r.ok) throw new Error(`felucca.wasm: ${r.status}`); return r.arrayBuffer(); }),
ac.audioWorklet.addModule("worklet.js")]);
node = new AudioWorkletNode(ac, "felucca", { numberOfInputs: 0, numberOfOutputs: 1, outputChannelCount: [2] });
node.connect(ac.destination);
let warned = false;
await new Promise((res, rej) => {
node.port.onmessage = (e) => {
const m = e.data;
if (m.type === "ready") res();
else if (m.type === "error") rej(new Error(m.message));
else if (m.type === "frame") {
if (m.fb) drawScreen(m.fb);
if (m.leds) drawLights(lastLeds = m.leds, m.anim);
if (m.sectors && !saveFlash(m.sectors) && !warned) {
warned = true;
console.warn("Skiff: this browser does not keep the saves; they last until the page closes.");
}
}
};
node.port.postMessage({ type: "load", wasm, sectors: loadFlash(), master: masterValue }, [wasm]);
});
await ac.resume();
document.getElementById("start").hidden = true;
go.textContent = "On";
if (ac.sampleRate !== 44100) console.warn(`Skiff: the browser plays at ${ac.sampleRate} Hz, the pitch is off by ${(1200 * Math.log2(ac.sampleRate / 44100)).toFixed(0)} cents.`);
syncButtons();
syncKeys();
send({ type: "visible", on: !document.hidden });
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.");
}
}
document.getElementById("go").addEventListener("click", switchOn);
document.addEventListener("visibilitychange", () => send({ type: "visible", on: !document.hidden }));
</script>
</body>
</html>