mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-06 21:04:32 +01:00
web/studio/ (published at /JIANT/studio/; .github/workflows/emulator.yml): - One page in each firmware's look (JIANT FM: cream, violet and the heat gradient, Michroma, the horizon grid; JIANT BYTE: stars, synthwave stripes, pixel type), chosen by the firmware the FM-1 runs (INFO's engines: MATH is BYTE's) or by hand. Home in steps (connect, install, use it) after Melodee's installer, with the help that matters. - A target for everything: the FM-1 over USB, or the emulator. - Install / Editor / Emulator: the sites' own pages in frames (JIANT FM's from /JIANT/, BYTE's from /JIANT-BYTE/: one origin), dressed in the look, without their own headers. The editor connects by itself to the FM-1 Studio found. - Screen: the FM-1's (78 SCREEN / 79 SCREEN_DATA) or the emulator's, straight to full screen; square, the width in portrait and the height in landscape, the controls beside; sharp or smooth pixels; the phone kept awake. - Record: the FM-1's USB audio (stereo, or USB > STEMS's 8 channels: T1..T6, FX, the mix, as a ZIP) or the emulator's output, as WAV; what comes in over MIDI as a .mid; a song's offline stems through the emulator's panel. - Install safety: on the jiant-midi channel like every MIDI page: lets the FM-1 go while an installer writes. - dev_server.py: the published layout on this computer (local tools, the live site for the rest). The emulator answers the whole editor (web/emu/editor-api.h: the firmware's editor.c, as the ports' core runs it; built into felucca.wasm by web/emu/build.sh), so with target Emulator the editor edits the FM-1 in the browser; the emulator lets Studio record its output and choose which MIDI input plays it. editor.html: ?emu=1 inside Studio edits the emulator; the Screen button goes full screen at once. Tests: web/studio/studio_test.mjs (screen frames as the editor's and the firmware's, WAV / ZIP / MIDI, the words), web/studio/browser_test.mjs (Chromium: detection, the screen and full screen both ways, install safety, the editor on the emulator, recording), in tests/run_tests.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UVqsRnhKjiABTzc6Ety3dd
32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
// SPDX-License-Identifier: GPL-3.0-only
|
|
// Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant)
|
|
// JIANT Studio's recorder: every input channel as it comes (up to 8: the FM-1's USB > STEMS), in chunks of ~0.1 s
|
|
// posted to the page with their peak; "flush" posts what is left.
|
|
class StudioRecorder extends AudioWorkletProcessor {
|
|
constructor() {
|
|
super();
|
|
this.buf = null; this.n = 0; this.peak = 0;
|
|
this.port.onmessage = (e) => { if (e.data === "flush") this.flush(); };
|
|
}
|
|
flush() {
|
|
if (!this.buf || !this.n) return;
|
|
const chunk = this.buf.map((p) => p.slice(0, this.n));
|
|
this.port.postMessage({ chunk, peak: this.peak }, chunk.map((p) => p.buffer));
|
|
this.buf = null; this.n = 0; this.peak = 0;
|
|
}
|
|
process(inputs) {
|
|
const ins = inputs[0];
|
|
if (!ins || !ins.length) return true;
|
|
if (!this.buf) this.buf = ins.map(() => new Float32Array(4096));
|
|
for (let c = 0; c < ins.length && c < this.buf.length; c++) {
|
|
const p = ins[c];
|
|
this.buf[c].set(p, this.n);
|
|
for (let i = 0; i < p.length; i += 8) { const v = Math.abs(p[i]); if (v > this.peak) this.peak = v; }
|
|
}
|
|
this.n += ins[0].length;
|
|
if (this.n + 128 > 4096) this.flush();
|
|
return true;
|
|
}
|
|
}
|
|
registerProcessor("studio-recorder", StudioRecorder);
|