mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-05 12:24:42 +01:00
Studio Record: the channels that really arrive (the recorder takes every channel of the stream, channelCountMode max, and says how many; the lanes and the warning follow), not only what the browser's settings report; the warning says to replug the FM-1 after changing its USB mode and, on Windows, to pick the 8-channel format (#292)
Claude-Session: https://claude.ai/code/session_01UVqsRnhKjiABTzc6Ety3dd Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
dc74b4dbe4
commit
99faf5405f
2 files changed
+17
-7
No files matched your search
@@ -1,7 +1,7 @@
|
||||
// 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.
|
||||
// posted to the page with their peak (and, when it changes, how many channels really arrive); "flush" posts what is left.
|
||||
class StudioRecorder extends AudioWorkletProcessor {
|
||||
constructor() {
|
||||
super();
|
||||
@@ -18,6 +18,7 @@ class StudioRecorder extends AudioWorkletProcessor {
|
||||
const ins = inputs[0];
|
||||
if (!ins || !ins.length) return true;
|
||||
if (!this.buf) this.buf = ins.map(() => new Float32Array(4096));
|
||||
if (this.seen !== ins.length) { this.seen = ins.length; this.port.postMessage({ channels: ins.length }); } // what really arrives
|
||||
for (let c = 0; c < ins.length && c < this.buf.length; c++) {
|
||||
const p = ins[c];
|
||||
this.buf[c].set(p, this.n);
|
||||
|
||||
+15
-6
@@ -199,7 +199,7 @@ const TEXT = {
|
||||
profHelp_stemsin: "En la FM-1: MENU › SYSTEM › USB › STEMS+IN y reenchufá. Como STEMS más dos canales de voz: VOX (la voz como la mezcló la última pista) y DRY (la voz como llegó); lo que suena en este dispositivo entra a la FM-1 como voz.",
|
||||
recMonitor: "Probar entrada", recMonitorStop: "Cerrar entrada", recPlay: "▶ Escuchar la toma", recPlayStop: "■ Parar",
|
||||
recDawEmpty: "Tocá Probar entrada: aparece un carril por cada canal que llega, con su nivel. Grabar dibuja cada pista mientras suena.",
|
||||
recFewerLong: "Llegan %got canales y el modo de la FM-1 manda %need. Chrome en Android entrega como mucho 2 (son T1 y T2, o el master): el navegador no puede leer el audio USB de otra forma (protege las interfaces de audio). Para los stems en vivo: Chrome o Edge en una computadora (Mac, Windows o Linux), o la app JIANT Probe en el celular; o los stems de una canción desde un backup (abajo), exactos y sin límite.",
|
||||
recFewerLong: "Llegan %got canales y el modo de la FM-1 manda %need. Chrome en Android entrega como mucho 2 (son T1 y T2, o el master): el navegador no puede leer el audio USB de otra forma (protege las interfaces de audio). Para los stems en vivo: Chrome o Edge en una computadora (Mac, Windows o Linux), o la app JIANT Probe en el celular; o los stems de una canción desde un backup (abajo), exactos y sin límite. Si estás en una computadora: después de cambiar el modo USB de la FM-1, desenchufala y volvé a enchufarla, y recargá esta página. En Windows, además: Configuración de sonido › Más opciones › Grabación › la FM-1 › Propiedades › Opciones avanzadas: elegí el formato de 8 canales.",
|
||||
laneTrack: "pista, mono", lane_L: "master izquierdo", lane_R: "master derecho", lane_FXL: "efectos, izquierda", lane_FXR: "efectos, derecha",
|
||||
lane_VOX: "la voz mezclada", lane_DRY: "la voz como llegó", recMute: "Silenciar", recSolo: "Solo",
|
||||
stWhat: "Qué", stLive: "La sección que suena (8 compases)", stGo: "Stems desde la FM-1", stFile: "…o desde un backup",
|
||||
@@ -408,7 +408,7 @@ const TEXT = {
|
||||
profHelp_stemsin: "On the FM-1: MENU › SYSTEM › USB › STEMS+IN, then plug it in again. STEMS plus two voice channels: VOX (the voice as the last track mixed it) and DRY (the voice as it came); what this device plays goes into the FM-1 as the voice.",
|
||||
recMonitor: "Test the input", recMonitorStop: "Close the input", recPlay: "▶ Play the take", recPlayStop: "■ Stop",
|
||||
recDawEmpty: "Press Test the input: a lane shows for each channel that comes in, with its level. Record draws each track as it plays.",
|
||||
recFewerLong: "%got channels come in and the FM-1's mode sends %need. Chrome on Android hands over at most 2 (T1 and T2, or the master): a web page cannot read USB audio any other way (browsers protect audio interfaces). For live stems: Chrome or Edge on a computer (Mac, Windows or Linux), or the JIANT Probe app on the phone; or a song's stems from a backup (below), exact and unlimited.",
|
||||
recFewerLong: "%got channels come in and the FM-1's mode sends %need. Chrome on Android hands over at most 2 (T1 and T2, or the master): a web page cannot read USB audio any other way (browsers protect audio interfaces). For live stems: Chrome or Edge on a computer (Mac, Windows or Linux), or the JIANT Probe app on the phone; or a song's stems from a backup (below), exact and unlimited. On a computer: after changing the FM-1's USB mode, unplug it, plug it back and reload this page. On Windows, also: Sound settings › More sound settings › Recording › the FM-1 › Properties › Advanced: pick the 8-channel format.",
|
||||
laneTrack: "track, mono", lane_L: "master left", lane_R: "master right", lane_FXL: "effects, left", lane_FXR: "effects, right",
|
||||
lane_VOX: "the voice as mixed", lane_DRY: "the voice as it came", recMute: "Mute", recSolo: "Solo",
|
||||
stWhat: "What", stLive: "The section playing (8 bars)", stGo: "Stems from the FM-1", stFile: "…or from a backup",
|
||||
@@ -944,25 +944,34 @@ async function monitorStart() {
|
||||
const src = stream === "mock" ? mockStems(ac) : ac.createMediaStreamSource(stream);
|
||||
const ch = stream === "mock" ? 10 : Math.max(1, Math.min(16, stream.getAudioTracks()[0]?.getSettings?.().channelCount || src.channelCount || 2));
|
||||
await ac.audioWorklet.addModule("recorder-worklet.js");
|
||||
const node = new AudioWorkletNode(ac, "studio-recorder", { numberOfInputs: 1, numberOfOutputs: 0, channelCount: ch, channelCountMode: "explicit", channelInterpretation: "discrete" });
|
||||
/* "max": the worklet gets every channel the stream has, whatever the browser's settings say (some report none, or 2);
|
||||
it says how many arrive and the lanes follow */
|
||||
const node = new AudioWorkletNode(ac, "studio-recorder", { numberOfInputs: 1, numberOfOutputs: 0, channelCount: ch, channelCountMode: stream === "mock" ? "explicit" : "max", channelInterpretation: "discrete" });
|
||||
src.connect(node);
|
||||
rec.engines = await trackNames();
|
||||
const profile = rec.src === "emu" ? "master" : profileOf(ch);
|
||||
Object.assign(rec, { mon: true, stream, ac, node, ch, rate: ac.sampleRate, profile });
|
||||
daw.setLanes(lanesFor(profile, ch));
|
||||
node.port.onmessage = (e) => {
|
||||
if (e.data.channels && e.data.channels !== rec.ch && rec.src !== "emu" && !rec.on) { // the real count: lanes and the warning again
|
||||
rec.ch = e.data.channels; rec.profile = profileOf(rec.ch); daw.setLanes(lanesFor(rec.profile, rec.ch)); chWarn(rec.ch, rec.profile);
|
||||
return;
|
||||
}
|
||||
const c = e.data.chunk;
|
||||
if (!c) return;
|
||||
if (rec.on) { rec.chunks.push(c); daw.live(c, rec.rate); }
|
||||
else daw.meters(c.map((p) => { let m = 0; for (let i = 0; i < p.length; i += 8) { const v = Math.abs(p[i]); if (v > m) m = v; } return m; }));
|
||||
};
|
||||
const need = PROFILES[profile].ch, got = ch;
|
||||
chWarn(ch, profile);
|
||||
render();
|
||||
return true;
|
||||
}
|
||||
function chWarn(got, profile) {
|
||||
const need = PROFILES[profile].ch;
|
||||
$("recstat").textContent = `${got}${t("recChannels")} · ${rec.rate} Hz`;
|
||||
const warn = $("recwarn");
|
||||
warn.hidden = !(rec.src !== "emu" && (got < need || ($("recprof").value !== "auto" && got < PROFILES[$("recprof").value].ch)));
|
||||
warn.textContent = t("recFewerLong").replace("%got", got).replace("%need", PROFILES[$("recprof").value === "auto" ? profile : $("recprof").value].ch);
|
||||
render();
|
||||
return true;
|
||||
}
|
||||
function monitorStop() {
|
||||
if (!rec.mon) return;
|
||||
|
||||
Reference in new issue
Block a user