Sound Lab tab for REW, handbooks, settings note; VK-Audio only in the start animation and settings

Sound Lab takes filters from REW's API or a filter file onto a channel with a comparison
curve, and sends a channel's curve or filters back. Only checked against a fake server
built from REW's OpenAPI spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 18:18:33 +01:00
1 parent 14ca3aec4b
commit a754021381
10 files changed
+455 -9

No files matched your search

+2
View File
@@ -55,6 +55,8 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
there, browsing (channel, band) is session state (`dashBrowse`). A new module type also goes into `DASH_TYPES` in `server.py`.
* **Read-only switch** (`S.guard`, `viewOnly()` in `app.js`) – web UI on phones and touch devices starts read-only, reusing
the swallowing of the app lock. A safety catch per browser tab only: not stored, the server doesn't know it. Mute all stays.
* **Sound Lab / REW** (`static/rew.js`, handbooks in `static/docs.js`, `rew_call` in `server.py`) – the server talks to REW's API on `127.0.0.1:4735`, which only answers on
REW's own computer; filter files work from anywhere. Only checked against a fake server built from its OpenAPI spec.
* **Network search** – `App.scan_network` probes the local /24 networks on TCP 9761 (handshake + device info),
skipping DSPs this app is connected to.
* **Copy settings / mute all** – `App.copy_settings` (`POST /api/copy`, groups level/filters/eq/dynamics/routing) and
+3 -1
View File
@@ -32,6 +32,8 @@ Control both devices at the same time from your phone, tablet or computer – ov
clickable EQ bands and overlays, channel, limiter, routing, delay, FIR, notes), move them by the title, resize them by
the arrows, choose their DSP. It only looks and never changes a DSP; the layout is stored in the config
* **Read-only switch** – on phones and tablets the web UI starts read-only; a small switch at the top allows changes
* **Sound Lab** – together with REW (Room EQ Wizard): take the filters of a measurement or a REW filter file onto a channel,
compare before applying, send a channel's curve or filters back to REW. Handbook with real cases here and in SoundField
* **Mixer** – faders, mute and live meters for all inputs and outputs, limiter LED on every output (status read
from the DSP)
* **Channel** – name, gain, delay, polarity, high/low pass, 8/9-band PEQ with a draggable curve; the curve shows
@@ -262,7 +264,7 @@ manufacturer. Frame examples in the tests also match the DSP 408 captures publis
## License
[MIT](LICENSE) © 2026 Givou · VK-Audio
[MIT](LICENSE) © 2026 Givou
The desktop builds bundle third-party components under their own licenses (Python – PSF License, pywebview – BSD,
pythonnet – MIT, PyInstaller bootloader – GPL with exception allowing distribution). If you distribute built
+81
View File
@@ -17,11 +17,14 @@ import mimetypes
import re
import secrets
import socket
import struct
import sys
import time
import uuid
from pathlib import Path
from urllib.error import HTTPError, URLError
from urllib.parse import parse_qs, urlsplit
from urllib.request import Request, urlopen
import sim
from dsp import preset, usbhid
@@ -144,6 +147,71 @@ def clean_soundfield(data) -> dict:
}
REW_URL = "http://127.0.0.1:4735" # REW's API only answers on its own computer
def rew_call(method: str, path: str, body=None):
"""One request to REW's API."""
data = json.dumps(body).encode() if body is not None else None
req = Request(REW_URL + path, data=data, method=method, headers={"Content-Type": "application/json"})
try:
with urlopen(req, timeout=8) as r:
raw = r.read()
except HTTPError as e:
try:
msg = json.loads(e.read()).get("message", "")
except (ValueError, AttributeError):
msg = ""
raise RuntimeError(f"REW: {msg or e.code}") from None
except (URLError, OSError):
raise RuntimeError("REW can't be reached") from None
return json.loads(raw) if raw else {}
def rew_id(body: dict) -> str:
mid = str(body.get("id") or "")
if not re.fullmatch(r"[\w-]{1,64}", mid):
raise ValueError("No measurement chosen")
return mid
def rew_filters(mid: str) -> list:
res = rew_call("GET", f"/measurements/{mid}/filters")
return res.get("filters", []) if isinstance(res, dict) else res
def rew_measurements() -> list:
res = rew_call("GET", "/measurements")
items = res.values() if isinstance(res, dict) else res
return [{"id": m.get("uuid") or "", "title": m.get("title") or "?"} for m in items if isinstance(m, dict) and m.get("uuid")]
def rew_send_filters(mid: str, filters: list):
"""Put a channel's EQ on a measurement. The generic equaliser takes all filter types and enough filters."""
rew_call("POST", f"/measurements/{mid}/equaliser", {"manufacturer": "Generic", "model": "Generic"})
filters = [f for f in filters if isinstance(f, dict)][:9]
for i, f in enumerate(filters):
f["index"] = i + 1
rest = [{"index": f.get("index"), "type": "None", "enabled": True, "isAuto": False}
for f in rew_filters(mid) if isinstance(f, dict) and f.get("index", 0) > len(filters) and f.get("type") not in (None, "None")]
rew_call("POST", f"/measurements/{mid}/filters", {"filters": filters + rest})
def rew_floats(values) -> str:
"""REW's data format: base64 of 32-bit floats, most significant byte first."""
return base64.b64encode(struct.pack(f">{len(values)}f", *[float(v) for v in values])).decode()
def rew_send_curve(body: dict):
mag, phase = body.get("magnitude"), body.get("phase")
if not isinstance(mag, list) or not isinstance(phase, list) or not 2 <= len(mag) <= 4000 or len(mag) != len(phase):
raise ValueError("No curve to send")
rew_call("POST", "/import/frequency-response-data", {
"identifier": str(body.get("identifier") or "DSP Control")[:60], "isImpedance": False,
"startFreq": _num(body.get("startFreq"), 1, 20000, 20), "ppo": int(_num(body.get("ppo"), 1, 192, 96)),
"magnitude": rew_floats(mag), "phase": rew_floats(phase)})
DASH_TYPES = ("status", "meters", "mixer", "curve", "channel", "limiter", "routing", "delays", "fir", "notes")
@@ -847,6 +915,19 @@ class App:
return await self.set_demo(body) if method == "PUT" else self.demo_info()
if path == "/api/scan" and method == "POST":
return await self.scan_network()
if path == "/api/rew/status" and method == "GET":
res = await asyncio.to_thread(rew_call, "GET", "/version")
return {"version": res.get("message", "") if isinstance(res, dict) else str(res)}
if path == "/api/rew/measurements" and method == "GET":
return await asyncio.to_thread(rew_measurements)
if path == "/api/rew/filters" and method == "POST":
return await asyncio.to_thread(rew_filters, rew_id(body))
if path == "/api/rew/send-filters" and method == "POST":
await asyncio.to_thread(rew_send_filters, rew_id(body), body.get("filters") or [])
return {"ok": True}
if path == "/api/rew/send-curve" and method == "POST":
await asyncio.to_thread(rew_send_curve, body)
return {"ok": True}
if path == "/api/usb" and method == "GET":
return await asyncio.to_thread(usbhid.list_devices)
if path == "/api/limiter" and method == "GET":
+5 -2
View File
@@ -1359,6 +1359,7 @@ function peqCard(d, kind, idx) {
const card = h("div", { class: "card wide" + (ch.peq_bypass ? " eq-off" : "") },
h("h3", {}, h("span", { class: "grow" }, t("Parametric EQ")), modeSeg,
d.fir ? null : toggleBtn("EQ Bypass", kind, idx, "peq_bypass", "small bypass", v => { card.classList.toggle("eq-off", v); renderBand(); redraw(); }),
h("button", { class: "small", "data-view-ok": "", title: t("Open this channel in Sound Lab (REW)"), onclick: () => openLab(kind, idx) }, "REW"),
h("button", { class: "small", onclick: async () => {
if (!await askConfirm(t("Reset EQ"), t("Set all PEQ bands of this channel to 0 dB and clear bypass?"), t("All flat"))) return;
chans(dev(), kind)[idx].peq.forEach((bb, i) => {
@@ -2405,6 +2406,8 @@ function viewSettings() {
h("section", { class: "setsec", id: "set-" + id },
h("header", {}, h("h2", {}, title), h("p", {}, desc)),
h("div", { class: "setgrid " + cls }, cards.filter(Boolean)))),
h("div", { class: "disclaimer" }, svgIcon('<path d="M12 3l9.5 17h-19zM12 10v4M12 17.5v.01"/>'),
h("p", {}, h("b", {}, t("Not from Thomann.")), " ", t("This is an independent project, not connected to Thomann or t.racks, and much of it was written with AI. It comes without any guarantee: you use it at your own risk."))),
h("p", { class: "vkfoot" }, "VK-Audio"));
}
@@ -2454,7 +2457,7 @@ function render() {
: d.status === "locked" ? h("div", {}, h("p", {}, t("This DSP is locked with a code.")),
h("button", { class: "on", onclick: () => unlockDialog(d) }, t("Enter code")))
: S.demo.enabled && !d.demo ? t("Disconnected while demo mode is on") : t("Not connected."));
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, fir: d.fir ? viewFir : viewMixer, limiter: viewLimiter, test: viewTest }[S.view] || viewMixer)(d);
else content = ({ mixer: viewMixer, channel: viewChannel, routing: viewRouting, link: viewLink, fir: d.fir ? viewFir : viewMixer, lab: viewLab, limiter: viewLimiter, test: viewTest }[S.view] || viewMixer)(d);
main.replaceChildren(...[content].flat().filter(Boolean));
main.querySelectorAll(H_SCROLL).forEach((e, i) => { if (xs[i]) e.scrollLeft = xs[i]; });
window.scrollTo(0, y);
@@ -2700,7 +2703,7 @@ function showLogin() {
["1", "2", "3", "4", "5", "6", "7", "8", "9"].map(k => key(k)), h("span"), key("0"), key("del", "⌫"));
root.replaceChildren(h("div", { class: "loginbox" },
h("div", { class: "logo" }, $(".brand svg").cloneNode(true)),
h("h1", {}, "DSP Control"), h("p", {}, t("Enter PIN")), dots, msg, pad, h("small", { class: "vkfoot" }, "VK-Audio")));
h("h1", {}, "DSP Control"), h("p", {}, t("Enter PIN")), dots, msg, pad));
root.hidden = false;
root.onkeydown = null;
document.onkeydown = e => {
+81
View File
@@ -0,0 +1,81 @@
"use strict";
// Short handbooks behind the book symbol: what it is for, then real cases step by step.
const DOC_LAB = () => ({
title: t("Sound Lab handbook"),
parts: [
{ h: t("What it is for"), p: t("REW (Room EQ Wizard, free) measures your speakers in the room. Sound Lab brings its filters onto a channel of the DSP and sends the channel's EQ back to REW, so you don't type values by hand.") },
{ h: t("Setting up"), steps: [
t("Install REW on the computer running this app and connect a measuring microphone."),
t("In REW: Preferences → API → start the API, and tick that it starts with REW."),
t("Open Sound Lab and press “Check”. The dot turns green and shows the REW version."),
], p: t("REW's API only answers on its own computer. On a phone, or with the app on a Raspberry Pi, use the filter file instead.") },
{ h: t("Example: correcting a top in a hall"), steps: [
t("Export a preset first (File… → Export), so you can go back."),
t("Mute everything except the speaker you are measuring and set a low level. Put the microphone at ear height in the audience area."),
t("Measure in REW, open its EQ window, choose the equaliser “Generic” and let it calculate filters with “Match response to target”."),
t("In Sound Lab pick the channel of this speaker, e.g. Out 1, choose the measurement and press “Take filters”."),
t("Check the orange curve and the table. Outputs have 9 bands and inputs 8; anything above that is left out and shown in the note."),
t("Press “Apply” and measure again. The new measurement should now look like the prediction."),
], p: t("Tip: prefer cutting peaks to filling dips. A dip caused by the room can't be filled by more power, and big boosts only use up headroom.") },
{ h: t("Example: checking the channel against a measurement"), steps: [
t("Pick the channel and press “Send curve as a new measurement”."),
t("In REW it appears in the measurement list. Show it in “All SPL” together with your real measurement."),
t("So you see at a glance whether crossover and EQ on the DSP do what the measurement needs."),
] },
{ h: t("Example: trying changes in REW first"), steps: [
t("Choose a measurement and press “Send filters to the chosen measurement”. This replaces the filters of that measurement in REW."),
t("In REW's EQ window change the filters and watch the predicted result. Nothing changes on the DSP."),
t("If you like it, press “Take filters” in Sound Lab, check and apply."),
] },
{ h: t("Without a connection (phone, Raspberry Pi)"), steps: [
t("In REW's EQ window: File → Export → Filter settings as text."),
t("In Sound Lab press “Load REW filter file…”, check and apply."),
] },
],
});
const DOC_SF = () => ({
title: t("SoundField handbook"),
parts: [
{ h: t("What it is for"), p: t("SoundField is a top view of the room for planning before you set up: where speakers go, how evenly the room is covered, and which delays they need. It calculates a free field without reflections, so it is a planning aid, not a measurement.") },
{ h: t("Example: a band in a hall of 20 × 30 m"), steps: [
t("Under “Room” enter width 20 and depth 30, stage 8 × 4 m, the temperature and the ear height of the audience."),
t("Press “Quick start” under “Suggestions” for a stereo pair and a sub, or “Stacks” for a sub left and right with the top on a pole."),
t("Drag the reference cross to your mixing position. Mains and subs are aligned in time at this point."),
t("Click a speaker: set its type, height and coverage, drag it into place and aim it with the white handle."),
t("Look at the “Level” map and the spread below the plan. Aim for as many listeners as possible within ±3 dB."),
t("Follow “Suggestions”: they offer aiming, raising the mains, or delay speakers when the back of the room falls off."),
] },
{ h: t("Example: the back of the hall is too quiet"), steps: [
t("Press “Add delay line” in the suggestion, or add “+ Delay” and drag it to about two thirds of the room."),
t("Drag its dashed target point to the middle of the area it should cover."),
t("Switch the map to “Timing”: marked areas mean the delay arrives before the mains or more than 30 ms late."),
t("The offset under “Delays” keeps the mains arriving first, so the sound still seems to come from the stage. 5 ms is a good start."),
] },
{ h: t("Example: subs, and why two can be worse than one"), steps: [
t("Switch the map to “Sub” and choose a frequency such as 80 Hz."),
t("With subs left and right you see lanes of cancellation through the room."),
t("Try the “Centre cluster” suggestion and compare: the lanes disappear."),
] },
{ h: t("Taking the delays to the DSP"), steps: [
t("Export a preset first (File… → Export)."),
t("Select a speaker and tick which DSP outputs feed it."),
t("In the “Delays” table press “Apply” for one speaker, or “Apply all”. The column “Now on DSP” shows what is set."),
t("Check the result by ear or with a measurement: temperature, reflections and real speakers differ from the model."),
] },
],
});
function docDialog(doc) {
const d = doc();
return modal({ title: d.title,
body: h("div", { class: "docbody" }, d.parts.map(part => h("section", {}, h("h4", {}, part.h),
part.steps ? h("ol", {}, part.steps.map(s => h("li", {}, s))) : null,
part.p ? h("p", {}, part.p) : null))),
actions: [{ label: t("Close"), primary: true, value: () => true }] });
}
const docButton = doc => h("button", { class: "icon docbtn", "data-view-ok": "", title: t("Handbook"), "aria-label": t("Handbook"), onclick: () => docDialog(doc) },
svgIcon('<path d="M5 4.5A1.5 1.5 0 0 1 6.5 3H19v15H6.5A1.5 1.5 0 0 0 5 19.5z"/><path d="M5 19.5A1.5 1.5 0 0 0 6.5 21H19v-3M9 7.5h6M9 11h6"/>'));
+89
View File
@@ -583,6 +583,95 @@ const DE = {
"Read-only – switch to edit at the top": "Nur ansehen – oben auf Bearbeiten umschalten",
"No DSP added yet": "Noch kein DSP angelegt",
"Add your DSP over the network or USB. To look around first, switch on demo mode in the settings.": "Lege deinen DSP über Netzwerk oder USB an. Zum Ausprobieren gibt es in den Einstellungen den Demo-Modus.",
"Not from Thomann.": "Nicht von Thomann.",
"This is an independent project, not connected to Thomann or t.racks, and much of it was written with AI. It comes without any guarantee: you use it at your own risk.": "Das ist ein unabhängiges Projekt ohne Verbindung zu Thomann oder t.racks, und vieles daran wurde mit KI geschrieben. Es gibt keine Garantie: Die Nutzung erfolgt auf eigene Gefahr.",
"Room EQ Wizard: take filters or send this EQ": "Room EQ Wizard: Filter übernehmen oder diesen EQ senden",
"gain limited to ±12 dB": "Gain auf ±12 dB begrenzt",
"frequency limited to 20 Hz … 20 kHz": "Frequenz auf 20 Hz … 20 kHz begrenzt",
"Looking for REW…": "Suche REW…",
"Measurement": "Messung",
"{cut} filters left out: this channel has {n} bands": "{cut} Filter weggelassen: Dieser Kanal hat {n} Bänder",
"{n} filters skipped: type not available on the DSP": "{n} Filter übersprungen: Typ gibt es am DSP nicht",
"No usable filters found.": "Keine verwendbaren Filter gefunden.",
"Apply to {ch}": "Auf {ch} übernehmen",
"{n} filters applied to {ch}": "{n} Filter auf {ch} übernommen",
"No REW filters found in this file.": "In dieser Datei sind keine REW-Filter.",
"Filters sent to “{m}”": "Filter an „{m}“ gesendet",
"Curve sent to REW as a new measurement": "Kurve als neue Messung an REW gesendet",
"Take filters": "Filter holen",
"Send filters to this measurement": "Filter an diese Messung senden",
"Send curve as a new measurement": "Kurve als neue Messung senden",
"Load REW filter file…": "REW-Filterdatei laden…",
"Also works without a connection: in REW, File → Export → Filter settings as text": "Geht auch ohne Verbindung: in REW Datei → Export → Filter settings as text",
"From this channel to REW": "Von diesem Kanal an REW",
"REW – {ch}": "REW – {ch}",
"Connected to REW {v}. {n} measurements.": "Mit REW {v} verbunden. {n} Messungen.",
"No measurements in REW": "Keine Messungen in REW",
"REW can't be reached. Start REW on the computer running this app and switch on its API (Preferences → API). The filter file works anyway.": "REW ist nicht erreichbar. Starte REW auf dem Computer, auf dem diese App läuft, und schalte die API ein (Preferences → API). Die Filterdatei geht trotzdem.",
"REW can't be reached": "REW ist nicht erreichbar",
"No measurement chosen": "Keine Messung gewählt",
"No curve to send": "Keine Kurve zum Senden",
"Open this channel in Sound Lab (REW)": "Diesen Kanal im Sound Lab öffnen (REW)",
"Discard": "Verwerfen",
"REW {v} · {n} measurements": "REW {v} · {n} Messungen",
"REW not connected": "REW nicht verbunden",
"Check": "Prüfen",
"now": "jetzt",
"after applying": "nach dem Übernehmen",
"From REW to this channel": "Von REW auf diesen Kanal",
"As a measurement you can compare the channel's curve with real measurements in REW. Filters on a measurement let REW predict the result.": "Als Messung kannst du die Kurve des Kanals in REW mit echten Messungen vergleichen. Filter auf einer Messung lassen REW das Ergebnis vorhersagen.",
"Send filters to the chosen measurement": "Filter an die gewählte Messung senden",
"Handbook": "Handbuch",
"Sound Lab handbook": "Sound-Lab-Handbuch",
"SoundField handbook": "SoundField-Handbuch",
"What it is for": "Wofür das gut ist",
"REW (Room EQ Wizard, free) measures your speakers in the room. Sound Lab brings its filters onto a channel of the DSP and sends the channel's EQ back to REW, so you don't type values by hand.": "REW (Room EQ Wizard, kostenlos) misst deine Lautsprecher im Raum. Das Sound Lab bringt dessen Filter auf einen Kanal des DSP und schickt den EQ des Kanals zurück an REW, sodass du keine Werte abtippen musst.",
"Setting up": "Einrichten",
"Install REW on the computer running this app and connect a measuring microphone.": "REW auf dem Computer installieren, auf dem diese App läuft, und ein Messmikrofon anschließen.",
"In REW: Preferences → API → start the API, and tick that it starts with REW.": "In REW: Preferences → API → die API starten und anhaken, dass sie mit REW startet.",
"Open Sound Lab and press “Check”. The dot turns green and shows the REW version.": "Das Sound Lab öffnen und „Prüfen“ drücken. Der Punkt wird grün und zeigt die REW-Version.",
"REW's API only answers on its own computer. On a phone, or with the app on a Raspberry Pi, use the filter file instead.": "Die API von REW antwortet nur auf dem eigenen Computer. Am Handy oder mit der App auf einem Raspberry Pi nimmst du stattdessen die Filterdatei.",
"Example: correcting a top in a hall": "Beispiel: ein Top in einer Halle korrigieren",
"Export a preset first (File… → Export), so you can go back.": "Zuerst ein Preset exportieren (Datei… → Export), damit du zurück kannst.",
"Mute everything except the speaker you are measuring and set a low level. Put the microphone at ear height in the audience area.": "Alles außer dem gemessenen Lautsprecher stummschalten und einen niedrigen Pegel einstellen. Das Mikrofon auf Ohrhöhe in den Publikumsbereich stellen.",
"Measure in REW, open its EQ window, choose the equaliser “Generic” and let it calculate filters with “Match response to target”.": "In REW messen, das EQ-Fenster öffnen, den Equalizer „Generic“ wählen und mit „Match response to target“ Filter berechnen lassen.",
"In Sound Lab pick the channel of this speaker, e.g. Out 1, choose the measurement and press “Take filters”.": "Im Sound Lab den Kanal dieses Lautsprechers wählen, z. B. Out 1, die Messung auswählen und „Filter holen“ drücken.",
"Check the orange curve and the table. Outputs have 9 bands and inputs 8; anything above that is left out and shown in the note.": "Die orange Kurve und die Tabelle prüfen. Ausgänge haben 9 Bänder, Eingänge 8; was darüber liegt, wird weggelassen und im Hinweis genannt.",
"Press “Apply” and measure again. The new measurement should now look like the prediction.": "„Übernehmen“ drücken und neu messen. Die neue Messung sollte jetzt wie die Vorhersage aussehen.",
"Tip: prefer cutting peaks to filling dips. A dip caused by the room can't be filled by more power, and big boosts only use up headroom.": "Tipp: Lieber Spitzen absenken als Löcher auffüllen. Ein Loch durch den Raum lässt sich nicht mit mehr Leistung füllen, große Anhebungen kosten nur Headroom.",
"Example: checking the channel against a measurement": "Beispiel: den Kanal mit einer Messung vergleichen",
"Pick the channel and press “Send curve as a new measurement”.": "Den Kanal wählen und „Kurve als neue Messung senden“ drücken.",
"In REW it appears in the measurement list. Show it in “All SPL” together with your real measurement.": "In REW erscheint sie in der Messungsliste. Zeige sie in „All SPL“ zusammen mit deiner echten Messung an.",
"So you see at a glance whether crossover and EQ on the DSP do what the measurement needs.": "So siehst du auf einen Blick, ob Weiche und EQ am DSP das tun, was die Messung braucht.",
"Example: trying changes in REW first": "Beispiel: Änderungen zuerst in REW ausprobieren",
"Choose a measurement and press “Send filters to the chosen measurement”. This replaces the filters of that measurement in REW.": "Eine Messung wählen und „Filter an die gewählte Messung senden“ drücken. Das ersetzt die Filter dieser Messung in REW.",
"In REW's EQ window change the filters and watch the predicted result. Nothing changes on the DSP.": "Im EQ-Fenster von REW die Filter ändern und die Vorhersage beobachten. Am DSP ändert sich dabei nichts.",
"If you like it, press “Take filters” in Sound Lab, check and apply.": "Wenn es passt, im Sound Lab „Filter holen“ drücken, prüfen und übernehmen.",
"Without a connection (phone, Raspberry Pi)": "Ohne Verbindung (Handy, Raspberry Pi)",
"In REW's EQ window: File → Export → Filter settings as text.": "Im EQ-Fenster von REW: File → Export → Filter settings as text.",
"In Sound Lab press “Load REW filter file…”, check and apply.": "Im Sound Lab „REW-Filterdatei laden…“ drücken, prüfen und übernehmen.",
"SoundField is a top view of the room for planning before you set up: where speakers go, how evenly the room is covered, and which delays they need. It calculates a free field without reflections, so it is a planning aid, not a measurement.": "SoundField ist eine Draufsicht auf den Raum zum Planen vor dem Aufbau: wo die Lautsprecher hinkommen, wie gleichmäßig der Raum abgedeckt ist und welche Delays sie brauchen. Es rechnet im Freifeld ohne Reflexionen, ist also eine Planungshilfe und keine Messung.",
"Example: a band in a hall of 20 × 30 m": "Beispiel: eine Band in einer Halle mit 20 × 30 m",
"Under “Room” enter width 20 and depth 30, stage 8 × 4 m, the temperature and the ear height of the audience.": "Unter „Raum“ Breite 20 und Tiefe 30 eintragen, Bühne 8 × 4 m, die Temperatur und die Ohrhöhe des Publikums.",
"Press “Quick start” under “Suggestions” for a stereo pair and a sub, or “Stacks” for a sub left and right with the top on a pole.": "Unter „Vorschläge“ „Schnellstart“ drücken für ein Stereopaar und einen Sub, oder „Stacks“ für je einen Sub links und rechts mit dem Top auf der Distanzstange.",
"Drag the reference cross to your mixing position. Mains and subs are aligned in time at this point.": "Das Referenzkreuz auf deinen Mischplatz ziehen. Mains und Subs werden an diesem Punkt zeitlich ausgerichtet.",
"Click a speaker: set its type, height and coverage, drag it into place and aim it with the white handle.": "Einen Lautsprecher anklicken: Typ, Höhe und Abstrahlwinkel einstellen, an seinen Platz ziehen und mit dem weißen Griff ausrichten.",
"Look at the “Level” map and the spread below the plan. Aim for as many listeners as possible within ±3 dB.": "Die Karte „Pegel“ und die Streuung unter dem Plan ansehen. Ziel: möglichst viele Zuhörer innerhalb von ±3 dB.",
"Follow “Suggestions”: they offer aiming, raising the mains, or delay speakers when the back of the room falls off.": "Den „Vorschlägen“ folgen: Sie bieten Ausrichten, Höherstellen der Mains oder Delay-Lautsprecher an, wenn es hinten zu leise wird.",
"Example: the back of the hall is too quiet": "Beispiel: Hinten in der Halle ist es zu leise",
"Press “Add delay line” in the suggestion, or add “+ Delay” and drag it to about two thirds of the room.": "Im Vorschlag „Delay-Linie hinzufügen“ drücken, oder „+ Delay“ hinzufügen und auf etwa zwei Drittel des Raums ziehen.",
"Drag its dashed target point to the middle of the area it should cover.": "Seinen gestrichelten Zielpunkt in die Mitte des Bereichs ziehen, den er abdecken soll.",
"Switch the map to “Timing”: marked areas mean the delay arrives before the mains or more than 30 ms late.": "Die Karte auf „Timing“ stellen: Markierte Bereiche bedeuten, dass das Delay vor den Mains oder über 30 ms zu spät ankommt.",
"The offset under “Delays” keeps the mains arriving first, so the sound still seems to come from the stage. 5 ms is a good start.": "Der Offset unter „Delays“ sorgt dafür, dass die Mains zuerst ankommen und der Klang weiter von der Bühne zu kommen scheint. 5 ms sind ein guter Start.",
"Example: subs, and why two can be worse than one": "Beispiel: Subs, und warum zwei schlechter sein können als einer",
"Switch the map to “Sub” and choose a frequency such as 80 Hz.": "Die Karte auf „Sub“ stellen und eine Frequenz wählen, etwa 80 Hz.",
"With subs left and right you see lanes of cancellation through the room.": "Mit Subs links und rechts siehst du Auslöschungsgassen durch den Raum.",
"Try the “Centre cluster” suggestion and compare: the lanes disappear.": "Den Vorschlag „Mittig bündeln“ ausprobieren und vergleichen: Die Gassen verschwinden.",
"Taking the delays to the DSP": "Die Delays auf den DSP bringen",
"Export a preset first (File… → Export).": "Zuerst ein Preset exportieren (Datei… → Export).",
"Select a speaker and tick which DSP outputs feed it.": "Einen Lautsprecher wählen und anhaken, welche DSP-Ausgänge ihn speisen.",
"In the “Delays” table press “Apply” for one speaker, or “Apply all”. The column “Now on DSP” shows what is set.": "In der Tabelle „Delays“ für einen Lautsprecher „Übernehmen“ drücken, oder „Alle übernehmen“. Die Spalte „Jetzt im DSP“ zeigt, was gesetzt ist.",
"Check the result by ear or with a measurement: temperature, reflections and real speakers differ from the model.": "Das Ergebnis mit dem Ohr oder per Messung prüfen: Temperatur, Reflexionen und echte Lautsprecher weichen vom Modell ab.",
};
const DE_PATTERNS = [
+3 -1
View File
@@ -32,7 +32,6 @@
<div class="brand" aria-hidden="true">
<svg viewBox="0 0 32 32" width="26" height="26"><rect width="32" height="32" rx="7" fill="#161a20"/><path d="M7 22V10M13 22V6M19 22V14M25 22V9" stroke="#38bdf8" stroke-width="3" stroke-linecap="round"/></svg>
</div>
<span class="vkmark">VK-Audio</span>
<div id="devtabs"></div>
<nav id="viewtabs" aria-label="View" data-t-label="View">
<button data-view="dash"><svg viewBox="0 0 24 24"><rect x="3" y="3" width="8" height="9" rx="1.5"/><rect x="13" y="3" width="8" height="5" rx="1.5"/><rect x="13" y="10" width="8" height="11" rx="1.5"/><rect x="3" y="14" width="8" height="7" rx="1.5"/></svg><span>Dashboard</span></button>
@@ -43,6 +42,7 @@
<button data-view="fir" hidden><svg viewBox="0 0 24 24"><path d="M2 12h3l2-7 3 14 3-11 2 6 2-3 1 1h4"/></svg><span>FIR</span></button>
<button data-view="limiter"><svg viewBox="0 0 24 24"><path d="M2 7h20" stroke-dasharray="2.5 2.5"/><path d="M2 14c2 0 3-7 5-7h3c2 0 3 11 6 11s3-5 6-5"/></svg><span>Limiter</span></button>
<button data-view="soundfield"><svg viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M8 7l-2 2 2 2M16 7l2 2-2 2"/><path d="M7 15.5a7 7 0 0 1 10 0" stroke-dasharray="2 2"/><circle cx="12" cy="18" r="1.2" class="f"/></svg><span>SoundField</span><span class="short">Field</span></button>
<button data-view="lab"><svg viewBox="0 0 24 24"><path d="M9.5 3h5M10.5 3v6.5L5 19a1.3 1.3 0 0 0 1.1 2h11.8a1.3 1.3 0 0 0 1.1-2l-5.5-9.5V3"/><path d="M7.5 15h9"/></svg><span>Sound Lab</span><span class="short">Lab</span></button>
<button data-view="test"><svg viewBox="0 0 24 24"><path d="M4 9v6h4l5 4V5L8 9z"/><path d="M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12"/></svg><span data-t="Audio test">Audio test</span><span class="short" data-t="Test">Test</span></button>
</nav>
<button id="btn-muteall" class="icon" aria-label="Mute all" title="Mute all"></button>
@@ -61,5 +61,7 @@
<script src="/app.js"></script>
<script src="/soundfield.js"></script>
<script src="/dashboard.js"></script>
<script src="/docs.js"></script>
<script src="/rew.js"></script>
</body>
</html>
+157
View File
@@ -0,0 +1,157 @@
"use strict";
// Sound Lab: working together with REW (Room EQ Wizard). Take filters from a measurement or a filter file, compare them
// with the channel before applying, send a channel's EQ back. REW's API only answers on the computer it runs on, so the
// server of this app talks to it (see rew_call); a filter file also works from a phone or with the app on a Raspberry Pi.
const REW_IN = { PK: 0, PEAK: 0, LS: 1, LSC: 1, LSQ: 1, HS: 2, HSC: 2, HSQ: 2, HP1: 3, HP: 4, HPQ: 4, LP1: 5, LP: 6, LPQ: 6, AP: 8 };
const REW_OUT = ["PK", "LS", "HS", "HP1", "HP", "LP1", "LP", "AP", "AP"];
const lab = { dev: null, sel: { kind: "out", idx: 0 }, rows: null, from: "", rew: null, measId: "", checked: false };
const num2 = s => Number(String(s).replace(",", "."));
// "Filter 1: ON PK Fc 100.0 Hz Gain -3.0 dB Q 2.00" from REW's filter settings text
function rewParseText(text) {
const out = [];
for (const line of text.split(/\r?\n/)) {
const m = /^\s*Filter\s+(\d+)\s*:\s*(ON|OFF)\s+(\S+)(.*)$/i.exec(line);
if (!m || /^none$/i.test(m[3])) continue;
const rest = m[4];
const fc = /Fc\s*([\d.,]+)\s*(k?)Hz/i.exec(rest), gain = /Gain\s*([-+\d.,]+)\s*dB/i.exec(rest), q = /\bQ\s*([\d.,]+)/i.exec(rest);
out.push({ type: m[3].toUpperCase(), enabled: m[2].toUpperCase() === "ON",
frequency: fc ? num2(fc[1]) * (fc[2] ? 1000 : 1) : 0, gaindB: gain ? num2(gain[1]) : 0, q: q ? num2(q[1]) : 0 });
}
return out;
}
const rewNearestQ = q => Q_TABLE.reduce((best, v, i) => (Math.abs(Math.log(v / q)) < Math.abs(Math.log(Q_TABLE[best] / q)) ? i : best), 0);
// REW filter -> band of the DSP, with a note where the DSP can't take it exactly
function rewToBand(f) {
if (/^none$/i.test(String(f.type || "None"))) return null;
const type = REW_IN[String(f.type).toUpperCase().replace(/\s/g, "")];
if (type === undefined) return { unsupported: true };
const gain = clamp(Math.round(120 + (f.gaindB || 0) * 10), 0, 240), q = f.q > 0 ? rewNearestQ(f.q) : 32;
const notes = [];
if (Math.abs(f.gaindB || 0) > 12) notes.push(t("gain limited to ±12 dB"));
if (f.frequency < 20 || f.frequency > 20000) notes.push(t("frequency limited to 20 Hz … 20 kHz"));
return { band: { type, freq: hzFreq(f.frequency), gain, q, bypass: f.enabled === false }, notes };
}
function rewFromBand(b, i) {
return { index: i + 1, type: REW_OUT[b.type], enabled: !b.bypass, isAuto: false, frequency: +freqHz(b.freq).toFixed(1),
gaindB: hasGain(b.type) ? eqDb(b.gain) : 0, q: Q_TABLE[b.q] };
}
function rewCurve(d, kind, idx) {
const ch = chans(d, kind)[idx], ppo = 96, n = Math.floor(Math.log2(1000) * ppo) + 1, magnitude = [], phase = [];
for (let i = 0; i < n; i++) {
const hh = channelH(ch, 20 * 2 ** (i / ppo));
magnitude.push(+cdb(hh).toFixed(3));
phase.push(+cdeg(hh).toFixed(2));
}
return { identifier: `${d.name} ${chLabel(kind, idx)}`.slice(0, 60), startFreq: 20, ppo, magnitude, phase };
}
async function labCheck() {
try {
const st = await api("GET", "/api/rew/status"), meas = await api("GET", "/api/rew/measurements");
lab.rew = { version: st.version, meas };
if (!meas.some(m => m.id === lab.measId)) lab.measId = meas[0] ? meas[0].id : "";
} catch { lab.rew = null; lab.measId = ""; }
lab.checked = true;
if (S.view === "lab" && !S.settings) render();
}
function openLab(kind, idx) {
lab.sel = { kind, idx }; lab.rows = null;
S.view = "lab"; store.set("dsp.view", "lab"); render(); window.scrollTo(0, 0);
}
function labTake(filters, from) { lab.rows = filters.map(rewToBand).filter(Boolean); lab.from = from; render(); }
async function labFromFile() {
let f;
try { f = await openFile(".txt,text/plain"); } catch (e) { return toast(trMsg(e.message)); }
if (!f) return;
const list = rewParseText(atob(f.b64));
if (!list.length) return toast(t("No REW filters found in this file."));
labTake(list, f.name);
}
function viewLab(d) {
if (lab.dev !== d.id) { lab.dev = d.id; lab.rows = null; lab.sel = { kind: "out", idx: 0 }; }
if (lab.sel.idx >= chans(d, lab.sel.kind).length) lab.sel = { kind: "out", idx: 0 };
if (!lab.checked) { lab.checked = true; labCheck(); }
const { kind, idx } = lab.sel, ch = chans(d, kind)[idx], name = chTitle(d, kind, idx), n = ch.peq.length;
const measName = () => (lab.rew.meas.find(m => m.id === lab.measId) || {}).title || "";
const chip = (k, i) => h("button", { class: "firch" + (k === kind && i === idx ? " on" : "") + (chans(d, k)[i].peq.some(b => !b.bypass && b.gain !== 120) ? " used" : ""), "data-view-ok": "",
onclick: () => { lab.sel = { kind: k, idx: i }; lab.rows = null; render(); } },
h("b", {}, chLabel(k, i)), h("small", {}, chans(d, k)[i].name || " "));
// proposal from REW: bands that fit, what doesn't
const usable = (lab.rows || []).filter(r => r.band), kept = usable.slice(0, n), bands = kept.map(r => r.band);
const skipped = (lab.rows || []).length - usable.length, cut = usable.length - kept.length;
const proposed = lab.rows && kept.length ? { ...ch, peq: ch.peq.map((old, i) => bands[i] || { ...old, gain: 120, bypass: false }) } : null;
const canvas = h("canvas", { class: "labcurve" });
requestAnimationFrame(() => drawCurve(canvas, ch, -1, { mode: "mag", overlays: proposed ? [{ ch: proposed, color: "#f59e0b" }] : [] }));
const apply = () => {
proposed.peq.forEach((b, i) => setParam(kind, idx, `peq.${i}`, b));
toast(t("{n} filters applied to {ch}", { n: bands.length, ch: name }));
lab.rows = null; render();
};
const warn = [...new Set(kept.flatMap(r => r.notes))];
if (cut > 0) warn.push(t("{cut} filters left out: this channel has {n} bands", { cut, n }));
if (skipped > 0) warn.push(t("{n} filters skipped: type not available on the DSP", { n: skipped }));
const proposal = lab.rows ? h("div", { class: "labprop" }, h("div", { class: "sub" }, lab.from),
kept.length ? h("table", { class: "rewtable" },
h("tr", {}, ["", t("Type"), t("Frequency"), "Gain", "Q"].map(x => h("th", {}, x))),
kept.map((r, i) => h("tr", { class: r.band.bypass ? "off" : "" }, h("td", {}, String(i + 1)), h("td", {}, PEQ_SHORT[r.band.type]), h("td", {}, fmtHz(freqHz(r.band.freq))),
h("td", {}, hasGain(r.band.type) ? `${sign(eqDb(r.band.gain))} dB` : "–"), h("td", {}, hasQ(r.band.type) ? String(Q_TABLE[r.band.q]) : "–"))))
: h("p", { class: "info" }, t("No usable filters found.")),
warn.length ? h("p", { class: "rewwarn" }, warn.join(" · ")) : null,
h("div", { class: "row" },
kept.length && !viewOnly() ? h("button", { class: "on", onclick: apply }, t("Apply to {ch}", { ch: name })) : null,
h("button", { "data-view-ok": "", onclick: () => { lab.rows = null; render(); } }, t("Discard")))) : null;
const on = !!lab.rew, has = on && lab.rew.meas.length > 0;
const measSel = h("select", { "aria-label": t("Measurement"), disabled: !has, "data-view-ok": "", onchange: e => { lab.measId = e.target.value; } },
has ? lab.rew.meas.map(m => h("option", { value: m.id, selected: m.id === lab.measId }, m.title)) : h("option", { value: "" }, on ? t("No measurements in REW") : "–"));
const take = async () => {
try { labTake(await api("POST", "/api/rew/filters", { id: lab.measId }), measName()); }
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
};
const sendFilters = async () => {
try {
await api("POST", "/api/rew/send-filters", { id: lab.measId, filters: ch.peq.map(rewFromBand).filter(x => (x.type === "PK" ? x.gaindB !== 0 : true)) });
toast(t("Filters sent to “{m}”", { m: measName() }));
} catch (e) { toast(t("Error: ") + trMsg(e.message)); }
};
const sendCurve = async () => {
try { await api("POST", "/api/rew/send-curve", rewCurve(d, kind, idx)); toast(t("Curve sent to REW as a new measurement")); labCheck(); }
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
};
return [
h("div", { class: "dhead" }, h("h2", {}, "Sound Lab"),
h("div", { class: "row labstate" },
h("span", { class: "dot " + (on ? "online" : "disconnected") }),
h("span", { class: "info" }, on ? t("REW {v} · {n} measurements", { v: lab.rew.version, n: lab.rew.meas.length }) : t("REW not connected")),
h("button", { class: "small", "data-view-ok": "", onclick: labCheck }, t("Check")),
docButton(DOC_LAB))),
h("div", { class: "cards labcards" },
h("div", { class: "card wide" }, h("div", { class: "firchs" }, chans(d, "in").map((_, i) => chip("in", i)), h("span", { class: "firsep" }), chans(d, "out").map((_, i) => chip("out", i)))),
h("div", { class: "card wide" }, h("h3", {}, h("span", { class: "grow" }, name), proposed ? h("span", { class: "lablegend" }, h("i", { style: "background:#38bdf8" }), t("now"), h("i", { style: "background:#f59e0b" }), t("after applying")) : null), canvas),
h("div", { class: "card" }, h("h3", {}, t("From REW to this channel")),
on ? null : h("p", { class: "info" }, t("REW can't be reached. Start REW on the computer running this app and switch on its API (Preferences → API). The filter file works anyway.")),
h("div", { class: "row" }, measSel, h("button", { disabled: !has, "data-view-ok": "", onclick: take }, t("Take filters"))),
h("div", { class: "row" }, h("button", { "data-view-ok": "", onclick: labFromFile }, t("Load REW filter file…"))),
proposal),
h("div", { class: "card" }, h("h3", {}, t("From this channel to REW")),
h("p", { class: "info" }, t("As a measurement you can compare the channel's curve with real measurements in REW. Filters on a measurement let REW predict the result.")),
h("div", { class: "row" }, h("button", { disabled: !on, "data-view-ok": "", onclick: sendCurve }, t("Send curve as a new measurement"))),
h("div", { class: "row" }, h("button", { disabled: !has, "data-view-ok": "", onclick: sendFilters }, t("Send filters to the chosen measurement"))))),
];
}
+1 -1
View File
@@ -664,7 +664,7 @@ function viewSoundField() {
return h("div", { class: "sflayout" },
h("div", { class: "card sfmain" },
h("div", { class: "sfbar" },
h("h3", {}, "SoundField"),
h("h3", {}, "SoundField", docButton(DOC_SF)),
h("div", { class: "sfadd" }, addBtn("top12", "main", t("Main")), addBtn("sub18", "sub", "Sub"),
h("button", { class: "small", title: t("Sub with a top on a distance pole"), onclick: () => sfChange(q => {
const n = q.speakers.filter(x => x.role === "sub").length + 1, x = clamp(q.room.w / 2 + (n - 1) * 1.5, 0, q.room.w), y = Math.min(q.room.d, q.stage.d + 0.5);
+33 -4
View File
@@ -775,7 +775,7 @@ input[type=range].haslim::-moz-range-track {
canvas.fircurve { display: block; width: 100%; height: 240px; background: var(--bg2); border-radius: 8px; }
/* ---- dashboard */
.dhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px; }
.dhead h2 { margin: 0; font-size: 20px; }
.dhead h2 { margin: 0; font-size: 20px; white-space: nowrap; }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 30px; grid-auto-flow: dense; gap: 10px; align-items: stretch; }
.dmod { min-width: 0; display: flex; flex-direction: column; }
.dmod[hidden] { display: none; }
@@ -907,6 +907,35 @@ body.locked #main input[type=range] { pointer-events: none; }
@keyframes splashtext { from { opacity: 0; transform: translateY(5px); } }
@keyframes splashout { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #splash.show { display: none; } }
.vkmark { flex: none; margin-left: -4px; font-size: 10px; letter-spacing: .1em; color: var(--dim); white-space: nowrap; }
.vkfoot { display: block; margin: 18px 0 6px; text-align: center; font-size: 11px; letter-spacing: .14em; color: var(--dim); }
@media (max-width: 759px) { .vkmark { display: none; } }
.vkfoot { margin: 14px 0 4px; text-align: center; font-size: 10px; letter-spacing: .14em; color: var(--dim); opacity: .45; }
/* ---- note at the end of the settings */
.disclaimer { display: flex; align-items: flex-start; gap: 10px; max-width: 720px; margin: 22px auto 0; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
border-radius: 10px; background: color-mix(in srgb, var(--warn) 5%, transparent); }
.disclaimer svg { flex: none; width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: var(--warn); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.disclaimer p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--dim); }
.disclaimer b { color: var(--text); font-weight: 600; }
/* ---- Sound Lab */
.labstate { flex-wrap: nowrap; gap: 6px; align-items: center; min-width: 0; }
.labstate .info { margin: 0 4px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
canvas.labcurve { display: block; width: 100%; height: 240px; background: var(--bg2); border-radius: 8px; }
.lablegend { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 400; color: var(--dim); text-transform: none; letter-spacing: 0; }
.lablegend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-left: 8px; }
.labcards .card > .row { margin-top: 8px; flex-wrap: wrap; }
.labcards .card > .row select { flex: 1; min-width: 150px; }
.labprop { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.labprop .sub { flex: none !important; }
.rewtable { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.rewtable th { color: var(--dim); font-weight: 500; text-align: left; }
.rewtable th, .rewtable td { padding: 2px 14px 2px 0; }
.rewtable tr.off td { opacity: .45; }
.rewwarn { margin: 0; padding: 6px 9px; border-radius: 7px; font-size: 12px; color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, transparent); }
/* ---- handbook */
.docbtn { flex: none; width: 28px; min-width: 28px; height: 28px; min-height: 28px; padding: 0; margin-left: 4px; color: var(--dim); }
.docbtn:hover { color: var(--accent); }
.docbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.docbody { width: min(600px, 82vw); max-height: 62vh; overflow-y: auto; padding-right: 6px; font-size: 13px; line-height: 1.5; }
.docbody section + section { margin-top: 16px; }
.docbody h4 { margin: 0 0 5px; font-size: 14px; color: var(--text); }
.docbody p { margin: 5px 0 0; color: var(--dim); }
.docbody ol { margin: 0; padding-left: 20px; }
.docbody li { margin: 3px 0; }