Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e7f9eaeda | ||
|
|
c19ad62b91 | ||
|
|
4a6eb2f513 | ||
|
|
63b3c17fb7 | ||
|
|
4cd771eb5c | ||
|
|
6d467d4f2d | ||
|
|
bbe8a73775 | ||
|
|
29a89af562 | ||
|
|
6d53069380 | ||
|
|
cf35a1faa1 | ||
|
|
99613327f8 | ||
|
|
a639abf216 | ||
|
|
fc0322cbc9 | ||
|
|
7932ef62c7 | ||
|
|
28624caead | ||
|
|
910cf3fc17 | ||
|
|
d6be627f32 | ||
|
|
8919f0016c | ||
|
|
e56524a8cd | ||
|
|
3ce0334aea | ||
|
|
2fbb5e7424 | ||
|
|
5c391d932c | ||
|
|
a75b803264 | ||
|
|
5f0f893810 | ||
|
|
f043e1a261 | ||
|
|
9203cab4df | ||
|
|
a754021381 | ||
|
|
14ca3aec4b | ||
|
|
144f62f240 | ||
|
|
a02e5dd53e | ||
|
|
9e2636c6d6 | ||
|
|
fe24b620bf | ||
|
|
3a9059d420 | ||
|
|
763a8781f4 | ||
|
|
9c6d2d6e35 | ||
|
|
43def4480c | ||
|
|
24674fb8c0 | ||
|
|
682e734257 | ||
|
|
967191f2f7 | ||
|
|
936d7f64a9 | ||
|
|
b82a6b90c6 | ||
|
|
2ea9fa32bc | ||
|
|
5597fae3f3 | ||
|
|
f7d5e22bb0 | ||
|
|
86ee492ec3 | ||
|
|
0a1f282c63 | ||
|
|
4b33fc2665 | ||
|
|
83548c9620 | ||
|
|
cc95e2ccd8 | ||
|
|
dc355fa160 | ||
|
|
06bc767f2c | ||
|
|
52695d20a5 | ||
|
|
52ecff85ce | ||
|
|
9473fc9eca | ||
|
|
5fc745cd72 | ||
|
|
cf0adc01fe | ||
|
|
3a85f62225 | ||
|
|
f87e6cad70 | ||
|
|
eb647f62a9 | ||
|
|
a7ee66d761 | ||
|
|
ffb6c05d47 | ||
|
|
58492e985f | ||
|
|
96640c5bff | ||
|
|
ae9a20fdf8 | ||
|
|
66f988cf08 | ||
|
|
61400df667 |
No files matched your search
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.0.1",
|
|
||||||
"configurations": [
|
|
||||||
{"name": "sim-204", "runtimeExecutable": "python", "runtimeArgs": ["sim.py", "--model", "204", "--port", "9761"], "port": 9761},
|
|
||||||
{"name": "sim-408", "runtimeExecutable": "python", "runtimeArgs": ["sim.py", "--model", "408", "--port", "9762"], "port": 9762},
|
|
||||||
{"name": "webui", "runtimeExecutable": "python", "runtimeArgs": ["server.py", "--port", "8080"], "port": 8080}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -12,4 +12,4 @@ __pycache__/
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# personal Claude Code settings
|
# personal Claude Code settings
|
||||||
.claude/settings.local.json
|
.claude/
|
||||||
@@ -17,7 +17,7 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
|
|||||||
backups. Config is one JSON file (`config.json`, gitignored) – `load()` / `apply_config()` / `save()`.
|
backups. Config is one JSON file (`config.json`, gitignored) – `load()` / `apply_config()` / `save()`.
|
||||||
* **Auth** – 4-digit PIN, PBKDF2 hash in `config.json`, session cookie `dspsess` (30 days), lockout after 5 failures.
|
* **Auth** – 4-digit PIN, PBKDF2 hash in `config.json`, session cookie `dspsess` (30 days), lockout after 5 failures.
|
||||||
The desktop app logs in via `/app-login?t=<one-time token>`; app sessions live in memory only, skip the PIN and may
|
The desktop app logs in via `/app-login?t=<one-time token>`; app sessions live in memory only, skip the PIN and may
|
||||||
toggle remote access (`/api/remote`) and the lock (`/api/lock`, server answers 423 while locked). Remote clients
|
toggle remote access (`/api/remote`) and the lock (`/api/lock`, server answers 423 while locked; with `lock_dash` the window shows only the dashboard). Remote clients
|
||||||
always need the PIN.
|
always need the PIN.
|
||||||
* **`dsp/device.py`** – one `Device` per DSP: connect (TCP or `usbhid.open_stream`), handshake, config dump
|
* **`dsp/device.py`** – one `Device` per DSP: connect (TCP or `usbhid.open_stream`), handshake, config dump
|
||||||
(50-byte chunks), command queue (one request in flight), meter polling (also keepalive), auto-reconnect.
|
(50-byte chunks), command queue (one request in flight), meter polling (also keepalive), auto-reconnect.
|
||||||
@@ -25,6 +25,52 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
|
|||||||
* **`dsp/protocol.py`** – frames, checksum, value scales, model layouts (`MODELS["204"|"408"]`), memory image ↔ state
|
* **`dsp/protocol.py`** – frames, checksum, value scales, model layouts (`MODELS["204"|"408"]`), memory image ↔ state
|
||||||
dict (`parse_state` / `build_state_buffer`), parameter → command (`param_command`), link masks, meter/limiter decoding.
|
dict (`parse_state` / `build_state_buffer`), parameter → command (`param_command`), link masks, meter/limiter decoding.
|
||||||
State values are **raw device values**; conversion to dB/Hz/ms happens in the UI (`SPEC` in `app.js`).
|
State values are **raw device values**; conversion to dB/Hz/ms happens in the UI (`SPEC` in `app.js`).
|
||||||
|
Channels also carry `peq_bypass` (master bypass, `0x3C`) and inputs `geq_bypass` (`0x49`), stored as bit masks at
|
||||||
|
the end of the memory image.
|
||||||
|
* **EQ curve** (`app.js`, `drawCurve`) – complex response per section: PEQ bands as RBJ biquads at 96 kHz, crossover
|
||||||
|
filters from analog prototypes (Butterworth poles, Bessel polynomial normalised to −3 dB, Linkwitz-Riley =
|
||||||
|
Butterworth²). Mag/Phase view (`dsp.curve` in localStorage), overlays of other channels (`dsp.overlay.<device>`).
|
||||||
|
How exactly the DSP realises the Bessel and crossover filters is not verified – the curves are the textbook ones.
|
||||||
|
* **Audio test** – `App.audio_test` / `set_test_level` / `check_audio_test` in `server.py`: entering saves the output
|
||||||
|
gains (`Device.test_saved`, persisted in `config.json` so an interrupted test is undone on the next connect),
|
||||||
|
lowers every output to −50 dB, flushes the queue and only then starts the generator (`0x39`); leaving switches the
|
||||||
|
generator off first, then restores the gains. While `Device.test_active` the server only accepts the test
|
||||||
|
controls (generator, test fader, output mutes) and the UI stays locked in the audio test tab. The state field is `state["test"] = {source, freq}`.
|
||||||
|
* **SoundField** (`static/soundfield.js`, plan stored by the server as `soundfield` in `config.json`, API
|
||||||
|
`/api/soundfield`) – room plan in metres (x across, y from the stage wall, aim 0° = into the room). Free-field model:
|
||||||
|
−6 dB per distance doubling, directivity from the coverage angle (−6 dB at its edges), tops summed by energy, subs
|
||||||
|
with phase at the chosen frequency. Delays: mains/subs aligned at the reference point, delay/fill speakers at their
|
||||||
|
target point plus the precedence offset. The canvas is only redrawn while dragging (never rebuilt), the side panels
|
||||||
|
are rebuilt after a change; the local plan object stays the one being edited (a save does not replace it).
|
||||||
|
* **Max level** – `Device.maxgain` (raw gain per channel, app-side) and `Device.gain_cap`: every gain the server sets
|
||||||
|
(API, test fader, copy) is capped at max(limit, current value), so a DSP turned up on the device can only go down
|
||||||
|
until it is below the limit again. The client mirrors this in `gainCap` (faders, sliders, `setParam`).
|
||||||
|
* **Link group names** – `Device.linknames` (app-side, like the colours), keyed by kind and members (`"out:0,1"`), so a
|
||||||
|
changed group starts without a name. The mixer draws them as brackets in row 1 of the `.strips` grid (`linkBands`).
|
||||||
|
* **FIR tab** (`viewFir`, only `d.fir`) – outputs: `0x4B` type/window/cut-offs/taps index, the DSP calculates the filter;
|
||||||
|
the curve is the app's own windowed sinc. Files: `Device.upload_fir` (`0x5B` name, `0x4E` packets of 12 floats). The DSP
|
||||||
|
can't send coefficients back, so the curve of a file only exists in the session (`S.firCoef`).
|
||||||
|
* **Dashboard** (`static/dashboard.js`, stored as `dashboard` in `config.json`, API `/api/dashboard`, `clean_dashboard`) –
|
||||||
|
grid of 12 columns and rows of 40 px, modules in `DASH_MODULES` with `body(m, d)` and `min`/`max` `[columns, rows]`. Must stay read-only: no `setParam` or POST to a device
|
||||||
|
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; so Sound Lab is only in the desktop apps (`S.isApp`, the server refuses `/api/rew/` otherwise). Only checked against a fake server built from its OpenAPI spec.
|
||||||
|
Pictures of the handbooks: `static/docimg/<name>.<lang>.jpg`, one per language, only ever from this app itself.
|
||||||
|
* **DJ Brake** (`static/djbrake.html`, `App.dj_note`, `App.dj_state`) – the only page without a login, off by default. It may only ever
|
||||||
|
learn `{on, ready, hint}` from `/djbrake/state`: never add device data or controls there. On its own on purpose, without `app.js`.
|
||||||
|
It only follows the DSP's limiter bits. A distance to the limiter was tried and dropped: see the measurement in `PROTOCOL.md`.
|
||||||
|
Its settings sit in the access section; in the apps it needs remote access, since the app itself only listens on 127.0.0.1.
|
||||||
|
* **Preset looks** – `Device.looks` keeps `colors`/`linknames` per preset name; `sync_look` swaps them whenever a read of the DSP
|
||||||
|
shows another name (the DSP has no preset IDs: same name = same look), a preset without a look starts empty. Preset files carry them as `look`.
|
||||||
|
* **Reset** (`App.reset_config`, `POST /api/reset`, app window only, never remote) – stops all devices before anything else and sends them nothing, then defaults from
|
||||||
|
a fresh `App`. Refused during an audio test or mute all, because the DSP would stay changed. Keeps `config.before-reset.json`.
|
||||||
|
* **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
|
||||||
|
`App.set_mute_all` (`POST /api/muteall`; remembers per device which channels were open, persisted in `config.json`
|
||||||
|
as `mute_all`, released devices that were offline are unmuted when they reconnect; allowed while the app is locked).
|
||||||
* **`dsp/preset.py`** – preset files (`dsp-control-preset` JSON with state + raw image), validation, and the minimal
|
* **`dsp/preset.py`** – preset files (`dsp-control-preset` JSON with state + raw image), validation, and the minimal
|
||||||
command sequence for an import. Undo backups go to `backups/` next to `config.json` (last 20 per device).
|
command sequence for an import. Undo backups go to `backups/` next to `config.json` (last 20 per device).
|
||||||
* **`dsp/usbhid.py`** – HID via ctypes only: Windows `hid.dll`/SetupAPI, macOS IOKit, Linux `/dev/hidraw*`.
|
* **`dsp/usbhid.py`** – HID via ctypes only: Windows `hid.dll`/SetupAPI, macOS IOKit, Linux `/dev/hidraw*`.
|
||||||
@@ -33,7 +79,14 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
|
|||||||
current view (`mixer`, `channel`, `routing`, `link`, `limiter`, `settings`). Live widgets register in `live` and are
|
current view (`mixer`, `channel`, `routing`, `link`, `limiter`, `settings`). Live widgets register in `live` and are
|
||||||
updated without a full redraw. **All UI text goes through `t("English text", {vars})`**; German lives in
|
updated without a full redraw. **All UI text goes through `t("English text", {vars})`**; German lives in
|
||||||
`static/i18n.js` (`DE`, plus `DE_PATTERNS` for server messages with variables, applied by `trMsg()`).
|
`static/i18n.js` (`DE`, plus `DE_PATTERNS` for server messages with variables, applied by `trMsg()`).
|
||||||
* **`sim.py`** – simulated DSP 204/408 speaking the same protocol (meters, limiter flags, links). Use it for all tests.
|
* **`sim.py`** – simulated DSP 204/408 speaking the same protocol (meters, limiter flags, links, lock code via
|
||||||
|
`--lock`). Use it for all tests. The server also imports it for the **demo mode** (`App.start_demo`: real
|
||||||
|
devices are stopped, a `SimDSP` runs on a random localhost port, a `Device` with `demo = True` connects to it;
|
||||||
|
demo devices are never saved, exported or editable). `sim.py` therefore ships with the Pi image and the EXEs.
|
||||||
|
* **Device lock** (hardware, unrelated to the app lock) – `Device._wait_for_unlock` holds the init after `0x2C`
|
||||||
|
reports a lock, tries the remembered code (`lock_code` + `auto_unlock` in `config.json`, clients only see a
|
||||||
|
boolean) or sets status `locked` and waits for `POST /api/devices/<id>/unlock {code, remember}`.
|
||||||
|
`POST …/lockcode {code}` sets a new code.
|
||||||
* **`desktop.py`** – starts `server.App` on 127.0.0.1 with a random port in a thread and opens a pywebview window.
|
* **`desktop.py`** – starts `server.App` on 127.0.0.1 with a random port in a thread and opens a pywebview window.
|
||||||
`Api` exposes native file dialogs to the page (`window.pywebview.api.save_file/open_file`). Single instance via a
|
`Api` exposes native file dialogs to the page (`window.pywebview.api.save_file/open_file`). Single instance via a
|
||||||
named mutex (Windows) or lock file (macOS). Data in `%APPDATA%\DSP Control` / `~/Library/Application Support/DSP Control`.
|
named mutex (Windows) or lock file (macOS). Data in `%APPDATA%\DSP Control` / `~/Library/Application Support/DSP Control`.
|
||||||
@@ -62,6 +115,8 @@ python sim.py --model 408 --port 9762
|
|||||||
python server.py --port 8080 --config <some temp file>.json
|
python server.py --port 8080 --config <some temp file>.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`tools/dsp_measure.py` measures on real hardware how meter, gain, threshold and limiter relate (lowers only, restores itself).
|
||||||
|
|
||||||
Log in with PIN `1234`, add devices `127.0.0.1:9761` / `:9762`. Check both languages after UI changes (⚙ →
|
Log in with PIN `1234`, add devices `127.0.0.1:9761` / `:9762`. Check both languages after UI changes (⚙ →
|
||||||
Language / Sprache). For the desktop app run `python desktop.py` (needs `pywebview`).
|
Language / Sprache). For the desktop app run `python desktop.py` (needs `pywebview`).
|
||||||
|
|
||||||
@@ -75,10 +130,22 @@ and the DSP's own mirroring inside groups, limiter-active bit mask, preset impor
|
|||||||
|
|
||||||
Not verified yet – ask for a log (`python server.py -v`) from real hardware before changing protocol code here:
|
Not verified yet – ask for a log (`python server.py -v`) from real hardware before changing protocol code here:
|
||||||
|
|
||||||
* **DSP 408 on real hardware** (layout and frames match published captures, limiter bits for Out 5–8 assumed)
|
* **Beta models** `206` and `408fir` – never seen on real hardware. Never auto-detected (`detect_model`, a FIR device
|
||||||
|
must not pass as a 408); the only hint is the note in the add-device form, afterwards they work like the others.
|
||||||
|
`206`: same protocol and layout as the 204/408 are only assumed (no control software looked at), also the USB ID.
|
||||||
|
`408fir`: own layout and commands derived from its control software (`Model.fir`, `_parse_fir`, `_fir_command`), simulator
|
||||||
|
only. Not done: dynamic EQs (kept untouched), saving coefficients into a preset slot of the DSP (`0x5A`, format
|
||||||
|
not worked out), where it keeps the test signal (the app remembers it). Ask testers for a preset export and a log.
|
||||||
|
* **DSP 408 on real hardware**: briefly tried by the maintainer and seemed to work, not tested in depth (layout and frames
|
||||||
|
match published captures, limiter bits for Out 5–8 assumed)
|
||||||
* USB on Windows and Linux against a real DSP (only tested against a fake HID device)
|
* USB on Windows and Linux against a real DSP (only tested against a fake HID device)
|
||||||
* Where the PEQ bypass flag lives in the memory image; format of the set-command acknowledgement; payload of the
|
* Where the PEQ bypass flag lives in the memory image; format of the set-command acknowledgement; where the number
|
||||||
preset-count answer (`0x2C`)
|
of preset slots comes from (20 is assumed when the `0x2C` answer carries the lock state)
|
||||||
|
* Master bypass commands `0x3C` / `0x49` and their bit masks – from the control software, simulator only
|
||||||
|
* Test signal command `0x39` and its position in the memory image – derived from the control software, simulator
|
||||||
|
only; whether the generator is pre or post input gain is unknown (the app therefore only lowers the outputs)
|
||||||
|
* Device lock (`0x2C` byte 5, `0x2D`, `0x2F`, `0x11`) – implemented from the control software's behaviour and
|
||||||
|
tested against the simulator only; no command to remove a lock is known
|
||||||
* Limiter calculator reference level (assumes limiter 0 dB = 0 dBu at the output; adjustable per device)
|
* Limiter calculator reference level (assumes limiter 0 dB = 0 dBu at the output; adjustable per device)
|
||||||
* Pi Writer: raw write to a real SD card and first boot on a real Pi (only tested with an image file)
|
* Pi Writer: raw write to a real SD card and first boot on a real Pi (only tested with an image file)
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ All 16-bit words are little endian.
|
|||||||
|-----|-----------|---------|---------|
|
|-----|-----------|---------|---------|
|
||||||
| `10` | → | – | Handshake |
|
| `10` | → | – | Handshake |
|
||||||
| `13` | → / ← | – / ASCII | Device info, answer starts with `DSP204` or `DSP408` |
|
| `13` | → / ← | – / ASCII | Device info, answer starts with `DSP204` or `DSP408` |
|
||||||
| `2C` | → / ← | – / `[?][count]` | Number of presets (payload meaning partly *assumed*) |
|
| `2C` | → / ← | – / `[time lock][4 bytes][device lock]` | Lock state, see [Device lock](#device-lock) |
|
||||||
| `22`, `14` | → | – | Init queries (sent during connect, content unknown) |
|
| `22`, `14` | → | – | Init queries (sent during connect, content unknown) |
|
||||||
| `29` | → / ← | `[idx]` / `[idx][name…]` | Preset name (idx 0-based) |
|
| `29` | → / ← | `[idx]` / `[idx][name…]` | Preset name (idx 0-based) |
|
||||||
| `20` | → | `[idx+1]` | Recall preset |
|
| `20` | → | `[idx+1]` | Recall preset |
|
||||||
@@ -45,6 +45,9 @@ All 16-bit words are little endian.
|
|||||||
| `27` | → | `[chunk]` | Request config chunk |
|
| `27` | → | `[chunk]` | Request config chunk |
|
||||||
| `24` | ← | `[chunk][50 bytes]` | Config chunk; 204: chunks 0…14, 408: 0…28 |
|
| `24` | ← | `[chunk][50 bytes]` | Config chunk; 204: chunks 0…14, 408: 0…28 |
|
||||||
| `12` | → | – | Status (sent after the dump) |
|
| `12` | → | – | Status (sent after the dump) |
|
||||||
|
| `2D` | → / ← | `[0][code 4]` / `[0][result]` | Unlock with the lock code, result `1` = unlocked, `0` = wrong code |
|
||||||
|
| `2F` | → | `[code 4]` | Set a new lock code |
|
||||||
|
| `11` | → | – | Sent after setting a lock code (meaning not fully known) |
|
||||||
| `40` | → / ← | – / meters | Read levels (also serves as keepalive) |
|
| `40` | → / ← | – / meters | Read levels (also serves as keepalive) |
|
||||||
|
|
||||||
### Meter answer
|
### Meter answer
|
||||||
@@ -53,10 +56,15 @@ All 16-bit words are little endian.
|
|||||||
|
|
||||||
* Level = float32 from the bytes `00 b2 b0 b1` (little endian) → linear, dB = 20·log10.
|
* Level = float32 from the bytes `00 b2 b0 b1` (little endian) → linear, dB = 20·log10.
|
||||||
* Positions: 0–3 = In A–D, 4–11 = Out 1–8. The 204 uses 0, 1 and 4–7.
|
* Positions: 0–3 = In A–D, 4–11 = Out 1–8. The 204 uses 0, 1 and 4–7.
|
||||||
* The level is measured before mute.
|
* The level is measured before mute and after the output gain (one DSP 204: -6 dB gain moved it by -6.3 dB against the input).
|
||||||
|
* The level is far below the limiter threshold's scale. One DSP 204 (V0104P), one output, one piece of music: when the limiter
|
||||||
|
starts, threshold minus the loudest level read is 26 dB (25.1 to 27.7 in five rounds, the same with -6 dB gain). How much of
|
||||||
|
that is a fixed offset and how much are peaks between the readings is not separated. Whether the level is before or after
|
||||||
|
the limiter is open: 6 dB below the start of limiting it fell only 0.9 dB against the input.
|
||||||
* **Limiter active**: the status bytes are a bit mask of the outputs (bit 0 = Out 1). Measured on a DSP 204:
|
* **Limiter active**: the status bytes are a bit mask of the outputs (bit 0 = Out 1). Measured on a DSP 204:
|
||||||
`00 03` while Out 1+2 limit, `00 0C` for Out 3+4. That Out 5–8 of the 408 continue in the same 16-bit value
|
`00 03` while Out 1+2 limit, `00 0C` for Out 3+4. That Out 5–8 of the 408 continue in the same 16-bit value
|
||||||
is *assumed*.
|
is *assumed*. The bit does not simply follow the level: it stayed on for 4 s, in two of six cases also after the threshold had
|
||||||
|
been raised to +20 dB, and went off within 0.2 s in others. Why is not known.
|
||||||
|
|
||||||
## Channel numbers
|
## Channel numbers
|
||||||
|
|
||||||
@@ -84,6 +92,9 @@ All 16-bit words are little endian.
|
|||||||
| `41` | Mix level (outputs) | `[ch][input][u16 level]` |
|
| `41` | Mix level (outputs) | `[ch][input][u16 level]` |
|
||||||
| `3D` | Channel name | `[ch][name 8]` (printable ASCII) |
|
| `3D` | Channel name | `[ch][name 8]` (printable ASCII) |
|
||||||
| `3B` | Link | `[ch][u16 link mask]` (see [Channel links](#channel-links)) |
|
| `3B` | Link | `[ch][u16 link mask]` (see [Channel links](#channel-links)) |
|
||||||
|
| `3C` | PEQ bypass | `[ch][0/1]` – all PEQ bands of the channel bypassed |
|
||||||
|
| `49` | GEQ bypass (inputs) | `[ch][0/1]` |
|
||||||
|
| `39` | Test signal | `[source][freq]` – source 0 = analog inputs, 1 = pink noise, 2 = white noise, 3 = sine; freq = index 0–30 of the 1/3-octave frequencies 20 Hz…20 kHz (as the GEQ) |
|
||||||
| `15` | Delay unit | `[unit]` (display only) |
|
| `15` | Delay unit | `[unit]` (display only) |
|
||||||
|
|
||||||
The format of the acknowledgement the DSP sends after a set command is not fully understood yet.
|
The format of the acknowledgement the DSP sends after a set command is not fully understood yet.
|
||||||
@@ -126,6 +137,20 @@ or within the outputs):
|
|||||||
* A member with mask `00` that is not part of a group ignores changes: when unlinking, give every channel its own
|
* A member with mask `00` that is not part of a group ignores changes: when unlinking, give every channel its own
|
||||||
bit again.
|
bit again.
|
||||||
|
|
||||||
|
## Device lock
|
||||||
|
|
||||||
|
The DSP can be protected with a 4-character code (digits and upper-case letters, e.g. `A1BA`, sent as ASCII).
|
||||||
|
|
||||||
|
* During connect, the answer to `2C` reports the lock state: byte 5 ≠ 0 means the device is locked. Byte 0 and
|
||||||
|
bytes 1–4 belong to a separate time-based lock that this app does not use.
|
||||||
|
* A locked device waits for `2D [00][code]` before the rest of the initialisation (`22`, `14`, preset names, dump).
|
||||||
|
The answer `2D [00][01]` means unlocked, `2D [00][00]` wrong code.
|
||||||
|
* `2F [code]` stores a new code; the control software sends `11` afterwards. The device asks for the new code from
|
||||||
|
the next connection on. A command to remove the lock is not known.
|
||||||
|
|
||||||
|
Status: derived from the behaviour of the control software and implemented against the simulator; **not yet
|
||||||
|
verified on a real device**.
|
||||||
|
|
||||||
## Config dump = memory image
|
## Config dump = memory image
|
||||||
|
|
||||||
Chunk `n` carries bytes `n·50 … n·50+49` of the device memory image.
|
Chunk `n` carries bytes `n·50 … n·50+49` of the device memory image.
|
||||||
@@ -149,7 +174,12 @@ Chunk `n` carries bytes `n·50 … n·50+49` of the device memory image.
|
|||||||
… comp: ratio, attack, release, knee, threshold (5×u16)
|
… comp: ratio, attack, release, knee, threshold (5×u16)
|
||||||
… limit: attack, release, knee, threshold (4×u16)
|
… limit: attack, release, knee, threshold (4×u16)
|
||||||
… u16 gain, u16 polarity, u16 delay, u16 link mask
|
… u16 gain, u16 polarity, u16 delay, u16 link mask
|
||||||
u16 input mute bit mask, u16 output mute bit mask, then unknown fields
|
u16 input mute bit mask, u16 output mute bit mask
|
||||||
|
u16[nIn + nOut] unknown
|
||||||
|
u16 test signal source, u16 test signal frequency index (see command 39)
|
||||||
|
u16 unknown
|
||||||
|
u16 PEQ bypass bit mask inputs, u16 PEQ bypass bit mask outputs (command 3C)
|
||||||
|
u16 GEQ bypass bit mask inputs (command 49)
|
||||||
```
|
```
|
||||||
|
|
||||||
Total size: DSP 204 = 724 bytes (15 chunks), DSP 408 = 1448 bytes (29 chunks).
|
Total size: DSP 204 = 724 bytes (15 chunks), DSP 408 = 1448 bytes (29 chunks).
|
||||||
@@ -161,3 +191,31 @@ Where the PEQ bypass flag is stored in the image is not known yet.
|
|||||||
* Send: report ID `00` + one complete frame (`10 02 … 10 03 CHK`), zero-padded to the output report length.
|
* Send: report ID `00` + one complete frame (`10 02 … 10 03 CHK`), zero-padded to the output report length.
|
||||||
* Receive: every input report holds exactly one frame starting at byte 0, length = `LEN + 8`, then padding.
|
* Receive: every input report holds exactly one frame starting at byte 0, length = `LEN + 8`, then padding.
|
||||||
* The frames are identical to TCP; the longest (config chunk, 50 data bytes) is 60 bytes and fits a 64-byte report.
|
* The frames are identical to TCP; the longest (config chunk, 50 data bytes) is 60 bytes and fits a 64-byte report.
|
||||||
|
|
||||||
|
## FIR DSP 408 (unverified)
|
||||||
|
|
||||||
|
Derived from the behaviour of its control software, not yet seen on a device. Same frames; device info starts with
|
||||||
|
`FIR408`. The memory image has 1573 bytes (32 chunks) and its own layout:
|
||||||
|
|
||||||
|
| Offset | Content |
|
||||||
|
|---|---|
|
||||||
|
| `0x010` + 138·n | Input: name 8, gate 4×u16, 3 dynamic EQs of 16 bytes, 8 PEQ bands of 6 bytes, compressor (ratio, attack, release, knee, threshold, EQ frequency as u16, 2 bytes), FIR taps u16, FIR bypass u16, gain, polarity, delay, link |
|
||||||
|
| `0x238` + 108·n | Output: name 8, matrix u16, mix 4×u16, u16, HP frequency u16, LP frequency u16, HP slope, LP slope, HP bypass, LP bypass (bytes), FIR type, window (bytes), low Hz, high Hz, taps index (u16), 9 PEQ bands, limiter (ratio, attack, release, knee, threshold), gain, polarity, delay, link |
|
||||||
|
| `0x598` | Mute masks: inputs u16, outputs u16 |
|
||||||
|
| `0x59C` | Bypassed PEQ bands, u16 bit mask per channel (inputs, then outputs) |
|
||||||
|
| `0x5B4` | FIR name per channel, 8 characters each |
|
||||||
|
|
||||||
|
No GEQ on this model, no master bypass commands. Slope index without the "bypass" entry (0 = BW -6). Changed commands:
|
||||||
|
|
||||||
|
| Cmd | Payload |
|
||||||
|
|---|---|
|
||||||
|
| `0x31` / `0x32` | `[ch][u16 freq][slope][1 = bypass]` |
|
||||||
|
| `0x30` | `[ch]` ratio, attack, release, knee, threshold, EQ frequency as u16, `[EQ type][EQ bypass]` (inputs) |
|
||||||
|
| `0x3F` | `[ch]` ratio, attack, release, knee, threshold as u16 |
|
||||||
|
| `0x4B` | `[ch][type][window][u16 low Hz][u16 high Hz][u16 taps index]`, outputs. Type: bypass, low, high, band, external. Window: rectangle, Bartlett, Hanning, Hamming, Blackman, sine, sinc, Nuttall, Kaiser, Blackman-Nuttall, Blackman-Harris. Taps = 256 + 32·index |
|
||||||
|
| `0x4E` | `[ch][packet][u16 total]` + up to 12 floats, most significant byte first |
|
||||||
|
| `0x4F` | `[ch][1 = bypass]`, inputs |
|
||||||
|
| `0x5B` | `[ch]` + 8 characters of FIR name |
|
||||||
|
|
||||||
|
At most 2048 coefficients per input, 1024 per output, 4096 over all channels.
|
||||||
|
|
||||||
@@ -1,45 +1,149 @@
|
|||||||
# BetterDSPControl
|
# BetterDSPControl
|
||||||
|
|
||||||
**A modern, phone-friendly control app for the t.racks DSP 204 and DSP 408 loudspeaker processors.**
|
**A modern, phone-friendly control app for the t.racks DSP 204 and DSP 408 loudspeaker processors.**
|
||||||
Control both devices at the same time from your phone, tablet or computer – over the network or USB.
|
Control all your DSPs at the same time from a phone, tablet or computer, over the network or USB.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> **Vibe-coded, read this first.** I'm a hobbyist and wrote this app almost entirely with an AI coding assistant,
|
||||||
|
> for my own DSPs. It works for me, but large parts have only been tested against a simulator, and some protocol
|
||||||
|
> details are educated guesses (see [Verified vs. unverified](CLAUDE.md#verified-vs-unverified)).
|
||||||
|
> It talks directly to your loudspeaker processor and can change gains, limiters and crossovers: a wrong value can
|
||||||
|
> be loud and can damage speakers. **Export a preset before you start, keep the volume down while trying things out,
|
||||||
|
> and don't use it on a show you can't afford to lose.**
|
||||||
|
> You use it entirely at your own risk. I'm not responsible for anything that happens to your DSP, your speakers,
|
||||||
|
> your ears, your gig or your neighbours, nor for anything else, should the sky fall on you while you use it.
|
||||||
|
> No warranty of any kind (see [LICENSE](LICENSE)).
|
||||||
|
|
||||||
> **Unofficial project.** BetterDSPControl is an independent open-source project. It is not affiliated with,
|
> **Unofficial project.** BetterDSPControl is an independent open-source project. It is not affiliated with,
|
||||||
> endorsed by or supported by Musikhaus Thomann or the t.racks brand. "Thomann" and "t.racks" are trademarks of
|
> endorsed by or supported by Musikhaus Thomann or the t.racks brand. "Thomann" and "t.racks" are trademarks of
|
||||||
> their respective owner and are used here only to name the devices this software works with.
|
> their respective owner and are used here only to name the devices this software works with.
|
||||||
> Use at your own risk – see [Disclaimer](#disclaimer).
|
> See [Disclaimer](#disclaimer).
|
||||||
|
|
||||||
* Pure Python 3.10+ standard library on the server side – no packages to install
|
* Runs on Windows, macOS, Linux and a Raspberry Pi, and in any browser
|
||||||
* Vanilla HTML/CSS/JavaScript web UI – no build tools
|
* No packages to install for the server (Python 3.10+ standard library), no build tools for the web UI
|
||||||
* Runs on Windows, macOS, Linux and a Raspberry Pi
|
|
||||||
* English and German user interface
|
* English and German user interface
|
||||||
|
* **Want to look around first?** ⚙ → *Demo mode* starts a simulated DSP inside the app. Nothing is sent to real devices
|
||||||
|
|
||||||
## Features
|
All screenshots show the built-in simulator with made-up settings.
|
||||||
|
|
||||||
* **Several devices at once** – switch with the tabs at the top; the model is detected automatically
|
## What it can do
|
||||||
* **Mixer** – faders, mute and live meters for all inputs and outputs, limiter LED on every output (status read
|
|
||||||
from the DSP)
|
### Mixer
|
||||||
* **Channel** – name, gain, delay, polarity, high/low pass, 8/9-band PEQ with a draggable curve
|
|
||||||
* **Inputs** – noise gate, 31-band GEQ · **Outputs** – compressor, limiter, input routing with mix levels
|
Faders, mute and live meters for every input and output, on all screens. **LIM** lights up when an output's limiter
|
||||||
* **Routing matrix**, recall and store presets
|
acts, as reported by the DSP. Linked channels are grouped under a named bracket in their colour.
|
||||||
* **Channel links** – link channels into groups; the DSP mirrors changes within the group, the app shows them live
|
|
||||||
* **Preset files** – export the current DSP state to a file and import it again. An import only changes the active
|

|
||||||
state (stored presets stay untouched), writes only what actually differs and makes an automatic backup first
|
|
||||||
("Undo import")
|
Tap a value to type it (`-3.5`, `1.2k`, a delay in metres like `2.5m`). Faders snap at 0 dB and a double tap returns
|
||||||
* **Limiter calculator** – enter your amplifiers' datasheet values (power at 8/4/2 Ω, sensitivity or gain), assign
|
to 0 dB. **Mute all** silences every channel of every connected DSP, and releasing it unmutes only what was open before.
|
||||||
outputs, and see the resulting power when the limiter engages, the clipping headroom and the speaker load.
|
|
||||||
"Limit to … W" calculates the threshold. Attack/release presets per band (infra, sub, kick, mid, high)
|
### Channel and EQ
|
||||||
* **Settings backup** – devices, amplifier data, PIN and remote access in one file
|
|
||||||
* **Many phones at once** – every change is pushed live to all connected clients
|
Drag the bands directly on the curve. The 8- or 9-band parametric EQ shows magnitude or phase, including crossover
|
||||||
* Tap a value to type it in (`-3.5`, `1.2k`, delay in metres `2.5m`); faders snap at 0 dB, double-tap = 0 dB
|
filters, and can overlay any other channel, for example to line up a sub with a top.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* Name, gain, delay, polarity, high and low pass, *EQ Bypass*
|
||||||
|
* Inputs: noise gate, 31-band graphic EQ
|
||||||
|
* Outputs: compressor, limiter, input routing with mix levels
|
||||||
|
* **Copy settings** from one channel to any number of channels, on all connected DSPs
|
||||||
|
|
||||||
|
### Routing
|
||||||
|
|
||||||
|
Connect inputs and outputs in a matrix. Each connection shows its level inside the crosspoint and follows the
|
||||||
|
slider as you move it.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Link groups, colours and presets
|
||||||
|
|
||||||
|
Link channels into groups, so the DSP mirrors changes within a group. Give each group a name and a colour.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* **Colours and group names belong to the preset.** The DSP has no preset IDs, so they are kept by preset name: same
|
||||||
|
name, same look. A preset without its own look starts empty
|
||||||
|
* **Max level** per channel: a software lock, the fader can't go higher
|
||||||
|
* **Preset files:** export the current DSP state and import it again, colours and group names included. An import
|
||||||
|
only changes the active state, writes only what actually differs and makes a backup first (*Undo import*)
|
||||||
|
|
||||||
|
### Limiter calculator
|
||||||
|
|
||||||
|
Enter your amplifiers' datasheet values (power at 8/4/2 Ω, sensitivity or gain), assign outputs and see the resulting
|
||||||
|
power when the limiter engages, the clipping headroom and the speaker load. *Limit to … W* calculates the threshold.
|
||||||
|
Attack and release presets per band (infra, sub, kick, mid, high). It is a planning aid based on an assumed reference
|
||||||
|
level, so verify it with a measurement.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### SoundField
|
||||||
|
|
||||||
|
A top view of the room for planning. Place mains, subs, delays and fills by dragging, and see a level map, a sub map at
|
||||||
|
a chosen frequency with its cancellation lanes, and a timing map for delay speakers. It suggests aiming, height, delay
|
||||||
|
lines and sub placement, calculates the delays and writes them to the assigned DSP outputs. It is a free-field model
|
||||||
|
without reflections, so a planning aid and not a measurement. A handbook with real cases is built in.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Dashboard
|
||||||
|
|
||||||
|
Your own overview page: DSP overview, levels, faders, frequency response, channel, limiter, routing, delay, notes. Drag
|
||||||
|
modules on with a mouse, then move and resize them. It only looks and never changes a DSP. On touchscreens only the
|
||||||
|
settings of each module can be changed. The dashboard starts empty.
|
||||||
|
|
||||||
|
### DJ Brake
|
||||||
|
|
||||||
|
An optional page at `/djbrake` for a tablet at the DJ booth: a big red light when a limiter acts, on for one more second
|
||||||
|
afterwards. Limiters that don't matter, a monitor for example, can be left out. It needs no PIN, shows nothing else
|
||||||
|
and changes nothing. Turn it on under ⚙ → *Remote access* in the desktop apps, or ⚙ → *Security* on the web. In the
|
||||||
|
desktop apps it needs remote access to be on. The limiter signal comes from the DSP, and on a real DSP 204 it was seen
|
||||||
|
staying on for up to 4 seconds in some cases, so the light can stay on longer than that one second.
|
||||||
|
|
||||||
|
<img src="docs/screenshots/djbrake.jpg" alt="DJ Brake showing the limiter light" width="640">
|
||||||
|
|
||||||
|
### On your phone
|
||||||
|
|
||||||
|
The whole app adapts to phones and tablets. The web UI starts **read-only** on touch devices, and a small switch at the
|
||||||
|
top allows changes, so nothing moves by accident. Zooming is turned off so it can't get in the way of the faders. Every
|
||||||
|
change is pushed live to all connected devices.
|
||||||
|
|
||||||
|
<img src="docs/screenshots/phone.jpg" alt="The app on a phone" width="300">
|
||||||
|
|
||||||
|
### And also
|
||||||
|
|
||||||
|
* **Several DSPs at once:** pick one at the top, the model is detected automatically
|
||||||
|
* **Network search** finds DSPs in the local network and adds them with one click
|
||||||
|
* **Sound Lab** (desktop apps only): works with [REW](https://www.roomeqwizard.com/). Take the filters of a measurement or
|
||||||
|
a REW filter file onto a channel, compare before applying, send a channel's curve back. So far only tested against a
|
||||||
|
stand-in built from REW's API description, not against REW itself
|
||||||
|
* **Audio test:** the DSP's generator (pink noise, white noise, sine). All outputs drop to −50 dB first and one test
|
||||||
|
fader raises them together
|
||||||
|
* **Device lock:** DSPs locked with their 4-character code are detected and the app asks for the code
|
||||||
|
* **Settings backup** in one file, and in the desktop apps **Reset app settings**. The DSPs are disconnected first and
|
||||||
|
nothing on them changes
|
||||||
|
* **Your own logo** at the top left and as the browser icon
|
||||||
|
|
||||||
## Supported hardware
|
## Supported hardware
|
||||||
|
|
||||||
| Device | Network | USB | Tested on real hardware |
|
| Device | Network | USB | Tested on real hardware |
|
||||||
|--------|---------|-----|-------------------------|
|
|--------|---------|-----|-------------------------|
|
||||||
| t.racks DSP 204 | ✓ | ✓ | yes (firmware V0104P, USB on macOS) |
|
| t.racks DSP 204 | ✓ | ✓ | yes (firmware V0104P, USB on macOS) |
|
||||||
| t.racks DSP 408 | ✓ | ✓ | not yet – frames match published captures |
|
| t.racks DSP 408 | ✓ | ✓ | briefly tried, not tested in depth; frames match published captures |
|
||||||
|
| t.racks DSP 206 (beta) | ✓ | ? | no, assumed to work like the others, testers wanted |
|
||||||
|
| t.racks FIR DSP 408 (beta) | ✓ | ? | no, simulator only |
|
||||||
|
|
||||||
The DSPs accept only **one** connection at a time – close any other control software first.
|
The FIR DSP 408 gets its own **FIR** tab: low-, high- and band-pass with window and taps on the outputs, coefficients
|
||||||
|
from a txt/csv file on inputs (up to 2048) and outputs (up to 1024), a curve and the shared budget of 4096 taps. Its
|
||||||
|
dynamic EQs are not supported.
|
||||||
|
|
||||||
|
Beta models are not detected automatically: choose them by hand when adding the device (amplifiers off for the first
|
||||||
|
test). If the shown values don't match the DSP, please send the file from File… → Export.
|
||||||
|
|
||||||
|
The DSPs accept only **one** connection at a time, so close any other control software first.
|
||||||
|
|
||||||
## Quick start (web UI)
|
## Quick start (web UI)
|
||||||
|
|
||||||
@@ -65,18 +169,18 @@ Open `http://<IP-of-this-computer>:8080` in a browser (from a phone: same Wi-Fi/
|
|||||||
`config.json` is created on the first start. Options: `--port 8080`, `--host 0.0.0.0`, `--config path/to/config.json`,
|
`config.json` is created on the first start. Options: `--port 8080`, `--host 0.0.0.0`, `--config path/to/config.json`,
|
||||||
`-v` (debug log). On Windows you can also double-click `start.bat`.
|
`-v` (debug log). On Windows you can also double-click `start.bat`.
|
||||||
|
|
||||||
**Forgot the PIN?** Stop the server, delete the `auth` entry from `config.json` and start again – the PIN is `1234`
|
**Forgot the PIN?** Stop the server, delete the `auth` entry from `config.json` and start again. The PIN is `1234`
|
||||||
again.
|
again.
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
The PIN protects against accidental access in your own network, nothing more: it has 4 digits, a logged-in device
|
The PIN protects against accidental access in your own network, nothing more: it has 4 digits, a logged-in device
|
||||||
stays logged in for 30 days, and after 5 wrong attempts the login is blocked (30 s, growing up to 15 min). The server speaks
|
stays logged in for 30 days, and after 5 wrong attempts the login is blocked (30 s, growing up to 15 min). The server speaks
|
||||||
plain HTTP. **Do not expose it to the internet** (no port forwarding) – use a VPN if you need remote access.
|
plain HTTP. **Do not expose it to the internet** (no port forwarding); use a VPN if you need remote access.
|
||||||
|
|
||||||
## Desktop apps (Windows, macOS)
|
## Desktop apps (Windows, macOS)
|
||||||
|
|
||||||
The desktop app runs the server and the UI in its own window – **no PIN needed** in the app window.
|
The desktop app runs the server and the UI in its own window, with **no PIN needed** in the app window.
|
||||||
Under ⚙ → *Remote access* you can turn on a web server for phones and tablets (port selectable); other devices
|
Under ⚙ → *Remote access* you can turn on a web server for phones and tablets (port selectable); other devices
|
||||||
then log in with the PIN. The lock icon (top right) locks the app window (view only); unlock with the PIN.
|
then log in with the PIN. The lock icon (top right) locks the app window (view only); unlock with the PIN.
|
||||||
|
|
||||||
@@ -104,20 +208,22 @@ python packaging/build.py
|
|||||||
* installs BetterDSPControl from the card (the Pi needs no internet), as a systemd service on port 80
|
* installs BetterDSPControl from the card (the Pi needs no internet), as a systemd service on port 80
|
||||||
|
|
||||||
After 2–5 minutes open `http://<hostname>.local`. Needs administrator rights; only USB/SD drives that are not the
|
After 2–5 minutes open `http://<hostname>.local`. Needs administrator rights; only USB/SD drives that are not the
|
||||||
system or boot disk are offered. If Windows then asks to format the Linux partition, click **Cancel**.
|
system or boot disk are offered. If Windows then asks to format the Linux partition, click **Cancel**. Writing to a real
|
||||||
|
SD card and the first boot on a real Pi have not been tested yet.
|
||||||
|
|
||||||
On any other Linux machine: `python3 server.py --port 8080`. For USB access as a normal user add a udev rule for
|
On any other Linux machine: `python3 server.py --port 8080`. For USB access as a normal user add a udev rule for
|
||||||
`hidraw` devices with VID `0168` / PID `0821` (see `INSTALL_SH` in `pi_image.py`).
|
`hidraw` devices with VID `0168` / PID `0821` (see `INSTALL_SH` in `pi_image.py`).
|
||||||
|
|
||||||
## USB
|
## USB
|
||||||
|
|
||||||
Choose *USB cable* for a device under ⚙. The DSPs are USB HID devices (VID 0168 / PID 0821) – no driver needed – and
|
Choose *USB cable* for a device under ⚙. The DSPs are USB HID devices (VID 0168 / PID 0821), so no driver is needed, and
|
||||||
speak the same frames as over the network. Works on Windows (hid.dll), macOS (IOKit) and Linux (hidraw). With two
|
they speak the same frames as over the network. Written for Windows (hid.dll), macOS (IOKit) and Linux (hidraw); tested
|
||||||
DSPs on USB, pick the right one in the drop-down.
|
on a real DSP on macOS. With two DSPs on USB, pick the right one in the drop-down.
|
||||||
|
|
||||||
## Testing without hardware
|
## Testing without hardware
|
||||||
|
|
||||||
A simulator emulates both models:
|
The quickest way is the **demo mode** (⚙ → Demo mode). For development, a stand-alone simulator emulates both
|
||||||
|
models (`--lock A1BA` makes it ask for a lock code):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python sim.py --model 204 --port 9761
|
python sim.py --model 204 --port 9761
|
||||||
@@ -131,7 +237,7 @@ python sim.py --model 408 --port 9762
|
|||||||
python server.py
|
python server.py
|
||||||
```
|
```
|
||||||
|
|
||||||
Then add devices with IP `127.0.0.1` and ports 9761 / 9762 in the web UI. Protocol self-test:
|
Then add devices with IP `127.0.0.1` and ports 9761 / 9762 in the web UI. Self-test:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python tests/test_protocol.py
|
python tests/test_protocol.py
|
||||||
@@ -149,9 +255,11 @@ python tests/test_protocol.py
|
|||||||
| `sim.py` | Simulated DSP 204/408 |
|
| `sim.py` | Simulated DSP 204/408 |
|
||||||
| `desktop.py` | Desktop app (Windows/macOS): server + own window (pywebview) |
|
| `desktop.py` | Desktop app (Windows/macOS): server + own window (pywebview) |
|
||||||
| `pi_writer.py`, `pi_image.py`, `win_disk.py` | Raspberry Pi SD card writer: GUI, OS image + cloud-init, raw disk writes |
|
| `pi_writer.py`, `pi_image.py`, `win_disk.py` | Raspberry Pi SD card writer: GUI, OS image + cloud-init, raw disk writes |
|
||||||
| `static/` | Web UI (`app.js`, `style.css`, `index.html`), translations in `static/i18n.js` |
|
| `static/` | Web UI: `app.js`, `dashboard.js`, `soundfield.js`, `rew.js`, handbooks in `docs.js`, translations in `i18n.js` |
|
||||||
| `packaging/` | Build script and icons |
|
| `packaging/` | Build script and icons |
|
||||||
| `tests/` | Protocol tests |
|
| `tests/` | Self-tests |
|
||||||
|
| `tools/dsp_measure.py` | Measures on a real DSP how meter, gain, threshold and limiter relate |
|
||||||
|
| `docs/screenshots/` | The pictures in this file |
|
||||||
| `PROTOCOL.md` | Protocol documentation |
|
| `PROTOCOL.md` | Protocol documentation |
|
||||||
| `CLAUDE.md` | Guide for AI coding assistants (architecture, conventions, open points) |
|
| `CLAUDE.md` | Guide for AI coding assistants (architecture, conventions, open points) |
|
||||||
|
|
||||||
@@ -162,7 +270,7 @@ working on it in your own Claude session. `CLAUDE.md` is read automatically by C
|
|||||||
architecture, conventions and what is still unverified.
|
architecture, conventions and what is still unverified.
|
||||||
|
|
||||||
1. Clone the repository (see [Quick start](#quick-start-web-ui)).
|
1. Clone the repository (see [Quick start](#quick-start-web-ui)).
|
||||||
2. Open the folder in Claude Code – either the **Claude desktop app** (tab *Code* → choose the folder) or in a
|
2. Open the folder in Claude Code: either the **Claude desktop app** (tab *Code* → choose the folder) or in a
|
||||||
terminal:
|
terminal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -192,14 +300,15 @@ What I want to do: <describe your goal>.
|
|||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Issues and pull requests are welcome – especially captures and test results from a real **DSP 408** and anything
|
Issues and pull requests are welcome, especially detailed test results from a real **DSP 408** and anything listed as unverified
|
||||||
listed as unverified in `CLAUDE.md`. Please test with the simulator first and run `python tests/test_protocol.py`.
|
in `CLAUDE.md`. Please test with the simulator first and run `python tests/test_protocol.py`. Owners of another model
|
||||||
|
can help a lot with `tools/dsp_measure.py`: it only lowers values, puts them back and writes a small result file.
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
This software talks to your audio hardware. Wrong settings (e.g. limiter thresholds, gain, crossover filters) can
|
This software talks to your audio hardware. Wrong settings (e.g. limiter thresholds, gain, crossover filters) can
|
||||||
damage loudspeakers or amplifiers. The limiter calculator is a planning aid based on datasheet values and an assumed
|
damage loudspeakers or amplifiers. The limiter calculator is a planning aid based on datasheet values and an assumed
|
||||||
reference level – verify with a measurement before relying on it. The software is provided "as is", without
|
reference level, so verify with a measurement before relying on it. The software is provided "as is", without
|
||||||
warranty of any kind, see [LICENSE](LICENSE).
|
warranty of any kind, see [LICENSE](LICENSE).
|
||||||
|
|
||||||
The protocol was documented for interoperability purposes only, by observing the communication of the devices and
|
The protocol was documented for interoperability purposes only, by observing the communication of the devices and
|
||||||
|
|||||||
|
After Width: | Height: | Size: 153 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 176 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 157 KiB |
@@ -20,19 +20,40 @@ LINK_RESYNC_DELAY = 1.5 # re-read the config this long after the last change on
|
|||||||
|
|
||||||
class Device:
|
class Device:
|
||||||
def __init__(self, dev_id: str, name: str, host: str, port: int = P.PORT, model: str = "auto",
|
def __init__(self, dev_id: str, name: str, host: str, port: int = P.PORT, model: str = "auto",
|
||||||
addr: int = 1, autoconnect: bool = True, on_event=None, transport: str = "tcp", usb: str = ""):
|
addr: int = 1, autoconnect: bool = True, on_event=None, transport: str = "tcp", usb: str = "",
|
||||||
|
lock_code: str = "", auto_unlock: bool = False, test_saved: list | None = None,
|
||||||
|
colors: dict | None = None, maxgain: dict | None = None, linknames: dict | None = None,
|
||||||
|
looks: dict | None = None, look_name: str = ""):
|
||||||
self.id = dev_id
|
self.id = dev_id
|
||||||
self.name = name
|
self.name = name
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.model_key = model # "auto", "204" or "408"
|
self.model_key = model # "auto" or a key of P.MODELS
|
||||||
self.addr = addr
|
self.addr = addr
|
||||||
self.autoconnect = autoconnect
|
self.autoconnect = autoconnect
|
||||||
self.transport = "usb" if transport == "usb" else "tcp"
|
self.transport = "usb" if transport == "usb" else "tcp"
|
||||||
self.usb = usb # HID device path, "" = first DSP found
|
self.usb = usb # HID device path, "" = first DSP found
|
||||||
self.on_event = on_event or (lambda ev: None)
|
self.on_event = on_event or (lambda ev: None)
|
||||||
|
# hardware lock of the DSP itself (not the app lock): remembered code for automatic unlocking
|
||||||
|
self.lock_code = lock_code if P.LOCK_CODE.fullmatch(lock_code or "") else ""
|
||||||
|
self.auto_unlock = auto_unlock
|
||||||
|
self.demo = False # in-process simulator of the demo mode, never saved
|
||||||
|
self.colors: dict[str, str] = colors or {} # channel colours chosen in the app, e.g. {"in0": "#38bdf8"}
|
||||||
|
self.linknames: dict[str, str] = linknames or {} # names of link groups, e.g. {"out:0,1": "Tops"}
|
||||||
|
# colours and group names per preset. The DSP has no IDs for presets, only slots and names, and only the name
|
||||||
|
# is in its memory image, so that is the key. colors/linknames above always are those of look_name.
|
||||||
|
self.looks: dict[str, dict] = looks or {}
|
||||||
|
self.look_name = look_name
|
||||||
|
self.look_dirty = False
|
||||||
|
self.recalled = "" # the preset last loaded through the app, as listed by the DSP ...
|
||||||
|
self.recalled_image = None # ... and the name its memory image showed right after
|
||||||
|
self.maxgain: dict[str, int] = maxgain or {} # software limit of the gain fader per channel (raw), e.g. {"out0": 260}
|
||||||
|
# audio test: output gains from before the test (restored when it ends) and the test fader level
|
||||||
|
self.test_saved: list[int] | None = test_saved if isinstance(test_saved, list) else None
|
||||||
|
self.test_level = -50.0
|
||||||
|
self.on_online = None # async callback(device) once a connection is fully loaded
|
||||||
|
|
||||||
self.status = "disconnected" # disconnected | connecting | loading | online | error
|
self.status = "disconnected" # disconnected | connecting | loading | locked | online | error
|
||||||
self.error = ""
|
self.error = ""
|
||||||
self.info = ""
|
self.info = ""
|
||||||
self.model: P.Model | None = P.MODELS.get(model)
|
self.model: P.Model | None = P.MODELS.get(model)
|
||||||
@@ -53,19 +74,28 @@ class Device:
|
|||||||
self._want_connected = False
|
self._want_connected = False
|
||||||
self._resync: asyncio.TimerHandle | None = None
|
self._resync: asyncio.TimerHandle | None = None
|
||||||
self._changes = 0 # bumped on every local change, so a resync never overwrites newer edits
|
self._changes = 0 # bumped on every local change, so a resync never overwrites newer edits
|
||||||
|
self._codes: asyncio.Queue | None = None # (code, future) entered while the DSP is locked
|
||||||
|
|
||||||
# ------------------------------------------------------------ public API
|
# ------------------------------------------------------------ public API
|
||||||
|
|
||||||
def config(self) -> dict:
|
def config(self) -> dict:
|
||||||
return {"id": self.id, "name": self.name, "host": self.host, "port": self.port,
|
return {"id": self.id, "name": self.name, "host": self.host, "port": self.port,
|
||||||
"model": self.model_key, "addr": self.addr, "autoconnect": self.autoconnect,
|
"model": self.model_key, "addr": self.addr, "autoconnect": self.autoconnect,
|
||||||
"transport": self.transport, "usb": self.usb}
|
"transport": self.transport, "usb": self.usb,
|
||||||
|
"lock_code": self.lock_code, "auto_unlock": self.auto_unlock, "test_saved": self.test_saved,
|
||||||
|
"colors": self.colors, "maxgain": self.maxgain, "linknames": self.linknames,
|
||||||
|
"looks": self.looks, "look_name": self.look_name}
|
||||||
|
|
||||||
def snapshot(self) -> dict:
|
def snapshot(self) -> dict:
|
||||||
return {**self.config(), "status": self.status, "error": self.error, "info": self.info,
|
cfg = self.config()
|
||||||
|
cfg["lock_code"] = bool(self.lock_code) # clients only learn whether a code is remembered
|
||||||
|
del cfg["looks"], cfg["look_name"]
|
||||||
|
cfg["test_level"] = self.test_level
|
||||||
|
return {**cfg, "demo": self.demo, "status": self.status, "error": self.error, "info": self.info,
|
||||||
"detected_model": self.model_name or None,
|
"detected_model": self.model_name or None,
|
||||||
"n_in": self.model.n_in if self.model else 0,
|
"n_in": self.model.n_in if self.model else 0,
|
||||||
"n_out": self.model.n_out if self.model else 0,
|
"n_out": self.model.n_out if self.model else 0,
|
||||||
|
"fir": bool(self.model and self.model.fir),
|
||||||
"presets": self.presets, "state": self.state}
|
"presets": self.presets, "state": self.state}
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
@@ -75,8 +105,6 @@ class Device:
|
|||||||
|
|
||||||
async def stop(self):
|
async def stop(self):
|
||||||
self._want_connected = False
|
self._want_connected = False
|
||||||
self._resync: asyncio.TimerHandle | None = None
|
|
||||||
self._changes = 0 # bumped on every local change, so a resync never overwrites newer edits
|
|
||||||
if self._supervisor:
|
if self._supervisor:
|
||||||
self._supervisor.cancel()
|
self._supervisor.cancel()
|
||||||
try:
|
try:
|
||||||
@@ -121,6 +149,87 @@ class Device:
|
|||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
await self.refresh()
|
await self.refresh()
|
||||||
|
|
||||||
|
def fir_taps_used(self, skip: tuple[str, int] | None = None) -> int:
|
||||||
|
"""FIR taps taken by all channels together (they share P.FIR_MAX_TOTAL)."""
|
||||||
|
total = 0
|
||||||
|
for kind, key in (("in", "inputs"), ("out", "outputs")):
|
||||||
|
for i, ch in enumerate(self.state[key]):
|
||||||
|
if (kind, i) != skip:
|
||||||
|
total += P.fir_channel_taps(ch)
|
||||||
|
return total
|
||||||
|
|
||||||
|
async def upload_fir(self, kind: str, idx: int, coeffs: list[float], name: str) -> int:
|
||||||
|
"""Send FIR coefficients to a channel. Returns how many frames were not answered."""
|
||||||
|
if self.status != "online" or not self.state or not self.model.fir:
|
||||||
|
raise RuntimeError("DSP is not connected")
|
||||||
|
await self.flush()
|
||||||
|
c = self.model.channel(kind, idx)
|
||||||
|
name = P.clean_name(name)[:8]
|
||||||
|
failed = 0
|
||||||
|
if await self._request(P.CMD_FIR_NAME, bytes([c]) + name.encode("ascii").ljust(8, b" ")) is None:
|
||||||
|
failed += 1
|
||||||
|
for payload in P.fir_coef_frames(c, coeffs):
|
||||||
|
if await self._request(P.CMD_FIR_COEF, payload) is None:
|
||||||
|
failed += 1
|
||||||
|
fir = self.state["inputs" if kind == "in" else "outputs"][idx]["fir"]
|
||||||
|
fir["name"] = name
|
||||||
|
if kind == "in":
|
||||||
|
fir["taps"] = len(coeffs)
|
||||||
|
self._emit_state()
|
||||||
|
return failed
|
||||||
|
|
||||||
|
def gain_cap(self, kind: str, idx: int, value: int) -> int:
|
||||||
|
"""Software limit of a channel's gain: never above the limit - unless the DSP itself is set higher,
|
||||||
|
then only downwards (it snaps back into the limit once it is below)."""
|
||||||
|
lim = self.maxgain.get(f"{kind}{idx}")
|
||||||
|
if lim is None or not self.state:
|
||||||
|
return value
|
||||||
|
cur = self.state["inputs" if kind == "in" else "outputs"][idx]["gain"]
|
||||||
|
return min(value, max(lim, cur))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def test_active(self) -> bool:
|
||||||
|
return bool(self.state and self.state.get("test", {}).get("source"))
|
||||||
|
|
||||||
|
async def set_test_signal(self, source: int, freq: int):
|
||||||
|
"""Switch the inputs to a test generator (1 pink, 2 white, 3 sine) or back to the analog inputs (0)."""
|
||||||
|
if self.status != "online" or not self.state:
|
||||||
|
raise RuntimeError("DSP is not connected")
|
||||||
|
await self.flush() # queued changes (e.g. lowered faders) reach the DSP first
|
||||||
|
await self._request(P.CMD_TEST_SIGNAL, bytes([source, freq]))
|
||||||
|
self.state["test"] = {"source": source, "freq": freq}
|
||||||
|
self.on_event({"type": "test", "device": self.id, "test": self.state["test"]})
|
||||||
|
|
||||||
|
async def flush(self):
|
||||||
|
"""Wait until every queued parameter change has been sent."""
|
||||||
|
while self._pending:
|
||||||
|
await asyncio.sleep(0.01)
|
||||||
|
async with self._lock: # the last one may still wait for its answer
|
||||||
|
pass
|
||||||
|
|
||||||
|
async def unlock(self, code: str) -> bool:
|
||||||
|
"""Try a lock code while the DSP waits for it. True if the DSP accepted it."""
|
||||||
|
code = str(code or "").strip().upper()
|
||||||
|
if not P.LOCK_CODE.fullmatch(code):
|
||||||
|
raise ValueError("The code has 4 characters: digits and letters A–Z")
|
||||||
|
if self.status != "locked" or not self._codes:
|
||||||
|
raise RuntimeError("The DSP is not locked")
|
||||||
|
fut = asyncio.get_running_loop().create_future()
|
||||||
|
await self._codes.put((code, fut))
|
||||||
|
return await fut
|
||||||
|
|
||||||
|
async def set_lock_code(self, code: str):
|
||||||
|
"""Store a new lock code in the DSP; it asks for it from the next connection on."""
|
||||||
|
code = str(code or "").strip().upper()
|
||||||
|
if not P.LOCK_CODE.fullmatch(code):
|
||||||
|
raise ValueError("The code has 4 characters: digits and letters A–Z")
|
||||||
|
if self.status != "online":
|
||||||
|
raise RuntimeError("DSP is not connected")
|
||||||
|
if self.lock_code: # keep auto-unlock working with the new code
|
||||||
|
self.lock_code = code
|
||||||
|
await self._request(P.CMD_SET_LOCK_CODE, code.encode("ascii"))
|
||||||
|
await self._request(P.CMD_LOGOUT) # as the original software does after setting the code
|
||||||
|
|
||||||
def _schedule_resync(self):
|
def _schedule_resync(self):
|
||||||
"""Re-read the config shortly after edits on linked channels, so the app shows exactly
|
"""Re-read the config shortly after edits on linked channels, so the app shows exactly
|
||||||
what the DSP applied to the group (e.g. mute, which we don't mirror for certain)."""
|
what the DSP applied to the group (e.g. mute, which we don't mirror for certain)."""
|
||||||
@@ -146,9 +255,39 @@ class Device:
|
|||||||
self.state = state
|
self.state = state
|
||||||
self._emit_state()
|
self._emit_state()
|
||||||
|
|
||||||
|
def remember_look(self):
|
||||||
|
"""Keeps the current colours and group names with the loaded preset."""
|
||||||
|
self.looks[self.look_name] = {"colors": dict(self.colors), "linknames": dict(self.linknames)}
|
||||||
|
while len(self.looks) > 64:
|
||||||
|
del self.looks[next(k for k in self.looks if k != self.look_name)]
|
||||||
|
self.look_dirty = True
|
||||||
|
|
||||||
|
def sync_look(self):
|
||||||
|
"""After reading the DSP: another preset brings its own look, one that has none starts without.
|
||||||
|
Only the very first preset ever seen keeps what is there: those are the settings from before looks existed."""
|
||||||
|
if self.state is None:
|
||||||
|
return
|
||||||
|
name = self.state.get("preset_name", "").strip()
|
||||||
|
# that the memory image shows the new name after loading a preset is not verified on hardware: trust the list
|
||||||
|
if self.recalled:
|
||||||
|
if self.recalled_image is None:
|
||||||
|
self.recalled_image = name
|
||||||
|
if name == self.recalled_image:
|
||||||
|
name = self.recalled
|
||||||
|
else:
|
||||||
|
self.recalled = ""
|
||||||
|
if name == self.look_name and name in self.looks:
|
||||||
|
return
|
||||||
|
if self.looks:
|
||||||
|
look = self.looks.get(name, {"colors": {}, "linknames": {}})
|
||||||
|
self.colors, self.linknames = dict(look["colors"]), dict(look["linknames"])
|
||||||
|
self.look_name = name
|
||||||
|
self.remember_look()
|
||||||
|
|
||||||
async def recall_preset(self, index: int):
|
async def recall_preset(self, index: int):
|
||||||
await self._request(P.CMD_PRESET_RECALL, bytes([index + 1]), timeout=2.0)
|
await self._request(P.CMD_PRESET_RECALL, bytes([index + 1]), timeout=2.0)
|
||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
|
self.recalled, self.recalled_image = (self.presets[index].strip() if index < len(self.presets) else ""), None
|
||||||
await self._load_config()
|
await self._load_config()
|
||||||
self._emit_state()
|
self._emit_state()
|
||||||
|
|
||||||
@@ -160,6 +299,9 @@ class Device:
|
|||||||
self.presets[index] = name
|
self.presets[index] = name
|
||||||
if self.state:
|
if self.state:
|
||||||
self.state["preset_name"] = name
|
self.state["preset_name"] = name
|
||||||
|
self.look_name = name.strip() # also when overwriting: what is stored now is what we see now
|
||||||
|
self.recalled = ""
|
||||||
|
self.remember_look()
|
||||||
self._emit_state()
|
self._emit_state()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -169,7 +311,8 @@ class Device:
|
|||||||
async def export_preset(self) -> dict:
|
async def export_preset(self) -> dict:
|
||||||
"""The DSP's current state, read fresh from the device."""
|
"""The DSP's current state, read fresh from the device."""
|
||||||
await self.refresh()
|
await self.refresh()
|
||||||
return preset.export_doc(self.model_name, self.info, self.state, self.raw)
|
return {**preset.export_doc(self.model_name, self.info, self.state, self.raw),
|
||||||
|
"look": {"colors": self.colors, "linknames": self.linknames}}
|
||||||
|
|
||||||
async def import_preset(self, state: dict) -> list[str]:
|
async def import_preset(self, state: dict) -> list[str]:
|
||||||
"""Put the DSP into `state` (working state only). Returns the paths that did not take."""
|
"""Put the DSP into `state` (working state only). Returns the paths that did not take."""
|
||||||
@@ -225,6 +368,8 @@ class Device:
|
|||||||
self._set_status("online")
|
self._set_status("online")
|
||||||
self._emit_state()
|
self._emit_state()
|
||||||
self._tasks += [asyncio.create_task(self._write_loop()), asyncio.create_task(self._meter_loop())]
|
self._tasks += [asyncio.create_task(self._write_loop()), asyncio.create_task(self._meter_loop())]
|
||||||
|
if self.on_online:
|
||||||
|
asyncio.create_task(self.on_online(self))
|
||||||
done, _ = await asyncio.wait(self._tasks, return_when=asyncio.FIRST_COMPLETED)
|
done, _ = await asyncio.wait(self._tasks, return_when=asyncio.FIRST_COMPLETED)
|
||||||
for t in done:
|
for t in done:
|
||||||
if t.exception():
|
if t.exception():
|
||||||
@@ -293,8 +438,11 @@ class Device:
|
|||||||
if detected and detected != self.model_key:
|
if detected and detected != self.model_key:
|
||||||
log.warning("%s: configured as %s but device reports %s", self.name, self.model_key, self.info)
|
log.warning("%s: configured as %s but device reports %s", self.name, self.model_key, self.info)
|
||||||
count_frame = await self._request(P.CMD_PRESET_COUNT, expect=P.CMD_PRESET_COUNT)
|
count_frame = await self._request(P.CMD_PRESET_COUNT, expect=P.CMD_PRESET_COUNT)
|
||||||
count = count_frame.payload[-1] if count_frame and count_frame.payload else 20
|
payload = count_frame.payload if count_frame else b""
|
||||||
|
count = payload[-1] if 0 < len(payload) < 6 else 20 # the long answer carries the lock state instead
|
||||||
count = count if 0 < count <= 60 else 20
|
count = count if 0 < count <= 60 else 20
|
||||||
|
if P.device_locked(payload):
|
||||||
|
await self._wait_for_unlock()
|
||||||
await self._request(P.CMD_INIT_22)
|
await self._request(P.CMD_INIT_22)
|
||||||
await self._request(P.CMD_INIT_14)
|
await self._request(P.CMD_INIT_14)
|
||||||
presets = []
|
presets = []
|
||||||
@@ -304,8 +452,39 @@ class Device:
|
|||||||
self.presets = presets
|
self.presets = presets
|
||||||
await self._load_config()
|
await self._load_config()
|
||||||
|
|
||||||
|
async def _try_code(self, code: str) -> bool:
|
||||||
|
f = await self._request(P.CMD_UNLOCK, b"\x00" + code.encode("ascii"), timeout=2.0, expect=P.CMD_UNLOCK)
|
||||||
|
return bool(f and len(f.payload) > 1 and f.payload[1] == 1)
|
||||||
|
|
||||||
|
async def _wait_for_unlock(self):
|
||||||
|
"""The DSP is locked with its code: unlock automatically or wait until a code is entered."""
|
||||||
|
if self.auto_unlock and self.lock_code:
|
||||||
|
if await self._try_code(self.lock_code):
|
||||||
|
log.info("%s: unlocked automatically", self.name)
|
||||||
|
return
|
||||||
|
log.warning("%s: remembered lock code was rejected", self.name)
|
||||||
|
self.error = "The remembered lock code was rejected"
|
||||||
|
self._codes = asyncio.Queue()
|
||||||
|
self._set_status("locked")
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
code, fut = await self._codes.get()
|
||||||
|
ok = await self._try_code(code)
|
||||||
|
if not fut.done():
|
||||||
|
fut.set_result(ok)
|
||||||
|
if ok:
|
||||||
|
self.error = ""
|
||||||
|
self._set_status("loading")
|
||||||
|
return
|
||||||
|
finally:
|
||||||
|
self._codes = None
|
||||||
|
|
||||||
async def _load_config(self):
|
async def _load_config(self):
|
||||||
self.state = await self._read_config()
|
state = await self._read_config()
|
||||||
|
if self.model.fir and self.state: # where this model keeps the test signal in its memory is not known
|
||||||
|
state["test"] = self.state.get("test", state["test"])
|
||||||
|
self.state = state
|
||||||
|
self.sync_look()
|
||||||
|
|
||||||
async def _read_config(self) -> dict:
|
async def _read_config(self) -> dict:
|
||||||
model = self.model
|
model = self.model
|
||||||
|
|||||||
@@ -49,16 +49,16 @@ def _peq(src, cur: list) -> list:
|
|||||||
|
|
||||||
def _group(src, cur: dict, ranges: dict) -> dict:
|
def _group(src, cur: dict, ranges: dict) -> dict:
|
||||||
src = src if isinstance(src, dict) else {}
|
src = src if isinstance(src, dict) else {}
|
||||||
return {k: _int(src.get(k), lo, hi, cur[k]) for k, (lo, hi) in ranges.items()}
|
return {k: _int(src.get(k), *ranges.get(k, (0, 0xFFFF)), v) for k, v in cur.items()}
|
||||||
|
|
||||||
|
|
||||||
def _common(s: dict, c: dict) -> dict:
|
def _common(s: dict, c: dict) -> dict:
|
||||||
name = s.get("name", c["name"])
|
name = s.get("name", c["name"])
|
||||||
return {"name": P.clean_name(name).strip(),
|
return {"name": P.clean_name(name).strip(), **{k: _filter(s.get(k), c[k]) for k in ("hp", "lp") if k in c},
|
||||||
"hp": _filter(s.get("hp"), c["hp"]), "lp": _filter(s.get("lp"), c["lp"]),
|
|
||||||
"gain": _int(s.get("gain"), 0, 400, c["gain"]), "polarity": bool(s.get("polarity", c["polarity"])),
|
"gain": _int(s.get("gain"), 0, 400, c["gain"]), "polarity": bool(s.get("polarity", c["polarity"])),
|
||||||
"delay": _int(s.get("delay"), 0, 65280, c["delay"]), "link": _int(s.get("link"), 0, 0xFFFF, c["link"]),
|
"delay": _int(s.get("delay"), 0, 65280, c["delay"]), "link": _int(s.get("link"), 0, 0xFFFF, c["link"]),
|
||||||
"mute": bool(s.get("mute", c["mute"]))}
|
"mute": bool(s.get("mute", c["mute"])),
|
||||||
|
**({"peq_bypass": bool(s.get("peq_bypass", c.get("peq_bypass", False)))} if "peq_bypass" in c else {})}
|
||||||
|
|
||||||
|
|
||||||
def clean_state(model: P.Model, src: dict, base: dict) -> dict:
|
def clean_state(model: P.Model, src: dict, base: dict) -> dict:
|
||||||
@@ -69,15 +69,24 @@ def clean_state(model: P.Model, src: dict, base: dict) -> dict:
|
|||||||
for i, c in enumerate(st["inputs"]):
|
for i, c in enumerate(st["inputs"]):
|
||||||
s = ins[i] if i < len(ins) and isinstance(ins[i], dict) else {}
|
s = ins[i] if i < len(ins) and isinstance(ins[i], dict) else {}
|
||||||
geq = s.get("geq") if isinstance(s.get("geq"), list) else []
|
geq = s.get("geq") if isinstance(s.get("geq"), list) else []
|
||||||
c.update(_common(s, c), peq=_peq(s.get("peq"), c["peq"]), gate=_group(s.get("gate"), c["gate"], _GATE),
|
c.update(_common(s, c), peq=_peq(s.get("peq"), c["peq"]), gate=_group(s.get("gate"), c["gate"], _GATE))
|
||||||
|
if model.fir:
|
||||||
|
c.update(comp=_group(s.get("comp"), c["comp"], _COMP))
|
||||||
|
c["fir"]["bypass"] = bool((s.get("fir") if isinstance(s.get("fir"), dict) else {}).get("bypass", c["fir"]["bypass"]))
|
||||||
|
continue
|
||||||
|
c.update(geq_bypass=bool(s.get("geq_bypass", c.get("geq_bypass", False))),
|
||||||
geq=[_int(geq[b], 0, 240, v) if b < len(geq) else v for b, v in enumerate(c["geq"])])
|
geq=[_int(geq[b], 0, 240, v) if b < len(geq) else v for b, v in enumerate(c["geq"])])
|
||||||
for i, c in enumerate(st["outputs"]):
|
for i, c in enumerate(st["outputs"]):
|
||||||
s = outs[i] if i < len(outs) and isinstance(outs[i], dict) else {}
|
s = outs[i] if i < len(outs) and isinstance(outs[i], dict) else {}
|
||||||
mix = s.get("mix") if isinstance(s.get("mix"), list) else []
|
mix = s.get("mix") if isinstance(s.get("mix"), list) else []
|
||||||
c.update(_common(s, c), peq=_peq(s.get("peq"), c["peq"]),
|
c.update(_common(s, c), peq=_peq(s.get("peq"), c["peq"]),
|
||||||
comp=_group(s.get("comp"), c["comp"], _COMP), limit=_group(s.get("limit"), c["limit"], _LIMIT),
|
limit=_group(s.get("limit"), c["limit"], _LIMIT),
|
||||||
matrix=_int(s.get("matrix"), 0, (1 << model.n_in) - 1, c["matrix"]),
|
matrix=_int(s.get("matrix"), 0, (1 << model.n_in) - 1, c["matrix"]),
|
||||||
mix=[_int(mix[k], 0, 400, v) if k < len(mix) else v for k, v in enumerate(c["mix"])])
|
mix=[_int(mix[k], 0, 400, v) if k < len(mix) else v for k, v in enumerate(c["mix"])])
|
||||||
|
if model.fir:
|
||||||
|
c["fir"] = P.clean_fir(s.get("fir"), c["fir"])
|
||||||
|
else:
|
||||||
|
c.update(comp=_group(s.get("comp"), c["comp"], _COMP))
|
||||||
if isinstance(src.get("preset_name"), str):
|
if isinstance(src.get("preset_name"), str):
|
||||||
st["preset_name"] = src["preset_name"][:14]
|
st["preset_name"] = src["preset_name"][:14]
|
||||||
return st
|
return st
|
||||||
@@ -131,11 +140,11 @@ def import_commands(model: P.Model, st: dict, current: dict) -> list[tuple[int,
|
|||||||
cmds.append((P.CMD_LINK, bytes([model.channel(kind, i)]) + (1 << i).to_bytes(2, "little")))
|
cmds.append((P.CMD_LINK, bytes([model.channel(kind, i)]) + (1 << i).to_bytes(2, "little")))
|
||||||
for kind, key in kinds:
|
for kind, key in kinds:
|
||||||
for i, ch in enumerate(st[key]):
|
for i, ch in enumerate(st[key]):
|
||||||
params = ["name", "gain", "polarity", "delay", "hp", "lp"] + [f"peq.{b}" for b in range(len(ch["peq"]))]
|
params = ["name", "gain", "polarity", "delay"] + [k for k in ("hp", "lp", "peq_bypass") if k in ch] + [f"peq.{b}" for b in range(len(ch["peq"]))]
|
||||||
if kind == "in":
|
if kind == "in":
|
||||||
params += [f"geq.{b}" for b in range(len(ch["geq"]))] + ["gate"]
|
params += ["gate", "comp", "fir"] if model.fir else [f"geq.{b}" for b in range(len(ch["geq"]))] + ["gate", "geq_bypass"]
|
||||||
else:
|
else:
|
||||||
params += ["comp", "limit", "matrix"] + [f"mix.{k}" for k in range(len(ch["mix"]))]
|
params += (["fir", "limit"] if model.fir else ["comp", "limit"]) + ["matrix"] + [f"mix.{k}" for k in range(len(ch["mix"]))]
|
||||||
for p in params + ["mute"]:
|
for p in params + ["mute"]:
|
||||||
cmd = P.param_command(model, kind, i, ch, p)
|
cmd = P.param_command(model, kind, i, ch, p)
|
||||||
if relink or cmd != P.param_command(model, kind, i, current[key][i], p):
|
if relink or cmd != P.param_command(model, kind, i, current[key][i], p):
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import math
|
import math
|
||||||
|
import re
|
||||||
import struct
|
import struct
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ PORT = 9761
|
|||||||
# Read / system commands
|
# Read / system commands
|
||||||
CMD_ACK = 0x01
|
CMD_ACK = 0x01
|
||||||
CMD_HANDSHAKE = 0x10
|
CMD_HANDSHAKE = 0x10
|
||||||
|
CMD_LOGOUT = 0x11 # sent after setting a lock code
|
||||||
CMD_STATUS = 0x12
|
CMD_STATUS = 0x12
|
||||||
CMD_DEVICE_INFO = 0x13
|
CMD_DEVICE_INFO = 0x13
|
||||||
CMD_INIT_14 = 0x14
|
CMD_INIT_14 = 0x14
|
||||||
@@ -20,7 +22,12 @@ CMD_CONFIG_CHUNK = 0x24
|
|||||||
CMD_PRESET_STORE_NAME = 0x26
|
CMD_PRESET_STORE_NAME = 0x26
|
||||||
CMD_CONFIG_REQUEST = 0x27
|
CMD_CONFIG_REQUEST = 0x27
|
||||||
CMD_PRESET_NAME = 0x29
|
CMD_PRESET_NAME = 0x29
|
||||||
CMD_PRESET_COUNT = 0x2C
|
CMD_PRESET_COUNT = 0x2C # answer: [time lock][4 bytes time lock data][device lock] (see device_locked)
|
||||||
|
CMD_UNLOCK = 0x2D # [0][code 4] -> answer [0][1 = unlocked, 0 = wrong code]
|
||||||
|
CMD_SET_LOCK_CODE = 0x2F # [code 4]
|
||||||
|
CMD_PEQ_BYPASS = 0x3C # [ch][1 = all PEQ bands bypassed]
|
||||||
|
CMD_GEQ_BYPASS = 0x49 # [ch][1 = GEQ bypassed] (inputs)
|
||||||
|
CMD_TEST_SIGNAL = 0x39 # [source][freq index]: 0 = analog input, 1 = pink noise, 2 = white noise, 3 = sine
|
||||||
CMD_METER = 0x40
|
CMD_METER = 0x40
|
||||||
|
|
||||||
# Parameter commands
|
# Parameter commands
|
||||||
@@ -39,8 +46,20 @@ CMD_LIMIT = 0x3F
|
|||||||
CMD_MIX = 0x41
|
CMD_MIX = 0x41
|
||||||
CMD_GEQ = 0x48
|
CMD_GEQ = 0x48
|
||||||
CMD_LINK = 0x3B # [ch][u16 link mask], see link_masks()
|
CMD_LINK = 0x3B # [ch][u16 link mask], see link_masks()
|
||||||
|
# FIR DSP 408 only
|
||||||
|
CMD_FIR = 0x4B # [ch][type][window][u16 low Hz][u16 high Hz][u16 taps index] (outputs)
|
||||||
|
CMD_FIR_COEF = 0x4E # [ch][packet][u16 total][up to 12 floats, most significant byte first]
|
||||||
|
CMD_FIR_BYPASS = 0x4F # [ch][1 = bypassed] (inputs)
|
||||||
|
CMD_FIR_NAME = 0x5B # [ch][8 characters]
|
||||||
|
|
||||||
CHUNK_SIZE = 50
|
CHUNK_SIZE = 50
|
||||||
|
TEST_SOURCES = ("analog", "pink", "white", "sine")
|
||||||
|
LOCK_CODE = re.compile(r"[A-Z0-9]{4}") # device lock code: 4 characters, digits and upper-case letters
|
||||||
|
|
||||||
|
|
||||||
|
def device_locked(count_payload: bytes) -> bool:
|
||||||
|
"""True if the answer to CMD_PRESET_COUNT says the DSP waits for its lock code."""
|
||||||
|
return len(count_payload) > 5 and count_payload[5] != 0
|
||||||
|
|
||||||
|
|
||||||
def checksum(data: bytes) -> int:
|
def checksum(data: bytes) -> int:
|
||||||
@@ -195,14 +214,16 @@ class Model:
|
|||||||
name: str
|
name: str
|
||||||
n_in: int
|
n_in: int
|
||||||
n_out: int
|
n_out: int
|
||||||
|
beta: bool = False # never seen on a real device; only selectable by hand
|
||||||
|
fir: bool = False # FIR DSP 408: own memory layout, see _parse_fir
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def in_size(self) -> int:
|
def in_size(self) -> int:
|
||||||
return 140
|
return 138 if self.fir else 140
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def out_size(self) -> int:
|
def out_size(self) -> int:
|
||||||
return 96 + 2 * self.n_in
|
return 108 if self.fir else 96 + 2 * self.n_in
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def out_base(self) -> int:
|
def out_base(self) -> int:
|
||||||
@@ -212,8 +233,15 @@ class Model:
|
|||||||
def globals_base(self) -> int:
|
def globals_base(self) -> int:
|
||||||
return self.out_base + self.n_out * self.out_size
|
return self.out_base + self.n_out * self.out_size
|
||||||
|
|
||||||
|
@property
|
||||||
|
def test_base(self) -> int:
|
||||||
|
"""Test signal (source, sine frequency index), after the mute masks and one word per channel."""
|
||||||
|
return self.globals_base + 4 + 2 * self.n_in + 2 * self.n_out
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def size(self) -> int:
|
def size(self) -> int:
|
||||||
|
if self.fir:
|
||||||
|
return 0x625
|
||||||
return self.globals_base + 4 + 2 * self.n_in + 2 * self.n_out + 12
|
return self.globals_base + 4 + 2 * self.n_in + 2 * self.n_out + 12
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -228,12 +256,20 @@ class Model:
|
|||||||
return idx if kind == "in" else 4 + idx
|
return idx if kind == "in" else 4 + idx
|
||||||
|
|
||||||
|
|
||||||
MODELS = {"204": Model("DSP 204", 2, 4), "408": Model("DSP 408", 4, 8)}
|
MODELS = {"204": Model("DSP 204", 2, 4), "408": Model("DSP 408", 4, 8),
|
||||||
|
"206": Model("DSP 206", 2, 6, beta=True), "408fir": Model("FIR DSP 408", 4, 8, beta=True, fir=True)}
|
||||||
|
|
||||||
|
FIR_MAX_IN, FIR_MAX_OUT, FIR_MAX_TOTAL = 2048, 1024, 4096 # taps per input / output, all channels together
|
||||||
|
FIR_PACKET = 12 # coefficients per CMD_FIR_COEF frame
|
||||||
|
|
||||||
|
|
||||||
def detect_model(info: str) -> str | None:
|
def detect_model(info: str) -> str | None:
|
||||||
for key in MODELS:
|
"""Beta models are never detected, and a FIR device must not pass as a plain DSP 408."""
|
||||||
if f"DSP{key}" in info.replace(" ", ""):
|
info = info.replace(" ", "").upper()
|
||||||
|
if "FIR" in info:
|
||||||
|
return None
|
||||||
|
for key, model in MODELS.items():
|
||||||
|
if not model.beta and f"DSP{key}" in info:
|
||||||
return key
|
return key
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -264,6 +300,8 @@ def _peq(buf: bytes, off: int, n: int) -> list[dict]:
|
|||||||
|
|
||||||
def parse_state(model: Model, buf: bytes) -> dict:
|
def parse_state(model: Model, buf: bytes) -> dict:
|
||||||
"""Decode the reassembled config dump into a JSON friendly dict (raw values)."""
|
"""Decode the reassembled config dump into a JSON friendly dict (raw values)."""
|
||||||
|
if model.fir:
|
||||||
|
return _parse_fir(model, buf)
|
||||||
u16 = lambda off: struct.unpack_from("<H", buf, off)[0]
|
u16 = lambda off: struct.unpack_from("<H", buf, off)[0]
|
||||||
g = model.globals_base
|
g = model.globals_base
|
||||||
in_mute, out_mute = u16(g), u16(g + 2)
|
in_mute, out_mute = u16(g), u16(g + 2)
|
||||||
@@ -305,11 +343,216 @@ def parse_state(model: Model, buf: bytes) -> dict:
|
|||||||
"link": u16(p + 84),
|
"link": u16(p + 84),
|
||||||
"mute": bool(out_mute >> i & 1),
|
"mute": bool(out_mute >> i & 1),
|
||||||
})
|
})
|
||||||
return {"preset_name": _name(buf[2:16]), "inputs": inputs, "outputs": outputs}
|
source, freq, _, peq_in, peq_out, geq_in = struct.unpack_from("<6H", buf, model.test_base)
|
||||||
|
test = {"source": source if source < len(TEST_SOURCES) else 0, "freq": freq if freq < 31 else 0}
|
||||||
|
for i, ch in enumerate(inputs):
|
||||||
|
ch["peq_bypass"], ch["geq_bypass"] = bool(peq_in >> i & 1), bool(geq_in >> i & 1)
|
||||||
|
for i, ch in enumerate(outputs):
|
||||||
|
ch["peq_bypass"] = bool(peq_out >> i & 1)
|
||||||
|
return {"preset_name": _name(buf[2:16]), "inputs": inputs, "outputs": outputs, "test": test}
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------- FIR DSP 408
|
||||||
|
#
|
||||||
|
# Layout: header 0x10, inputs of 138 bytes, outputs of 108, then the mute masks, one word per channel with
|
||||||
|
# the bypassed PEQ bands, 8 characters of FIR name per channel and 17 bytes of other settings.
|
||||||
|
# Inputs: name, gate, 3 dynamic EQs (not used here), 8 PEQ bands, compressor, FIR taps + bypass, gain ...
|
||||||
|
# Outputs: name, matrix, mix, HP/LP (with own bypass bytes), FIR, 9 PEQ bands, limiter, gain ...
|
||||||
|
|
||||||
|
|
||||||
|
def _fir_slope(index: int, bypass: int) -> int:
|
||||||
|
"""This model keeps slope and bypass apart, the state uses one value (0 = bypass) like the other models."""
|
||||||
|
return 0 if bypass else min(index + 1, 20)
|
||||||
|
|
||||||
|
|
||||||
|
def _fir_filter(buf: bytes, freq_off: int, slope_off: int) -> dict:
|
||||||
|
return {"freq": struct.unpack_from("<H", buf, freq_off)[0], "slope": _fir_slope(buf[slope_off], buf[slope_off + 2])}
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_fir(model: Model, buf: bytes) -> dict:
|
||||||
|
u16 = lambda off: struct.unpack_from("<H", buf, off)[0]
|
||||||
|
g = model.globals_base
|
||||||
|
in_mute, out_mute = u16(g), u16(g + 2)
|
||||||
|
fir_name = lambda c: _name(buf[0x5B4 + 8 * c : 0x5BC + 8 * c])
|
||||||
|
|
||||||
|
def bands(off: int, n: int, mask: int) -> list[dict]:
|
||||||
|
out = _peq(buf, off, n)
|
||||||
|
for j, b in enumerate(out):
|
||||||
|
b["bypass"] = bool(mask >> j & 1)
|
||||||
|
return out
|
||||||
|
|
||||||
|
inputs = []
|
||||||
|
for i in range(model.n_in):
|
||||||
|
o = 0x10 + i * model.in_size
|
||||||
|
comp = dict(zip(("ratio", "attack", "release", "knee", "threshold", "eq_freq"), struct.unpack_from("<6H", buf, o + 112)))
|
||||||
|
inputs.append({
|
||||||
|
"name": _name(buf[o : o + 8]),
|
||||||
|
"gate": dict(zip(("attack", "release", "hold", "threshold"), struct.unpack_from("<4H", buf, o + 8))),
|
||||||
|
"peq": bands(o + 64, 8, u16(g + 4 + 2 * i)),
|
||||||
|
"comp": {**comp, "eq_type": buf[o + 124], "eq_bypass": buf[o + 125]},
|
||||||
|
"fir": {"taps": u16(o + 126), "bypass": bool(u16(o + 128)), "name": fir_name(i)},
|
||||||
|
"gain": u16(o + 130), "polarity": u16(o + 132) != 0, "delay": u16(o + 134), "link": u16(o + 136),
|
||||||
|
"mute": bool(in_mute >> i & 1),
|
||||||
|
})
|
||||||
|
outputs = []
|
||||||
|
for i in range(model.n_out):
|
||||||
|
o = model.out_base + i * model.out_size
|
||||||
|
typ, win, low, high, taps = struct.unpack_from("<BBHHH", buf, o + 28)
|
||||||
|
outputs.append({
|
||||||
|
"name": _name(buf[o : o + 8]),
|
||||||
|
"matrix": u16(o + 8),
|
||||||
|
"mix": list(struct.unpack_from(f"<{model.n_in}H", buf, o + 10)),
|
||||||
|
"hp": _fir_filter(buf, o + 20, o + 24),
|
||||||
|
"lp": _fir_filter(buf, o + 22, o + 25),
|
||||||
|
"fir": {"type": typ, "window": win, "low": low, "high": high, "taps": taps, "name": fir_name(model.channel("out", i))},
|
||||||
|
"peq": bands(o + 36, 9, u16(g + 12 + 2 * i)),
|
||||||
|
"limit": dict(zip(("ratio", "attack", "release", "knee", "threshold"), struct.unpack_from("<5H", buf, o + 90))),
|
||||||
|
"gain": u16(o + 100), "polarity": u16(o + 102) != 0, "delay": u16(o + 104), "link": u16(o + 106),
|
||||||
|
"mute": bool(out_mute >> i & 1),
|
||||||
|
})
|
||||||
|
return {"preset_name": _name(buf[2:16]), "inputs": inputs, "outputs": outputs, "test": {"source": 0, "freq": 0}}
|
||||||
|
|
||||||
|
|
||||||
|
def _build_fir(model: Model, state: dict) -> bytearray:
|
||||||
|
buf = bytearray(model.chunks * CHUNK_SIZE)
|
||||||
|
pad = lambda s, n: s.encode("latin1")[:n].ljust(n, b" ")
|
||||||
|
buf[0:2] = b"\xff\xff"
|
||||||
|
buf[2:16] = pad(state["preset_name"], 14)
|
||||||
|
g = model.globals_base
|
||||||
|
|
||||||
|
def put_bands(off: int, bands: list[dict]) -> int:
|
||||||
|
for j, b in enumerate(bands):
|
||||||
|
struct.pack_into("<HHBB", buf, off + j * 6, b["gain"], b["freq"], b["q"], b["type"])
|
||||||
|
return sum(int(b.get("bypass", False)) << j for j, b in enumerate(bands))
|
||||||
|
|
||||||
|
in_mute = out_mute = 0
|
||||||
|
for i, ch in enumerate(state["inputs"]):
|
||||||
|
o = 0x10 + i * model.in_size
|
||||||
|
buf[o : o + 8] = pad(ch["name"], 8)
|
||||||
|
gt, c = ch["gate"], ch["comp"]
|
||||||
|
struct.pack_into("<4H", buf, o + 8, gt["attack"], gt["release"], gt["hold"], gt["threshold"])
|
||||||
|
struct.pack_into("<H", buf, g + 4 + 2 * i, put_bands(o + 64, ch["peq"]))
|
||||||
|
struct.pack_into("<6HBB", buf, o + 112, c["ratio"], c["attack"], c["release"], c["knee"], c["threshold"],
|
||||||
|
c["eq_freq"], c["eq_type"], c["eq_bypass"])
|
||||||
|
struct.pack_into("<6H", buf, o + 126, ch["fir"]["taps"], int(ch["fir"]["bypass"]), ch["gain"],
|
||||||
|
int(ch["polarity"]), ch["delay"], ch.get("link", 1 << i))
|
||||||
|
buf[0x5B4 + 8 * i : 0x5BC + 8 * i] = pad(ch["fir"]["name"], 8)
|
||||||
|
in_mute |= int(ch["mute"]) << i
|
||||||
|
for i, ch in enumerate(state["outputs"]):
|
||||||
|
o = model.out_base + i * model.out_size
|
||||||
|
buf[o : o + 8] = pad(ch["name"], 8)
|
||||||
|
struct.pack_into("<H", buf, o + 8, ch["matrix"])
|
||||||
|
struct.pack_into(f"<{model.n_in}H", buf, o + 10, *ch["mix"])
|
||||||
|
hp, lp, f, lim = ch["hp"], ch["lp"], ch["fir"], ch["limit"]
|
||||||
|
struct.pack_into("<HHBBBB", buf, o + 20, hp["freq"], lp["freq"], max(hp["slope"] - 1, 0), max(lp["slope"] - 1, 0),
|
||||||
|
int(not hp["slope"]), int(not lp["slope"]))
|
||||||
|
struct.pack_into("<BBHHH", buf, o + 28, f["type"], f["window"], f["low"], f["high"], f["taps"])
|
||||||
|
struct.pack_into("<H", buf, g + 12 + 2 * i, put_bands(o + 36, ch["peq"]))
|
||||||
|
struct.pack_into("<5H", buf, o + 90, lim["ratio"], lim["attack"], lim["release"], lim["knee"], lim["threshold"])
|
||||||
|
struct.pack_into("<4H", buf, o + 100, ch["gain"], int(ch["polarity"]), ch["delay"], ch.get("link", 1 << i))
|
||||||
|
c = model.channel("out", i)
|
||||||
|
buf[0x5B4 + 8 * c : 0x5BC + 8 * c] = pad(f["name"], 8)
|
||||||
|
out_mute |= int(ch["mute"]) << i
|
||||||
|
struct.pack_into("<HH", buf, g, in_mute, out_mute)
|
||||||
|
return buf
|
||||||
|
|
||||||
|
|
||||||
|
def _default_fir(model: Model) -> dict:
|
||||||
|
peq = lambda n: [{"gain": 120, "freq": 50 + i * 25, "q": 32, "type": 0, "bypass": False} for i in range(n)]
|
||||||
|
return {
|
||||||
|
"preset_name": "Default",
|
||||||
|
"inputs": [{
|
||||||
|
"name": f"In{chr(65 + i)}", "gate": {"attack": 0, "release": 99, "hold": 99, "threshold": 0}, "peq": peq(8),
|
||||||
|
"comp": {"ratio": 0, "attack": 49, "release": 99, "knee": 0, "threshold": 120, "eq_freq": 150, "eq_type": 0, "eq_bypass": 1},
|
||||||
|
"fir": {"taps": 0, "bypass": True, "name": ""},
|
||||||
|
"gain": 280, "polarity": False, "delay": 0, "mute": False, "link": 1 << i,
|
||||||
|
} for i in range(model.n_in)],
|
||||||
|
"outputs": [{
|
||||||
|
"name": f"Out{i + 1}", "matrix": 1 << (i % model.n_in), "mix": [280] * model.n_in,
|
||||||
|
"hp": {"freq": 0, "slope": 0}, "lp": {"freq": 300, "slope": 0},
|
||||||
|
"fir": {"type": 0, "window": 3, "low": 150, "high": 20000, "taps": 8, "name": ""},
|
||||||
|
"peq": peq(9), "limit": {"ratio": 0, "attack": 49, "release": 99, "knee": 0, "threshold": 200},
|
||||||
|
"gain": 280, "polarity": False, "delay": 0, "mute": False, "link": 1 << i,
|
||||||
|
} for i in range(model.n_out)],
|
||||||
|
"test": {"source": 0, "freq": 0},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def fir_channel_taps(ch: dict) -> int:
|
||||||
|
"""How many of the shared FIR taps a channel takes."""
|
||||||
|
f = ch["fir"]
|
||||||
|
if "type" in f:
|
||||||
|
return 256 + 32 * f["taps"] if f["type"] else 0
|
||||||
|
return 0 if f["bypass"] else f["taps"]
|
||||||
|
|
||||||
|
|
||||||
|
def clean_fir(value, cur: dict) -> dict:
|
||||||
|
"""FIR settings of an output limited to valid values; anything missing stays as it is."""
|
||||||
|
value = value if isinstance(value, dict) else {}
|
||||||
|
|
||||||
|
def num(key, lo, hi):
|
||||||
|
try:
|
||||||
|
return min(hi, max(lo, int(value.get(key, cur[key]))))
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
return cur[key]
|
||||||
|
|
||||||
|
return {"type": num("type", 0, 4), "window": num("window", 0, 10), "low": num("low", 20, 20000),
|
||||||
|
"high": num("high", 20, 20000), "taps": num("taps", 0, 24), "name": cur.get("name", "")}
|
||||||
|
|
||||||
|
|
||||||
|
def fir_coef_frames(channel: int, coeffs: list[float]) -> list[bytes]:
|
||||||
|
"""Payloads of the CMD_FIR_COEF frames for one channel."""
|
||||||
|
n = len(coeffs)
|
||||||
|
return [bytes([channel, p]) + struct.pack("<H", n)
|
||||||
|
+ b"".join(struct.pack(">f", c) for c in coeffs[p * FIR_PACKET : (p + 1) * FIR_PACKET])
|
||||||
|
for p in range(-(-n // FIR_PACKET))]
|
||||||
|
|
||||||
|
|
||||||
|
def _fir_command(c: int, kind: str, ch: dict, top: str, rest: list[str]) -> tuple[int, bytes] | None:
|
||||||
|
if top in ("hp", "lp"):
|
||||||
|
f = ch[top]
|
||||||
|
return (CMD_HIGH_PASS if top == "hp" else CMD_LOW_PASS), bytes([c]) + _w(f["freq"]) + bytes([max(f["slope"] - 1, 0), int(not f["slope"])])
|
||||||
|
if top == "limit" and kind == "out":
|
||||||
|
return CMD_LIMIT, bytes([c]) + b"".join(_w(ch["limit"][k]) for k in ("ratio", "attack", "release", "knee", "threshold"))
|
||||||
|
if top == "comp" and kind == "in":
|
||||||
|
g = ch["comp"]
|
||||||
|
return CMD_COMP, bytes([c]) + b"".join(_w(g[k]) for k in ("ratio", "attack", "release", "knee", "threshold", "eq_freq")) + bytes([g["eq_type"], g["eq_bypass"]])
|
||||||
|
if top == "fir" and kind == "out":
|
||||||
|
f = ch["fir"]
|
||||||
|
return CMD_FIR, bytes([c, f["type"], f["window"]]) + _w(f["low"]) + _w(f["high"]) + _w(f["taps"])
|
||||||
|
if top == "fir" and kind == "in":
|
||||||
|
return CMD_FIR_BYPASS, bytes([c, int(ch["fir"]["bypass"])])
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _apply_fir(ch: dict, cmd: int, p: bytes) -> bool:
|
||||||
|
"""Set commands of this model (simulator). False: handled like on the other models."""
|
||||||
|
w = lambda o: struct.unpack_from("<H", p, o)[0]
|
||||||
|
if cmd in (CMD_HIGH_PASS, CMD_LOW_PASS):
|
||||||
|
ch["hp" if cmd == CMD_HIGH_PASS else "lp"] = {"freq": w(1), "slope": _fir_slope(p[3], p[4])}
|
||||||
|
elif cmd == CMD_LIMIT:
|
||||||
|
ch["limit"] = dict(zip(("ratio", "attack", "release", "knee", "threshold"), struct.unpack_from("<5H", p, 1)))
|
||||||
|
elif cmd == CMD_COMP:
|
||||||
|
ch["comp"] = {**dict(zip(("ratio", "attack", "release", "knee", "threshold", "eq_freq"), struct.unpack_from("<6H", p, 1))),
|
||||||
|
"eq_type": p[13], "eq_bypass": p[14]}
|
||||||
|
elif cmd == CMD_FIR:
|
||||||
|
ch["fir"].update(type=p[1], window=p[2], low=w(3), high=w(5), taps=w(7))
|
||||||
|
elif cmd == CMD_FIR_BYPASS:
|
||||||
|
ch["fir"]["bypass"] = bool(p[1])
|
||||||
|
elif cmd == CMD_FIR_NAME:
|
||||||
|
ch["fir"]["name"] = _name(p[1:9])
|
||||||
|
elif cmd == CMD_FIR_COEF:
|
||||||
|
if "bypass" in ch["fir"]:
|
||||||
|
ch["fir"]["taps"] = w(2)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def build_state_buffer(model: Model, state: dict) -> bytearray:
|
def build_state_buffer(model: Model, state: dict) -> bytearray:
|
||||||
"""Inverse of parse_state (used by the simulator)."""
|
"""Inverse of parse_state (used by the simulator)."""
|
||||||
|
if model.fir:
|
||||||
|
return _build_fir(model, state)
|
||||||
buf = bytearray(model.chunks * CHUNK_SIZE)
|
buf = bytearray(model.chunks * CHUNK_SIZE)
|
||||||
pad = lambda s, n: s.encode("latin1")[:n].ljust(n, b" ")
|
pad = lambda s, n: s.encode("latin1")[:n].ljust(n, b" ")
|
||||||
buf[0:2] = b"\xff\xff"
|
buf[0:2] = b"\xff\xff"
|
||||||
@@ -349,10 +592,17 @@ def build_state_buffer(model: Model, state: dict) -> bytearray:
|
|||||||
struct.pack_into("<4H", buf, p + 78, ch["gain"], int(ch["polarity"]), ch["delay"], ch.get("link", 1 << i))
|
struct.pack_into("<4H", buf, p + 78, ch["gain"], int(ch["polarity"]), ch["delay"], ch.get("link", 1 << i))
|
||||||
out_mute |= int(ch["mute"]) << i
|
out_mute |= int(ch["mute"]) << i
|
||||||
struct.pack_into("<HH", buf, model.globals_base, in_mute, out_mute)
|
struct.pack_into("<HH", buf, model.globals_base, in_mute, out_mute)
|
||||||
|
test = state.get("test") or {}
|
||||||
|
mask = lambda chans, key: sum(int(bool(ch.get(key))) << i for i, ch in enumerate(chans))
|
||||||
|
struct.pack_into("<HH", buf, model.test_base, test.get("source", 0), test.get("freq", 0))
|
||||||
|
struct.pack_into("<3H", buf, model.test_base + 6, mask(state["inputs"], "peq_bypass"),
|
||||||
|
mask(state["outputs"], "peq_bypass"), mask(state["inputs"], "geq_bypass"))
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
def default_state(model: Model) -> dict:
|
def default_state(model: Model) -> dict:
|
||||||
|
if model.fir:
|
||||||
|
return _default_fir(model)
|
||||||
peq = lambda n: [{"gain": 120, "freq": 50 + i * 25, "q": 32, "type": 0, "bypass": False}
|
peq = lambda n: [{"gain": 120, "freq": 50 + i * 25, "q": 32, "type": 0, "bypass": False}
|
||||||
for i in range(n)]
|
for i in range(n)]
|
||||||
return {
|
return {
|
||||||
@@ -361,15 +611,16 @@ def default_state(model: Model) -> dict:
|
|||||||
"name": f"In{chr(65 + i)}", "gate": {"attack": 0, "release": 99, "hold": 99, "threshold": 0},
|
"name": f"In{chr(65 + i)}", "gate": {"attack": 0, "release": 99, "hold": 99, "threshold": 0},
|
||||||
"geq": [120] * 31, "peq": peq(8), "hp": {"freq": 0, "slope": 0},
|
"geq": [120] * 31, "peq": peq(8), "hp": {"freq": 0, "slope": 0},
|
||||||
"lp": {"freq": 300, "slope": 0}, "gain": 280, "polarity": False, "delay": 0, "mute": False,
|
"lp": {"freq": 300, "slope": 0}, "gain": 280, "polarity": False, "delay": 0, "mute": False,
|
||||||
"link": 1 << i,
|
"link": 1 << i, "peq_bypass": False, "geq_bypass": False,
|
||||||
} for i in range(model.n_in)],
|
} for i in range(model.n_in)],
|
||||||
"outputs": [{
|
"outputs": [{
|
||||||
"name": f"Out{i + 1}", "matrix": 1 << (i % model.n_in), "mix": [280] * model.n_in,
|
"name": f"Out{i + 1}", "matrix": 1 << (i % model.n_in), "mix": [280] * model.n_in,
|
||||||
"hp": {"freq": 0, "slope": 0}, "lp": {"freq": 300, "slope": 0}, "peq": peq(9),
|
"hp": {"freq": 0, "slope": 0}, "lp": {"freq": 300, "slope": 0}, "peq": peq(9),
|
||||||
"comp": {"ratio": 0, "attack": 49, "release": 499, "knee": 0, "threshold": 220},
|
"comp": {"ratio": 0, "attack": 49, "release": 499, "knee": 0, "threshold": 220},
|
||||||
"limit": {"attack": 49, "release": 499, "knee": 0, "threshold": 220},
|
"limit": {"attack": 49, "release": 499, "knee": 0, "threshold": 220},
|
||||||
"gain": 280, "polarity": False, "delay": 0, "mute": False, "link": 1 << i,
|
"gain": 280, "polarity": False, "delay": 0, "mute": False, "link": 1 << i, "peq_bypass": False,
|
||||||
} for i in range(model.n_out)],
|
} for i in range(model.n_out)],
|
||||||
|
"test": {"source": 0, "freq": 17},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -434,6 +685,8 @@ def param_command(model: Model, kind: str, idx: int, ch: dict, param: str) -> tu
|
|||||||
"""
|
"""
|
||||||
c = model.channel(kind, idx)
|
c = model.channel(kind, idx)
|
||||||
top, *rest = param.split(".")
|
top, *rest = param.split(".")
|
||||||
|
if model.fir and (fir := _fir_command(c, kind, ch, top, rest)):
|
||||||
|
return fir
|
||||||
if top == "gain":
|
if top == "gain":
|
||||||
return CMD_GAIN, bytes([c]) + _w(ch["gain"])
|
return CMD_GAIN, bytes([c]) + _w(ch["gain"])
|
||||||
if top == "mute":
|
if top == "mute":
|
||||||
@@ -452,6 +705,10 @@ def param_command(model: Model, kind: str, idx: int, ch: dict, param: str) -> tu
|
|||||||
b = ch["peq"][band]
|
b = ch["peq"][band]
|
||||||
return CMD_PEQ, bytes([c, band]) + _w(b["gain"]) + _w(b["freq"]) + bytes(
|
return CMD_PEQ, bytes([c, band]) + _w(b["gain"]) + _w(b["freq"]) + bytes(
|
||||||
[b["q"], b["type"], int(b["bypass"])])
|
[b["q"], b["type"], int(b["bypass"])])
|
||||||
|
if top == "peq_bypass":
|
||||||
|
return CMD_PEQ_BYPASS, bytes([c, int(ch["peq_bypass"])])
|
||||||
|
if top == "geq_bypass" and kind == "in":
|
||||||
|
return CMD_GEQ_BYPASS, bytes([c, int(ch["geq_bypass"])])
|
||||||
if top == "geq" and kind == "in":
|
if top == "geq" and kind == "in":
|
||||||
band = int(rest[0])
|
band = int(rest[0])
|
||||||
return CMD_GEQ, bytes([c, band]) + _w(ch["geq"][band])
|
return CMD_GEQ, bytes([c, band]) + _w(ch["geq"][band])
|
||||||
@@ -490,6 +747,9 @@ def apply_command(model: Model, state: dict, cmd: int, p: bytes):
|
|||||||
"""Update state from an incoming set command (used by the simulator)."""
|
"""Update state from an incoming set command (used by the simulator)."""
|
||||||
if not p:
|
if not p:
|
||||||
return
|
return
|
||||||
|
if cmd == CMD_TEST_SIGNAL:
|
||||||
|
state["test"] = {"source": p[0], "freq": p[1] if len(p) > 1 else 0}
|
||||||
|
return
|
||||||
c = p[0]
|
c = p[0]
|
||||||
kind, idx = ("in", c) if c < model.n_in else ("out", c - model.n_in)
|
kind, idx = ("in", c) if c < model.n_in else ("out", c - model.n_in)
|
||||||
chans = state["inputs" if kind == "in" else "outputs"]
|
chans = state["inputs" if kind == "in" else "outputs"]
|
||||||
@@ -497,7 +757,13 @@ def apply_command(model: Model, state: dict, cmd: int, p: bytes):
|
|||||||
return
|
return
|
||||||
ch = chans[idx]
|
ch = chans[idx]
|
||||||
w = lambda o: struct.unpack_from("<H", p, o)[0]
|
w = lambda o: struct.unpack_from("<H", p, o)[0]
|
||||||
if cmd == CMD_GAIN:
|
if model.fir and _apply_fir(ch, cmd, p):
|
||||||
|
pass
|
||||||
|
elif cmd == CMD_PEQ_BYPASS:
|
||||||
|
ch["peq_bypass"] = bool(p[1])
|
||||||
|
elif cmd == CMD_GEQ_BYPASS:
|
||||||
|
ch["geq_bypass"] = bool(p[1])
|
||||||
|
elif cmd == CMD_GAIN:
|
||||||
ch["gain"] = w(1)
|
ch["gain"] = w(1)
|
||||||
elif cmd == CMD_MUTE:
|
elif cmd == CMD_MUTE:
|
||||||
ch["mute"] = bool(p[1])
|
ch["mute"] = bool(p[1])
|
||||||
|
|||||||
@@ -58,6 +58,6 @@ pyinstaller("--name", "DSP Control", "--icon", str(ROOT / "packaging" / "dsp-con
|
|||||||
*data("static", "static"), str(ROOT / "desktop.py"))
|
*data("static", "static"), str(ROOT / "desktop.py"))
|
||||||
|
|
||||||
pyinstaller("--name", "DSP Control Pi Writer", "--icon", str(ROOT / "packaging" / "pi-writer.ico"), "--uac-admin",
|
pyinstaller("--name", "DSP Control Pi Writer", "--icon", str(ROOT / "packaging" / "pi-writer.ico"), "--uac-admin",
|
||||||
*data("server.py"), *data("dsp", "dsp"), *data("static", "static"), str(ROOT / "pi_writer.py"))
|
*data("server.py"), *data("sim.py"), *data("dsp", "dsp"), *data("static", "static"), str(ROOT / "pi_writer.py"))
|
||||||
|
|
||||||
print("\nDone:", *(p.name for p in (ROOT / "dist").glob("*.exe")), sep="\n ")
|
print("\nDone:", *(p.name for p in (ROOT / "dist").glob("*.exe")), sep="\n ")
|
||||||
@@ -19,7 +19,7 @@ import server
|
|||||||
|
|
||||||
OS_LIST_URL = "https://downloads.raspberrypi.com/os_list_imagingutility_v4.json"
|
OS_LIST_URL = "https://downloads.raspberrypi.com/os_list_imagingutility_v4.json"
|
||||||
IMAGE_NAMES = {64: "Raspberry Pi OS Lite (64-bit)", 32: "Raspberry Pi OS Lite (32-bit)"}
|
IMAGE_NAMES = {64: "Raspberry Pi OS Lite (64-bit)", 32: "Raspberry Pi OS Lite (32-bit)"}
|
||||||
APP_FILES = ["server.py", "dsp", "static"] # what gets installed on the Pi
|
APP_FILES = ["server.py", "sim.py", "dsp", "static"] # what gets installed on the Pi
|
||||||
USER_AGENT = "DSP-Control-Pi-Writer/1.0"
|
USER_AGENT = "DSP-Control-Pi-Writer/1.0"
|
||||||
|
|
||||||
# Pi models offered in the writer: (name, description, os bits)
|
# Pi models offered in the writer: (name, description, os bits)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Usage: python sim.py --model 204 --port 9761
|
Usage: python sim.py --model 204 --port 9761
|
||||||
python sim.py --model 408 --port 9762
|
python sim.py --model 408 --port 9762
|
||||||
|
python sim.py --model 204 --port 9761 --lock A1BA (asks for that lock code on every connection)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -17,8 +18,10 @@ log = logging.getLogger("sim")
|
|||||||
|
|
||||||
|
|
||||||
class SimDSP:
|
class SimDSP:
|
||||||
def __init__(self, model_key: str):
|
def __init__(self, model_key: str, lock_code: str = ""):
|
||||||
self.key = model_key
|
self.key = model_key
|
||||||
|
self.lock_code = lock_code # hardware lock: "" = none
|
||||||
|
self.unlocked = not lock_code
|
||||||
self.model = P.MODELS[model_key]
|
self.model = P.MODELS[model_key]
|
||||||
self.state = P.default_state(self.model)
|
self.state = P.default_state(self.model)
|
||||||
self.presets = [copy.deepcopy(self.state) if i == 0 else None for i in range(20)]
|
self.presets = [copy.deepcopy(self.state) if i == 0 else None for i in range(20)]
|
||||||
@@ -31,9 +34,17 @@ class SimDSP:
|
|||||||
def handle(self, cmd: int, p: bytes) -> tuple[int, bytes]:
|
def handle(self, cmd: int, p: bytes) -> tuple[int, bytes]:
|
||||||
m = self.model
|
m = self.model
|
||||||
if cmd == P.CMD_DEVICE_INFO:
|
if cmd == P.CMD_DEVICE_INFO:
|
||||||
return cmd, f"DSP{self.key} V010 SIM".encode()
|
return cmd, f"{'FIR408' if m.fir else m.name.replace(' ', '')} V010 SIM".encode()
|
||||||
if cmd == P.CMD_PRESET_COUNT:
|
if cmd == P.CMD_PRESET_COUNT:
|
||||||
return cmd, bytes([0, len(self.presets)])
|
return cmd, bytes([0, 0, 0, 0, 0, 0 if self.unlocked else 1])
|
||||||
|
if cmd == P.CMD_UNLOCK:
|
||||||
|
self.unlocked = self.unlocked or p[1:5].decode("latin1") == self.lock_code
|
||||||
|
return cmd, bytes([0, 1 if self.unlocked else 0])
|
||||||
|
if cmd == P.CMD_SET_LOCK_CODE:
|
||||||
|
self.lock_code = p[:4].decode("latin1")
|
||||||
|
return P.CMD_ACK, b"\x00"
|
||||||
|
if not self.unlocked and cmd not in (P.CMD_HANDSHAKE, P.CMD_METER, P.CMD_LOGOUT):
|
||||||
|
return P.CMD_ACK, b"\x00" # locked: ignores everything until the code was entered
|
||||||
if cmd == P.CMD_PRESET_NAME:
|
if cmd == P.CMD_PRESET_NAME:
|
||||||
return cmd, bytes([p[0]]) + self.preset_names()[p[0]].encode("latin1").ljust(14, b" ")
|
return cmd, bytes([p[0]]) + self.preset_names()[p[0]].encode("latin1").ljust(14, b" ")
|
||||||
if cmd == P.CMD_CONFIG_REQUEST:
|
if cmd == P.CMD_CONFIG_REQUEST:
|
||||||
@@ -43,9 +54,11 @@ class SimDSP:
|
|||||||
if cmd == P.CMD_METER:
|
if cmd == P.CMD_METER:
|
||||||
t = time.monotonic()
|
t = time.monotonic()
|
||||||
levels = [0.0] * 12
|
levels = [0.0] * 12
|
||||||
|
noise = self.state.get("test", {}).get("source", 0) # test generator instead of the analog inputs
|
||||||
for i in range(m.n_in):
|
for i in range(m.n_in):
|
||||||
ch = self.state["inputs"][i]
|
ch = self.state["inputs"][i]
|
||||||
lv = 0.0 if ch["mute"] else 0.25 * (1 + math.sin(t * (1.3 + i))) * 10 ** (P.gain_to_db(ch["gain"]) / 20)
|
src = 0.7 + 0.05 * math.sin(t * 40 + i) if noise else 0.25 * (1 + math.sin(t * (1.3 + i)))
|
||||||
|
lv = 0.0 if ch["mute"] else src * 10 ** (P.gain_to_db(ch["gain"]) / 20)
|
||||||
levels[m.meter_index("in", i)] = lv
|
levels[m.meter_index("in", i)] = lv
|
||||||
flags = 0
|
flags = 0
|
||||||
for o in range(m.n_out):
|
for o in range(m.n_out):
|
||||||
@@ -72,6 +85,7 @@ class SimDSP:
|
|||||||
async def serve(self, reader, writer):
|
async def serve(self, reader, writer):
|
||||||
peer = writer.get_extra_info("peername")
|
peer = writer.get_extra_info("peername")
|
||||||
log.info("client %s connected", peer)
|
log.info("client %s connected", peer)
|
||||||
|
self.unlocked = not self.lock_code
|
||||||
parser = P.FrameParser()
|
parser = P.FrameParser()
|
||||||
try:
|
try:
|
||||||
while data := await reader.read(4096):
|
while data := await reader.read(4096):
|
||||||
@@ -92,9 +106,10 @@ async def main():
|
|||||||
ap.add_argument("--model", choices=list(P.MODELS), default="204")
|
ap.add_argument("--model", choices=list(P.MODELS), default="204")
|
||||||
ap.add_argument("--port", type=int, default=P.PORT)
|
ap.add_argument("--port", type=int, default=P.PORT)
|
||||||
ap.add_argument("--host", default="127.0.0.1")
|
ap.add_argument("--host", default="127.0.0.1")
|
||||||
|
ap.add_argument("--lock", default="", help="lock code (4 characters A-Z/0-9) the DSP asks for")
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
logging.basicConfig(level=logging.INFO, format=f"%(asctime)s sim{args.model} %(message)s")
|
logging.basicConfig(level=logging.INFO, format=f"%(asctime)s sim{args.model} %(message)s")
|
||||||
sim = SimDSP(args.model)
|
sim = SimDSP(args.model, args.lock.upper())
|
||||||
server = await asyncio.start_server(sim.serve, args.host, args.port)
|
server = await asyncio.start_server(sim.serve, args.host, args.port)
|
||||||
log.info("simulated DSP %s on %s:%d", args.model, args.host, args.port)
|
log.info("simulated DSP %s on %s:%d", args.model, args.host, args.port)
|
||||||
async with server:
|
async with server:
|
||||||
|
|||||||
@@ -0,0 +1,415 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Dashboard: an overview page built from modules, stored by the server as `dashboard` in config.json.
|
||||||
|
// Every module only looks: nothing here changes a DSP. Browsing (channel, EQ band) stays in this session.
|
||||||
|
|
||||||
|
const DASH_ROW = 40; // grid row + gap in px, see .dash
|
||||||
|
|
||||||
|
let dashEdit = false, dashTimer = 0, dashSaveTimer = 0;
|
||||||
|
// dragging modules around is no good on a touchscreen: there only their settings can be changed
|
||||||
|
const dashTouch = () => matchMedia("(pointer: coarse)").matches;
|
||||||
|
const dashBrowse = new Map(); // module id -> { kind, idx, band }
|
||||||
|
|
||||||
|
const dashMods = () => S.dash || (S.dash = []);
|
||||||
|
const dashDevs = () => S.order.map(id => S.devices[id]).filter(d => d && (!d.demo || S.demo.enabled));
|
||||||
|
// the chosen DSP, or the first one if it is gone (e.g. while demo mode is on)
|
||||||
|
const dashDev = m => S.devices[m.cfg.device] && dashDevs().includes(S.devices[m.cfg.device]) ? S.devices[m.cfg.device] : dashDevs()[0];
|
||||||
|
const offline = d => h("p", { class: "info dempty" }, d ? t("{name} is not connected.", { name: d.name }) : t("No DSP added yet."));
|
||||||
|
|
||||||
|
function dashSave() {
|
||||||
|
clearTimeout(dashSaveTimer);
|
||||||
|
dashSaveTimer = setTimeout(() => api("PUT", "/api/dashboard", { modules: dashMods() }).catch(e => toast(t("Error: ") + trMsg(e.message))), 300);
|
||||||
|
}
|
||||||
|
// parameter changes redraw the page, but not for every single step of a fader
|
||||||
|
function dashSoon() {
|
||||||
|
clearTimeout(dashTimer);
|
||||||
|
dashTimer = setTimeout(() => { if (S.view === "dash" && !S.settings) render(); }, 250);
|
||||||
|
}
|
||||||
|
function dashRemote(data) {
|
||||||
|
S.dash = data && data.modules ? data.modules : null;
|
||||||
|
if (S.view === "dash" && !S.settings && !S.busy) render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ modules
|
||||||
|
|
||||||
|
const dashKv = (k, v, cls = "") => h("div", { class: "dkv " + cls }, h("span", {}, k), h("b", {}, v));
|
||||||
|
const dashChannels = d => [...chans(d, "in").map((_, i) => ["in", i]), ...chans(d, "out").map((_, i) => ["out", i])];
|
||||||
|
|
||||||
|
// a channel of a module, browsed with the arrows
|
||||||
|
function dashSel(m, d) {
|
||||||
|
const all = dashChannels(d);
|
||||||
|
let s = dashBrowse.get(m.id);
|
||||||
|
if (!s) { s = { kind: m.cfg.kind || "in", idx: m.cfg.idx || 0, band: 0, overlay: !!(m.cfg.overlays || []).length }; dashBrowse.set(m.id, s); }
|
||||||
|
if (!all.some(([k, i]) => k === s.kind && i === s.idx)) { s.kind = all[0][0]; s.idx = all[0][1]; }
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
// arrows through the channels; the frequency response module has "Overlay" as one more entry, in front
|
||||||
|
function dashChannelNav(m, d, s, overlay = false) {
|
||||||
|
const all = [...(overlay ? [["overlay", 0]] : []), ...dashChannels(d)];
|
||||||
|
const at = all.findIndex(([k, i]) => (s.overlay ? k === "overlay" : k === s.kind && i === s.idx));
|
||||||
|
const go = dir => {
|
||||||
|
const [k, i] = all[(at + dir + all.length) % all.length];
|
||||||
|
s.overlay = k === "overlay";
|
||||||
|
if (!s.overlay) { s.kind = k; s.idx = i; }
|
||||||
|
s.band = 0; render();
|
||||||
|
};
|
||||||
|
return h("div", { class: "dnav" },
|
||||||
|
h("button", { class: "small", "data-view-ok": "", "aria-label": t("Previous channel"), onclick: () => go(-1) }, "‹"),
|
||||||
|
h("span", { class: "dnavname" }, s.overlay ? h("b", {}, "Overlay") : [h("b", {}, chLabel(s.kind, s.idx)), " ", chans(d, s.kind)[s.idx].name]),
|
||||||
|
h("button", { class: "small", "data-view-ok": "", "aria-label": t("Next channel"), onclick: () => go(1) }, "›"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// link groups in the level meters: a soft tile in the group colour behind the meters, the name at its top
|
||||||
|
function dashGroups(d, kind) {
|
||||||
|
const out = [];
|
||||||
|
linkedGroups(d, kind).forEach(g => {
|
||||||
|
const color = custColor(d, kind, g[0]) || linkInfo(d, kind, g[0]).color, name = linkName(d, kind, g);
|
||||||
|
const title = (name ? name + " · " : "") + g.map(i => chLabel(kind, i)).join(" + ");
|
||||||
|
g.forEach((j, n) => {
|
||||||
|
if (n && g[n - 1] === j - 1) return;
|
||||||
|
let len = 1;
|
||||||
|
while (g.includes(j + len)) len++;
|
||||||
|
const area = `--lc:${color};grid-column:${j + 1} / span ${len}`;
|
||||||
|
out.push(h("div", { class: "dgrp", style: area, title }));
|
||||||
|
if (name && len > 1) out.push(h("div", { class: "dgrpname", style: area, title }, name)); // a single meter has no room for it
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
const dashLabelColor = (d, k, i) => {
|
||||||
|
const l = linkInfo(d, k, i);
|
||||||
|
return l ? custColor(d, k, i) || l.color : custColor(d, k, i) || (k === "in" ? IN_COLORS[i] : "var(--warn)");
|
||||||
|
};
|
||||||
|
|
||||||
|
const DASH_MODULES = {
|
||||||
|
status: {
|
||||||
|
title: () => t("DSP overview"), w: 4, min: [3, 3], max: [12, 14], h: () => 2 + Math.ceil(dashDevs().length * 1.2), global: true,
|
||||||
|
icon: '<rect x="3" y="4" width="18" height="6" rx="1.5"/><rect x="3" y="14" width="18" height="6" rx="1.5"/><path d="M7 7h.01M7 17h.01"/>',
|
||||||
|
body() {
|
||||||
|
const list = dashDevs();
|
||||||
|
if (!list.length) return offline();
|
||||||
|
return h("div", { class: "dlist" }, list.map(d => h("button", { class: "drow dlink", "data-view-ok": "", title: t("Open in the mixer"),
|
||||||
|
onclick: () => { if (dashOnly()) return; S.cur = d.id; S.view = "mixer"; store.set("dsp.view", "mixer"); render(); window.scrollTo(0, 0); } },
|
||||||
|
h("span", { class: "dot " + d.status }),
|
||||||
|
h("span", { class: "grow dname" }, h("b", {}, d.name), h("small", {}, [MODEL_LABEL[d.detected_model || d.model] || "", d.state ? d.state.preset_name : (STATUS_TEXT[d.status] || d.status)].filter(Boolean).join(" · "))),
|
||||||
|
d.state && dashChannels(d).some(([k, i]) => chans(d, k)[i].mute) ? h("span", { class: "dtag mute" }, "MUTE") : null)));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
meters: {
|
||||||
|
title: () => t("Levels"), w: 8, min: [3, 5], max: [12, 14], h: 7,
|
||||||
|
icon: '<path d="M5 20V10M10 20V4M15 20v-7M20 20V8"/>',
|
||||||
|
body(m, d) {
|
||||||
|
// limiter as one more segment on top; inputs keep the room so all scales line up
|
||||||
|
const meter = (k, i) => {
|
||||||
|
const el = ledMeter(d.id, k, i);
|
||||||
|
el.append(k === "out" ? limLed(d.id, i, "seg") : h("span", { class: "limled seg ph", "aria-hidden": "true" }));
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
const col = (k, i) => h("div", { class: "dm" + (chans(d, k)[i].mute ? " muted" : ""), title: chTitle(d, k, i), style: `grid-column:${i + 1}` }, meter(k, i));
|
||||||
|
const numberOf = (k, i) => h("small", { class: "dmlab", style: `color:${dashLabelColor(d, k, i)};grid-column:${i + 1}` }, chLabel(k, i).replace("Out ", "").replace("In ", ""));
|
||||||
|
const group = (k, label) => h("div", { class: "dmgroup", style: `flex-grow:${chans(d, k).length}` }, h("div", { class: "sub" }, label), h("div", { class: "dms", style: `--n:${chans(d, k).length}` }, chans(d, k).map((_, i) => col(k, i)), dashGroups(d, k), chans(d, k).map((_, i) => numberOf(k, i))));
|
||||||
|
const named = ["in", "out"].some(k => linkedGroups(d, k).some(g => linkName(d, k, g)));
|
||||||
|
return h("div", { class: "dmeters" + (named ? " hasnames" : "") }, group("in", t("Inputs")), group("out", t("Outputs")));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mixer: {
|
||||||
|
title: () => t("Faders"), w: 4, min: [3, 4], max: [8, 14], h: d => (d && d.state ? 2 + Math.ceil(dashChannels(d).length * 0.8) : 5),
|
||||||
|
icon: '<path d="M6 3v18M12 3v18M18 3v18"/><rect x="3.5" y="13" width="5" height="3" rx="1"/><rect x="9.5" y="7" width="5" height="3" rx="1"/><rect x="15.5" y="10" width="5" height="3" rx="1"/>',
|
||||||
|
body(m, d) {
|
||||||
|
const row = (k, i) => {
|
||||||
|
const ch = chans(d, k)[i];
|
||||||
|
return h("div", { class: "drow dgain" + (ch.mute ? " muted" : ""), style: ccStyle(d, k, i) },
|
||||||
|
h("span", { class: "dlab" }, chLabel(k, i)),
|
||||||
|
h("span", { class: "dbar" }, h("i", { style: `width:${ch.gain / 4}%` }), h("u")),
|
||||||
|
h("span", { class: "dval" }, ch.mute ? "MUTE" : `${sign(gainDb(ch.gain))} dB`));
|
||||||
|
};
|
||||||
|
return h("div", { class: "dlist" }, chans(d, "in").map((_, i) => row("in", i)), h("hr"), chans(d, "out").map((_, i) => row("out", i)));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
curve: {
|
||||||
|
title: () => t("Frequency response"), w: 8, min: [4, 7], max: [12, 16], h: 9,
|
||||||
|
icon: '<path d="M2 14c3 0 3-7 6-7s3 10 6 10 3-6 6-6h2"/>',
|
||||||
|
body(m, d) {
|
||||||
|
const s = dashSel(m, d), ch = chans(d, s.kind)[s.idx];
|
||||||
|
if (s.band >= ch.peq.length) s.band = 0;
|
||||||
|
const canvas = h("canvas", { class: "dcurve" });
|
||||||
|
const shown = (m.cfg.overlays || []).map(key => {
|
||||||
|
const k = key.startsWith("in") ? "in" : "out", i = +key.replace(/\D/g, "");
|
||||||
|
return i < chans(d, k).length ? { k, i, ch: chans(d, k)[i], color: chColor(d, k, i) } : null;
|
||||||
|
}).filter(Boolean);
|
||||||
|
if (!shown.length) s.overlay = false;
|
||||||
|
const nav = dashChannelNav(m, d, s, shown.length > 0);
|
||||||
|
if (s.overlay) {
|
||||||
|
requestAnimationFrame(() => drawCurve(canvas, ch, -1, { mode: "mag", overlays: shown, overlaysOnly: true }));
|
||||||
|
return [nav, canvas, h("div", { class: "dlegend" }, shown.map(o => h("span", {}, h("i", { style: `background:${o.color}` }), chLabel(o.k, o.i))))];
|
||||||
|
}
|
||||||
|
requestAnimationFrame(() => drawCurve(canvas, ch, s.band, { mode: "mag", overlays: [] }));
|
||||||
|
const b = ch.peq[s.band];
|
||||||
|
return [nav, canvas,
|
||||||
|
h("div", { class: "dbands" }, ch.peq.map((bb, i) => h("button", { class: "dband" + (i === s.band ? " on" : "") + (bb.bypass ? " off" : "") + (bb.gain !== 120 ? " act" : ""), "data-view-ok": "",
|
||||||
|
onclick: () => { s.band = i; render(); } }, h("b", {}, i + 1), h("small", {}, fmtHzShort(freqHz(bb.freq)))))),
|
||||||
|
h("p", { class: "info dbandinfo" }, `${PEQ_TYPES[b.type]} · ${SPEC.freq.fmt(b.freq)} · ${sign((b.gain - 120) / 10)} dB · Q ${Q_TABLE[b.q]}${b.bypass ? " · Bypass" : ""}`)];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
channel: {
|
||||||
|
title: () => t("Channel"), w: 4, min: [3, 6], max: [8, 12], h: 9,
|
||||||
|
icon: '<circle cx="12" cy="12" r="8"/><path d="M12 8v4l3 2"/>',
|
||||||
|
body(m, d) {
|
||||||
|
const s = dashSel(m, d), ch = chans(d, s.kind)[s.idx];
|
||||||
|
const filt = f => (f && f.slope ? `${SLOPES[f.slope]} @ ${SPEC.freq.fmt(f.freq)}` : t("off"));
|
||||||
|
const on = ch.peq.filter(b => !b.bypass && b.gain !== 120).length;
|
||||||
|
return [dashChannelNav(m, d, s), h("div", { class: "dkvs" },
|
||||||
|
dashKv("Gain", ch.mute ? "MUTE" : SPEC.gain.fmt(ch.gain), ch.mute ? "bad" : ""),
|
||||||
|
dashKv("Delay", SPEC.delay.fmt(ch.delay)),
|
||||||
|
dashKv("Phase", ch.polarity ? "180°" : "0°"),
|
||||||
|
ch.hp ? dashKv(t("High-pass"), filt(ch.hp)) : null,
|
||||||
|
ch.lp ? dashKv(t("Low-pass"), filt(ch.lp)) : null,
|
||||||
|
dashKv("EQ", on ? t("{n} bands active", { n: on }) : t("flat")),
|
||||||
|
s.kind === "out" ? dashKv(t("Sources"), chans(d, "in").map((_, i) => (ch.matrix >> i & 1 ? chLabel("in", i) : "")).filter(Boolean).join(", ") || "–") : null,
|
||||||
|
s.kind === "out" ? dashKv("Limiter", SPEC.thresh.fmt(ch.limit.threshold)) : null,
|
||||||
|
s.kind === "in" ? dashKv("Gate", SPEC.gthresh.fmt(ch.gate.threshold)) : null)];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
limiter: {
|
||||||
|
title: () => "Limiter", w: 4, min: [3, 3], max: [8, 12], h: d => (d && d.state ? 2 + Math.ceil(chans(d, "out").length * 0.8) : 5),
|
||||||
|
icon: '<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"/>',
|
||||||
|
body(m, d) {
|
||||||
|
return h("div", { class: "dlist" }, chans(d, "out").map((ch, o) => {
|
||||||
|
const c = limCalc(d.id, o, ch.limit.threshold);
|
||||||
|
return h("div", { class: "drow" }, limLed(d.id, o, "txt"), h("span", { class: "dlab" }, chLabel("out", o)),
|
||||||
|
h("span", { class: "grow dsub" }, c ? c.amp.name : ""),
|
||||||
|
h("b", { class: "dval" }, c ? fmtW(c.p) : SPEC.thresh.fmt(ch.limit.threshold)));
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
routing: {
|
||||||
|
title: () => "Routing", w: 4, min: [3, 3], max: [8, 12], h: d => (d && d.state ? 2 + Math.ceil((chans(d, "out").length + 1) * 0.5) : 5),
|
||||||
|
icon: '<path d="M4 6h16M4 12h16M4 18h16M8 3v18M16 3v18"/>',
|
||||||
|
body(m, d) {
|
||||||
|
const ins = chans(d, "in");
|
||||||
|
return h("div", { class: "dmatrix", style: `--n:${ins.length}` },
|
||||||
|
h("span"), ins.map((_, i) => h("b", { style: `color:${inColor(d, i)}` }, chLabel("in", i).replace("In ", ""))),
|
||||||
|
chans(d, "out").flatMap((ch, o) => [h("span", {}, chLabel("out", o)),
|
||||||
|
...ins.map((_, i) => h("i", { class: ch.matrix >> i & 1 ? "on" : "", style: `--c:${inColor(d, i)}`, title: `${chLabel("in", i)} → ${chLabel("out", o)}` }))]));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
delays: {
|
||||||
|
title: () => "Delay", w: 4, min: [3, 3], max: [8, 14], h: d => (d && d.state ? 2 + Math.ceil(dashChannels(d).length * 0.8) : 5),
|
||||||
|
icon: '<circle cx="12" cy="13" r="8"/><path d="M12 9v4l2 2M9 2h6"/>',
|
||||||
|
body(m, d) {
|
||||||
|
const row = (k, i) => {
|
||||||
|
const ch = chans(d, k)[i];
|
||||||
|
return h("div", { class: "drow" + (ch.delay ? "" : " zero") }, h("span", { class: "dlab" }, chLabel(k, i)), h("span", { class: "grow dsub" }, ch.name), h("b", { class: "dval" }, SPEC.delay.fmt(ch.delay)));
|
||||||
|
};
|
||||||
|
return h("div", { class: "dlist" }, dashChannels(d).map(([k, i]) => row(k, i)));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fir: {
|
||||||
|
title: () => t("FIR filters"), w: 4, min: [3, 3], max: [8, 12], h: 5, only: () => dashDevs().some(d => d.fir),
|
||||||
|
icon: '<path d="M2 12h3l2-7 3 14 3-11 2 6 2-3 1 1h4"/>',
|
||||||
|
body(m, d) {
|
||||||
|
if (!d.fir) return h("p", { class: "info dempty" }, t("{name} has no FIR filters.", { name: d.name }));
|
||||||
|
const used = firUsed(d);
|
||||||
|
const list = dashChannels(d).filter(([k, i]) => firTapsOf(chans(d, k)[i]));
|
||||||
|
return [h("div", { class: "firmeter" }, h("span", { style: `width:${Math.min(100, used / 40.96)}%` })),
|
||||||
|
h("p", { class: "info" }, t("{used} of 4096 taps in use", { used })),
|
||||||
|
list.length ? h("div", { class: "dlist" }, list.map(([k, i]) => {
|
||||||
|
const f = chans(d, k)[i].fir;
|
||||||
|
return h("div", { class: "drow" }, h("span", { class: "dlab" }, chLabel(k, i)),
|
||||||
|
h("span", { class: "grow dsub" }, "type" in f ? FIR_TYPES()[f.type] : f.name), h("b", { class: "dval" }, firTapsOf(chans(d, k)[i])));
|
||||||
|
})) : null];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
notes: {
|
||||||
|
title: () => t("Notes"), w: 4, min: [2, 2], max: [12, 14], h: 4, global: true,
|
||||||
|
icon: '<path d="M5 3h14v18H5zM9 8h6M9 12h6M9 16h3"/>',
|
||||||
|
body(m) { return m.cfg.text ? h("p", { class: "dnote" }, m.cfg.text) : h("p", { class: "info dempty" }, t("Empty – add text in the module settings.")); },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ editing
|
||||||
|
|
||||||
|
function dashAdd(type, at = dashMods().length) {
|
||||||
|
const mods = dashMods(), def = DASH_MODULES[type];
|
||||||
|
const id = "m" + Date.now().toString(36) + Math.floor(Math.random() * 1296).toString(36);
|
||||||
|
const d = dashDevs()[0];
|
||||||
|
const m = { id, type, w: def.w, cfg: def.global || !d ? {} : { device: d.id } };
|
||||||
|
mods.splice(at, 0, m);
|
||||||
|
dashSave();
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function dashSettings(m) {
|
||||||
|
const def = DASH_MODULES[m.type], d = dashDev(m);
|
||||||
|
const title = h("input", { type: "text", maxlength: 40, value: m.cfg.title || "", placeholder: def.title() });
|
||||||
|
const dev_ = def.global ? null : h("select", {}, dashDevs().map(x => h("option", { value: x.id, selected: x === d }, x.name)));
|
||||||
|
const text = m.type === "notes" ? h("textarea", { rows: 6, maxlength: 2000 }, m.cfg.text || "") : null;
|
||||||
|
// channels of the "Overlay" entry
|
||||||
|
const overlays = new Set(m.cfg.overlays || []);
|
||||||
|
const overlayBox = m.type === "curve" ? h("div", { class: "doverlays" }) : null;
|
||||||
|
const fillOverlays = () => {
|
||||||
|
const x = S.devices[dev_.value];
|
||||||
|
if (!x || !x.state) return overlayBox.replaceChildren(h("p", { class: "info" }, t("{name} is not connected.", { name: x ? x.name : "DSP" })));
|
||||||
|
overlayBox.replaceChildren(...dashChannels(x).map(([k, i]) => {
|
||||||
|
const key = k + i, box = h("input", { type: "checkbox", checked: overlays.has(key), onchange: () => (box.checked ? overlays.add(key) : overlays.delete(key)) });
|
||||||
|
return h("label", { class: "chk", style: `--c:${chColor(x, k, i)}` }, box, h("i"), chLabel(k, i));
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
if (overlayBox) { fillOverlays(); dev_.addEventListener("change", fillOverlays); }
|
||||||
|
const res = await modal({ title: def.title(),
|
||||||
|
body: h("div", { class: "form dform" }, h("label", { class: "full" }, t("Title"), title),
|
||||||
|
dev_ ? h("label", { class: "full" }, "DSP", dev_) : null, text ? h("label", { class: "full" }, t("Text"), text) : null,
|
||||||
|
overlayBox ? h("div", { class: "full" }, h("div", { class: "sub" }, t("Channels shown together as “Overlay”")), overlayBox) : null),
|
||||||
|
actions: [{ label: t("Cancel") }, { label: t("Save"), primary: true, value: () => true }] });
|
||||||
|
if (!res) return;
|
||||||
|
m.cfg = { ...m.cfg, title: title.value.trim() };
|
||||||
|
if (dev_) m.cfg.device = dev_.value;
|
||||||
|
if (text) m.cfg.text = text.value;
|
||||||
|
if (overlayBox) m.cfg.overlays = [...overlays];
|
||||||
|
dashBrowse.delete(m.id);
|
||||||
|
dashSave(); render();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drag with pointer events (mouse and touch): modules are moved, new ones come from the palette.
|
||||||
|
function dashDrag(ev, source, el) {
|
||||||
|
if (ev.button) return;
|
||||||
|
const sx = ev.clientX, sy = ev.clientY;
|
||||||
|
let ghost = null, ph = null, grid = null;
|
||||||
|
const start = () => {
|
||||||
|
S.busy = true;
|
||||||
|
grid = $("#main .dash");
|
||||||
|
const size = source.mod || { type: source.type, w: DASH_MODULES[source.type].w, cfg: {} };
|
||||||
|
ph = h("div", { class: "dmod dph", style: dashSizeStyle(size.w, dashHeight(size, source.mod ? dashDev(size) : dashDevs()[0])) });
|
||||||
|
const r = el.getBoundingClientRect();
|
||||||
|
ghost = (source.mod ? el.closest(".dmod") : el).cloneNode(true);
|
||||||
|
ghost.classList.add("dghost");
|
||||||
|
ghost.style.width = (source.mod ? el.closest(".dmod").getBoundingClientRect().width : r.width) + "px";
|
||||||
|
document.body.append(ghost);
|
||||||
|
if (source.mod) { const home = el.closest(".dmod"); home.after(ph); home.hidden = true; } else grid.append(ph);
|
||||||
|
document.body.classList.add("ddragging");
|
||||||
|
};
|
||||||
|
const place = (x, y) => {
|
||||||
|
ghost.style.transform = `translate(${x + 8}px, ${y + 8}px)`;
|
||||||
|
if (y < 70) window.scrollBy(0, -12); else if (y > window.innerHeight - 70) window.scrollBy(0, 12);
|
||||||
|
const items = [...grid.children].filter(c => c !== ph && !c.hidden);
|
||||||
|
const next = items.find(c => { const r = c.getBoundingClientRect(); return y < r.top || (y < r.bottom && x < r.left + r.width / 2); });
|
||||||
|
if (next) { if (ph.nextSibling !== next) grid.insertBefore(ph, next); } else if (grid.lastChild !== ph) grid.append(ph);
|
||||||
|
};
|
||||||
|
const move = e => {
|
||||||
|
if (!ghost) { if (Math.hypot(e.clientX - sx, e.clientY - sy) < 6) return; start(); }
|
||||||
|
e.preventDefault();
|
||||||
|
place(e.clientX, e.clientY);
|
||||||
|
};
|
||||||
|
const end = e => {
|
||||||
|
window.removeEventListener("pointermove", move); window.removeEventListener("pointerup", end); window.removeEventListener("pointercancel", end);
|
||||||
|
if (!ghost) { if (e.type === "pointerup" && source.type) { dashAdd(source.type); render(); } return; }
|
||||||
|
const items = [...grid.children].filter(c => !c.hidden);
|
||||||
|
const at = items.indexOf(ph);
|
||||||
|
const onGrid = e.type === "pointerup";
|
||||||
|
ghost.remove(); document.body.classList.remove("ddragging"); S.busy = false;
|
||||||
|
const mods = dashMods();
|
||||||
|
if (onGrid && at >= 0) {
|
||||||
|
if (source.mod) { mods.splice(mods.indexOf(source.mod), 1); mods.splice(at, 0, source.mod); dashSave(); }
|
||||||
|
else dashAdd(source.type, at);
|
||||||
|
}
|
||||||
|
render();
|
||||||
|
};
|
||||||
|
window.addEventListener("pointermove", move, { passive: false });
|
||||||
|
window.addEventListener("pointerup", end); window.addEventListener("pointercancel", end);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dashPalette() {
|
||||||
|
const list = Object.entries(DASH_MODULES).filter(([, def]) => !def.only || def.only());
|
||||||
|
return h("div", { class: "card dpalette" },
|
||||||
|
h("h3", {}, h("span", { class: "grow" }, t("Add modules")), h("span", { class: "info dhelp" }, t("Drag into the page or tap"))),
|
||||||
|
h("div", { class: "dchips" }, list.map(([type, def]) => {
|
||||||
|
const c = h("button", { class: "dchip", type: "button" }, svgIcon(def.icon), def.title());
|
||||||
|
c.addEventListener("pointerdown", e => dashDrag(e, { type }, c));
|
||||||
|
return c;
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ page
|
||||||
|
|
||||||
|
const dashSizeStyle = (w, rows) => `--w:${w};--wt:${w < 6 ? 6 : 12};--h:${rows}`;
|
||||||
|
const dashLimit = (m, axis, v) => clamp(v, DASH_MODULES[m.type].min[axis], DASH_MODULES[m.type].max[axis]);
|
||||||
|
// rows: chosen by the user, or what the module needs on this DSP
|
||||||
|
function dashHeight(m, d) {
|
||||||
|
const def = DASH_MODULES[m.type];
|
||||||
|
return dashLimit(m, 1, m.h || (typeof def.h === "function" ? def.h(d) : def.h));
|
||||||
|
}
|
||||||
|
|
||||||
|
function dashResizeStart(ev, m, el, axes) {
|
||||||
|
ev.preventDefault(); ev.stopPropagation();
|
||||||
|
const grid = $("#main .dash"), col = (grid.clientWidth + 10) / 12, sx = ev.clientX, sy = ev.clientY;
|
||||||
|
const w0 = m.w, h0 = dashHeight(m, dashDev(m));
|
||||||
|
let w = w0, rows = h0;
|
||||||
|
S.busy = true;
|
||||||
|
document.body.classList.add("dresizing");
|
||||||
|
const move = e => {
|
||||||
|
if (axes.includes("w")) w = dashLimit(m, 0, w0 + Math.round((e.clientX - sx) / col));
|
||||||
|
if (axes.includes("h")) rows = dashLimit(m, 1, h0 + Math.round((e.clientY - sy) / DASH_ROW));
|
||||||
|
el.setAttribute("style", dashSizeStyle(w, rows));
|
||||||
|
};
|
||||||
|
const end = () => {
|
||||||
|
window.removeEventListener("pointermove", move); window.removeEventListener("pointerup", end); window.removeEventListener("pointercancel", end);
|
||||||
|
document.body.classList.remove("dresizing");
|
||||||
|
S.busy = false;
|
||||||
|
if (w !== w0 || rows !== h0) { m.w = w; m.h = rows; dashSave(); }
|
||||||
|
render();
|
||||||
|
};
|
||||||
|
window.addEventListener("pointermove", move); window.addEventListener("pointerup", end); window.addEventListener("pointercancel", end);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dashModule(m) {
|
||||||
|
const def = DASH_MODULES[m.type];
|
||||||
|
if (!def) return null;
|
||||||
|
const d = def.global ? null : dashDev(m);
|
||||||
|
let body;
|
||||||
|
try {
|
||||||
|
body = def.global || (d && d.status === "online" && d.state) ? def.body(m, d) : offline(d);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
body = h("p", { class: "info dempty" }, t("This module can't show this DSP."));
|
||||||
|
}
|
||||||
|
const controls = dashEdit ? (() => {
|
||||||
|
return h("div", { class: "dctl" },
|
||||||
|
h("button", { class: "small", "aria-label": t("Module settings"), title: t("Module settings"), onclick: () => dashSettings(m) }, "⚙"),
|
||||||
|
dashTouch() ? null : h("button", { class: "small danger", "aria-label": t("Remove"), title: t("Remove"), onclick: () => {
|
||||||
|
dashMods().splice(dashMods().indexOf(m), 1); dashSave(); render();
|
||||||
|
} }, "×"));
|
||||||
|
})() : null;
|
||||||
|
const head = h("h3", { title: dashEdit && !dashTouch() ? t("Drag to move") : null }, svgIcon(def.icon), h("span", { class: "grow dtitle" }, m.cfg.title || def.title()),
|
||||||
|
d && dashDevs().length > 1 ? h("small", { class: "ddev" }, d.name) : null, controls);
|
||||||
|
const el = h("section", { class: `card dmod dt-${m.type}`, style: dashSizeStyle(m.w, dashHeight(m, d)) },
|
||||||
|
head, h("div", { class: "dbody" }, body));
|
||||||
|
if (dashEdit && !dashTouch()) {
|
||||||
|
head.addEventListener("pointerdown", e => { if (!e.target.closest("button")) dashDrag(e, { mod: m }, head); });
|
||||||
|
const handle = (axes, cls, arrow, label) => {
|
||||||
|
const g = h("span", { class: "dgrab " + cls, title: label }, arrow);
|
||||||
|
g.addEventListener("pointerdown", e => dashResizeStart(e, m, el, axes));
|
||||||
|
return g;
|
||||||
|
};
|
||||||
|
el.append(handle("w", "de", "↔", t("Drag to resize")), handle("h", "ds", "↕", t("Drag to resize")), handle("wh", "dse", "↘", t("Drag to resize")));
|
||||||
|
}
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
|
function viewDash() {
|
||||||
|
if (viewOnly()) dashEdit = false;
|
||||||
|
if (!dashDevs().length) return noDspView();
|
||||||
|
const mods = dashMods();
|
||||||
|
return [
|
||||||
|
h("div", { class: "dhead" }, h("h2", {}, "Dashboard"),
|
||||||
|
viewOnly() ? null : h("button", { class: dashEdit ? "on" : "", onclick: () => { dashEdit = !dashEdit; render(); } }, dashEdit ? t("Done") : dashTouch() ? t("Widget settings") : t("Customise"))),
|
||||||
|
dashEdit && !dashTouch() ? dashPalette() : null,
|
||||||
|
mods.length ? h("div", { class: "dash" + (dashEdit && !dashTouch() ? " editing" : "") }, mods.map(dashModule))
|
||||||
|
: h("div", { class: "dash" + (dashEdit ? " editing" : "") }, h("div", { class: "dmod dblank", style: dashSizeStyle(12, 4) }, dashTouch() ? t("Nothing here yet – you can add modules on a computer.") : t("Nothing here yet – press “Customise” and add modules."))),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
let dashResize = 0;
|
||||||
|
window.addEventListener("resize", () => {
|
||||||
|
clearTimeout(dashResize);
|
||||||
|
dashResize = setTimeout(() => { if (S.view === "dash" && !S.settings && !S.busy) render(); }, 200);
|
||||||
|
});
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
|
||||||
|
<meta name="theme-color" content="#000000">
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<title>DJ Brake</title>
|
||||||
|
<style>
|
||||||
|
html { touch-action: manipulation; }
|
||||||
|
html, body { height: 100%; margin: 0; background: #050608; color: #fff; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
|
||||||
|
body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5vmin; text-align: center; -webkit-user-select: none; user-select: none; }
|
||||||
|
|
||||||
|
/* on at once, off quickly: the server already holds it for a second after the limiter */
|
||||||
|
#wash, #halo, #core { transition: opacity .25s ease-out; opacity: 0; }
|
||||||
|
body.on #wash, body.on #halo, body.on #core { transition: opacity .09s ease-out; opacity: 1; }
|
||||||
|
|
||||||
|
#wash { position: fixed; inset: 0; background: radial-gradient(circle at 50% 46%, #6e0a0a 0%, #2a0505 42%, #050608 78%); }
|
||||||
|
#lamp { position: relative; width: 64vmin; height: 64vmin; display: grid; place-items: center; }
|
||||||
|
#halo, #core, #glass, #ring { position: absolute; inset: 0; border-radius: 50%; }
|
||||||
|
#glass { background: radial-gradient(circle at 50% 38%, #171a20, #0b0d11 70%); box-shadow: inset 0 0 0 1px #ffffff14; }
|
||||||
|
#core { background: radial-gradient(circle at 50% 36%, #ff6a5c 0%, #f4201c 46%, #b80c0f 100%); box-shadow: inset 0 0 0 1px #ffb3a8, inset 0 -3vmin 7vmin #5e000380; }
|
||||||
|
#halo { inset: -7vmin; background: radial-gradient(circle, #ff2a1f 44%, #ff2a1f00 70%); filter: blur(3vmin); }
|
||||||
|
#ring { border: .5vmin solid #ff5a4c; opacity: 0; pointer-events: none; }
|
||||||
|
#word { position: relative; font-size: 10.5vmin; font-weight: 800; letter-spacing: .03em; line-height: 1; color: #4b5260; transition: color .25s; }
|
||||||
|
#sub { position: relative; min-height: 1.3em; font-size: 4.4vmin; font-weight: 500; color: #8b93a1; transition: color .25s; }
|
||||||
|
#hint { position: relative; max-width: 88vw; font-size: 2.8vmin; color: #6b7280; transition: color .25s; }
|
||||||
|
body.on #word { color: #fff; transition: color .09s; }
|
||||||
|
body.on #sub { color: #ffd9d4; transition: color .09s; }
|
||||||
|
body.on #hint { color: #ffc9c4; transition: color .09s; }
|
||||||
|
|
||||||
|
/* while it lasts: slow breathing, one ring on each new hit, no hard flashing */
|
||||||
|
body.on #halo { animation: breathe 2.2s ease-in-out infinite; }
|
||||||
|
body.on #ring { animation: ripple .9s cubic-bezier(.2, .6, .3, 1); }
|
||||||
|
@keyframes breathe { 50% { transform: scale(.94); filter: blur(4.5vmin); } }
|
||||||
|
@keyframes ripple { from { transform: scale(1); opacity: .75; } to { transform: scale(1.32); opacity: 0; } }
|
||||||
|
@media (prefers-reduced-motion: reduce) { body.on #halo, body.on #ring { animation: none; } }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="wash"></div>
|
||||||
|
<div id="lamp">
|
||||||
|
<div id="halo"></div>
|
||||||
|
<div id="ring"></div>
|
||||||
|
<div id="glass"></div>
|
||||||
|
<div id="core"></div>
|
||||||
|
<div id="word">—</div>
|
||||||
|
</div>
|
||||||
|
<div id="sub"></div>
|
||||||
|
<div id="hint"></div>
|
||||||
|
<script>
|
||||||
|
// Red light for the DJ: comes on when a limiter of a connected DSP acts.
|
||||||
|
// On its own on purpose: this page needs no PIN and gets nothing but this one state from the server.
|
||||||
|
(function () {
|
||||||
|
var de = /^de/i.test(navigator.language || "");
|
||||||
|
var text = de
|
||||||
|
? { on: "LIMITER", more: "Mehr Gas bringt nichts", lost: "Keine Verbindung", none: "Kein Limiter überwacht" }
|
||||||
|
: { on: "LIMITER", more: "More gain won't help", lost: "No connection", none: "No limiter being watched" };
|
||||||
|
var word = document.getElementById("word"), sub = document.getElementById("sub"), hint = document.getElementById("hint");
|
||||||
|
var notes = { en: "The limiter is a safety net, not the target. Stay below it.", de: "Der Limiter ist die Sicherung, nicht das Ziel. Bleib darunter." };
|
||||||
|
document.documentElement.lang = de ? "de" : "en";
|
||||||
|
|
||||||
|
function show(on, main, small) {
|
||||||
|
document.body.className = on ? "on" : "";
|
||||||
|
word.textContent = main;
|
||||||
|
sub.textContent = small;
|
||||||
|
}
|
||||||
|
|
||||||
|
var es = new EventSource("/djbrake/state");
|
||||||
|
es.onmessage = function (e) {
|
||||||
|
var s = JSON.parse(e.data);
|
||||||
|
hint.textContent = !s.hint ? "" : s.hint === "auto" && de ? notes.de : notes.en;
|
||||||
|
if (s.on) show(true, text.on, text.more);
|
||||||
|
else if (s.ready) show(false, "OK", "");
|
||||||
|
else show(false, "—", text.none);
|
||||||
|
};
|
||||||
|
es.onerror = function () { show(false, "—", text.lost); };
|
||||||
|
|
||||||
|
// keep the screen on where the browser allows it
|
||||||
|
function awake() { if (navigator.wakeLock) navigator.wakeLock.request("screen").catch(function () {}); }
|
||||||
|
awake();
|
||||||
|
document.addEventListener("visibilitychange", function () { if (!document.hidden) awake(); });
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 34 KiB |
@@ -0,0 +1,96 @@
|
|||||||
|
"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: [
|
||||||
|
{ n: t("Overview"), h: t("What it is for"), fig: ["lab-take", t("A measurement taken over from REW: the orange curve is the prediction, the table lists each filter before anything reaches the DSP.")], 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.") },
|
||||||
|
{ n: t("Setting up"), 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."),
|
||||||
|
], tip: t("REW's API only answers on its own computer, so Sound Lab is part of the Windows and macOS apps only.") },
|
||||||
|
{ n: t("Correcting"), 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."),
|
||||||
|
], tip: t("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.") },
|
||||||
|
{ n: t("Comparing"), 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."),
|
||||||
|
] },
|
||||||
|
{ n: t("Trying first"), 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."),
|
||||||
|
] },
|
||||||
|
{ n: t("Without the API"), h: t("Without the API"), 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: [
|
||||||
|
{ n: t("Overview"), h: t("What it is for"), fig: ["sf-plan", t("The “Level” map: green is around the median of the audience area, red is 12 dB below it.")], 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.") },
|
||||||
|
{ n: t("Planning"), 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."),
|
||||||
|
] },
|
||||||
|
{ n: t("The map"), h: t("Reading the map"), list: [
|
||||||
|
t("“Level”: how loud each spot of the room is, compared with the median of the audience area."),
|
||||||
|
t("“Sub”: where the subs add up and where they cancel at the chosen frequency."),
|
||||||
|
t("“Timing”: marked areas mean a delay arrives before the mains or more than 30 ms late."),
|
||||||
|
] },
|
||||||
|
{ n: t("Back of the hall"), 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."),
|
||||||
|
] },
|
||||||
|
{ n: t("Subs"), 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."),
|
||||||
|
] },
|
||||||
|
{ n: t("To the DSP"), h: t("Taking the delays to the DSP"), fig: ["sf-delays", t("The “Delays” table: distance and delay per speaker, next to what is set on the DSP now.")], 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."),
|
||||||
|
], tip: t("Check the result by ear or with a measurement: temperature, reflections and real speakers differ from the model.") },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// “Names of buttons” in the texts stand out; the quotes go, the German ones too
|
||||||
|
const docText = s => s.split(/([“„][^”“]+[”“])/).map(x => /^[“„]/.test(x) ? h("b", { class: "docui" }, x.slice(1, -1)) : x);
|
||||||
|
|
||||||
|
function docDialog(doc) {
|
||||||
|
const d = doc();
|
||||||
|
const body = h("div", { class: "docbody" });
|
||||||
|
const secs = d.parts.map(part => h("section", {}, h("h4", {}, part.h),
|
||||||
|
part.p ? h("p", {}, docText(part.p)) : null,
|
||||||
|
part.fig ? h("figure", {}, h("img", { src: `docimg/${part.fig[0]}.${LANG}.jpg`, alt: "" }), h("figcaption", {}, docText(part.fig[1]))) : null,
|
||||||
|
part.steps ? h("ol", {}, part.steps.map(s => h("li", {}, docText(s)))) : null,
|
||||||
|
part.list ? h("ul", {}, part.list.map(s => h("li", {}, docText(s)))) : null,
|
||||||
|
part.tip ? h("p", { class: "doctip" }, docText(part.tip)) : null));
|
||||||
|
body.append(h("nav", { class: "docnav" }, d.parts.map((part, i) => h("button", { class: "chip", onclick: () => {
|
||||||
|
body.scrollTo({ top: secs[i].offsetTop - body.offsetTop - 48, behavior: "smooth" });
|
||||||
|
} }, part.n))), ...secs);
|
||||||
|
return modal({ title: d.title,
|
||||||
|
body,
|
||||||
|
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"/>'));
|
||||||
@@ -286,10 +286,447 @@ const DE = {
|
|||||||
"{pct} % of {rated}": "{pct} % von {rated}",
|
"{pct} % of {rated}": "{pct} % von {rated}",
|
||||||
"— empty —": "— leer —",
|
"— empty —": "— leer —",
|
||||||
"— no amplifier —": "— kein Verstärker —",
|
"— no amplifier —": "— kein Verstärker —",
|
||||||
"“{s}”": "„{s}“"
|
"“{s}”": "„{s}“",
|
||||||
|
// device lock, demo mode
|
||||||
|
"A code is remembered for this DSP.": "Für diesen DSP ist ein Code gespeichert.",
|
||||||
|
"Code forgotten": "Code vergessen",
|
||||||
|
"Connect the DSP to set a code.": "Zum Festlegen eines Codes den DSP verbinden.",
|
||||||
|
"DSP locked": "DSP gesperrt",
|
||||||
|
"DSP unlocked": "DSP entsperrt",
|
||||||
|
"Device lock (code)": "Gerätesperre (Code)",
|
||||||
|
"Enter code": "Code eingeben",
|
||||||
|
"Forget code": "Code vergessen",
|
||||||
|
"From the next connection on, {name} asks for the code {code} – also in the original software. Note it down: this app cannot remove the lock again.": "Ab der nächsten Verbindung fragt {name} nach dem Code {code} – auch in der Original-Software. Bitte notieren: Diese App kann die Sperre nicht wieder entfernen.",
|
||||||
|
"Hardware lock of the DSP: a locked DSP only accepts a connection after its code was entered. Independent of the lock of this app.": "Sperre im DSP selbst: Ein gesperrter DSP lässt sich erst nach Eingabe seines Codes bedienen. Unabhängig von der Sperre dieser App.",
|
||||||
|
"Lock code": "Sperrcode",
|
||||||
|
"Lock code set": "Sperrcode festgelegt",
|
||||||
|
"Locked with a code": "Mit Code gesperrt",
|
||||||
|
"No code remembered – it is asked for when the DSP is locked.": "Kein Code gespeichert – er wird abgefragt, wenn der DSP gesperrt ist.",
|
||||||
|
"Remember the code and unlock automatically": "Code merken und automatisch entsperren",
|
||||||
|
"Set a new lock code": "Neuen Sperrcode festlegen",
|
||||||
|
"Set code": "Code festlegen",
|
||||||
|
"Set lock code": "Sperrcode festlegen",
|
||||||
|
"The code has 4 characters: digits and letters A–Z": "Der Code hat 4 Zeichen: Ziffern und Buchstaben A–Z",
|
||||||
|
"This DSP is locked with a code.": "Dieser DSP ist mit einem Code gesperrt.",
|
||||||
|
"Unlock automatically with the remembered code": "Mit dem gespeicherten Code automatisch entsperren",
|
||||||
|
"Wrong code – please try again.": "Falscher Code – bitte erneut versuchen.",
|
||||||
|
"code remembered": "Code gespeichert",
|
||||||
|
"{name} is locked with a code. Enter the 4-character code (digits and letters A–Z).": "{name} ist mit einem Code gesperrt. Bitte den 4-stelligen Code eingeben (Ziffern und Buchstaben A–Z).",
|
||||||
|
"The DSP is not locked": "Der DSP ist nicht gesperrt",
|
||||||
|
"The remembered lock code was rejected": "Der gespeicherte Sperrcode wurde abgelehnt",
|
||||||
|
"Demo mode": "Demo-Modus",
|
||||||
|
"Demo mode · simulated DSP": "Demo-Modus · simulierter DSP",
|
||||||
|
"Demo mode – simulated DSP": "Demo-Modus – simulierter DSP",
|
||||||
|
"Disconnected while demo mode is on": "Getrennt, solange der Demo-Modus aktiv ist",
|
||||||
|
"Try everything with a simulated DSP – nothing is sent to real devices. While demo mode is on, the real DSPs are disconnected.": "Alles gefahrlos mit einem simulierten DSP ausprobieren – an echte Geräte wird nichts gesendet. Solange der Demo-Modus aktiv ist, sind die echten DSPs getrennt.",
|
||||||
|
"Not available for the demo device": "Für das Demo-Gerät nicht verfügbar",
|
||||||
|
"Demo mode is on – switch it off to connect the real DSPs": "Der Demo-Modus ist aktiv – zum Verbinden der echten DSPs bitte ausschalten",
|
||||||
|
// audio test
|
||||||
|
"Audio test": "Audiotest",
|
||||||
|
"Analog input": "Analog-Eingang",
|
||||||
|
"normal operation": "Normalbetrieb",
|
||||||
|
"Pink noise": "Rosa Rauschen",
|
||||||
|
"White noise": "Weißes Rauschen",
|
||||||
|
"Sine": "Sinus",
|
||||||
|
"Sine frequency": "Sinus-Frequenz",
|
||||||
|
"Input signal": "Eingangssignal",
|
||||||
|
"Test fader": "Testfader",
|
||||||
|
"all outputs": "alle Ausgänge",
|
||||||
|
"Audio test running – the DSP plays {signal} instead of its inputs.": "Audiotest läuft – der DSP spielt {signal} statt seiner Eingänge.",
|
||||||
|
"Choose a test signal above to start.": "Zum Starten oben ein Testsignal wählen.",
|
||||||
|
"Not possible during the audio test": "Während des Audiotests nicht möglich",
|
||||||
|
"Saving and recalling presets is blocked during the test. Stopping it switches the noise off first and then puts every fader back where it was.": "Presets speichern und laden ist während des Tests gesperrt. Beim Beenden wird zuerst das Rauschen abgeschaltet, danach gehen alle Fader zurück auf ihren ursprünglichen Wert.",
|
||||||
|
"Stop test – back to the analog input": "Test beenden – zurück zum Analog-Eingang",
|
||||||
|
"The test signal replaces the analog inputs of the DSP. When it is switched on, all outputs are lowered to −50 dB first – raise them slowly with the test fader.": "Das Testsignal ersetzt die Analog-Eingänge des DSP. Beim Einschalten werden zuerst alle Ausgänge auf −50 dB abgesenkt – mit dem Testfader langsam hochziehen.",
|
||||||
|
"Audio test is on – switch it off first": "Der Audiotest läuft – bitte zuerst beenden",
|
||||||
|
"Audio test is off": "Der Audiotest ist aus",
|
||||||
|
// curve
|
||||||
|
"Overlay": "Einblenden",
|
||||||
|
"Phase": "Phase",
|
||||||
|
"The rest of the app is locked until the analog input is selected again.": "Der Rest der App ist gesperrt, bis wieder der Analog-Eingang gewählt ist.",
|
||||||
|
"Phase inverted": "Phase invertiert",
|
||||||
|
// copy settings, global mute
|
||||||
|
"Copy to…": "Kopieren nach…",
|
||||||
|
"Gain, delay, polarity": "Gain, Delay, Phase",
|
||||||
|
"High / low pass": "Hoch- / Tiefpass",
|
||||||
|
"PEQ + GEQ": "PEQ + GEQ",
|
||||||
|
"Compressor + limiter": "Kompressor + Limiter",
|
||||||
|
"Routing + mix levels": "Routing + Mix-Pegel",
|
||||||
|
"Copy {ch} to…": "{ch} kopieren nach…",
|
||||||
|
"What": "Was",
|
||||||
|
"To": "Wohin",
|
||||||
|
"Copy": "Kopieren",
|
||||||
|
"The name stays. Linked target channels take the values for their whole group.": "Der Name bleibt. Verknüpfte Zielkanäle übernehmen die Werte für ihre ganze Gruppe.",
|
||||||
|
"{n} values copied": "{n} Werte kopiert",
|
||||||
|
"Nothing to change – the settings are already the same": "Nichts zu ändern – die Einstellungen sind schon gleich",
|
||||||
|
"All muted – click to unmute what was open before": "Alles stumm – klicken gibt frei, was vorher offen war",
|
||||||
|
"Mute all channels of all connected DSPs": "Alle Kanäle aller verbundenen DSPs stummschalten",
|
||||||
|
"MUTED": "STUMM",
|
||||||
|
"All channels muted": "Alle Kanäle stumm",
|
||||||
|
"Unmuted – channels that were muted before stay muted": "Freigegeben – vorher stumme Kanäle bleiben stumm",
|
||||||
|
// SoundField
|
||||||
|
">30 ms echo": ">30 ms Echo",
|
||||||
|
"A planning aid: free field without reflections, coverage from the nominal angle. Check the result by ear or measurement.": "Eine Planungshilfe: Freifeld ohne Reflexionen, Abdeckung aus dem Nennwinkel. Das Ergebnis mit dem Ohr oder einer Messung prüfen.",
|
||||||
|
"Add delay line": "Delay-Linie hinzufügen",
|
||||||
|
"Add front fills": "Front-Fills hinzufügen",
|
||||||
|
"Add speakers to calculate delays.": "Lautsprecher hinzufügen, um Delays zu berechnen.",
|
||||||
|
"Aim": "Ausrichten",
|
||||||
|
"Aim (°)": "Ausrichtung (°)",
|
||||||
|
"Aim the mains at ⅔ of the room depth on the centre line ({list}).": "Die Mains auf ⅔ der Raumtiefe in der Mitte ausrichten ({list}).",
|
||||||
|
"Apply all": "Alle übernehmen",
|
||||||
|
"Centre cluster": "Mittig bündeln",
|
||||||
|
"Column": "Säule",
|
||||||
|
"Coverage (°)": "Abstrahlwinkel (°)",
|
||||||
|
"Custom": "Eigener",
|
||||||
|
"DSP outputs": "DSP-Ausgänge",
|
||||||
|
"Delay": "Delay",
|
||||||
|
"Delays": "Delays",
|
||||||
|
"Depth (m)": "Tiefe (m)",
|
||||||
|
"Distance": "Abstand",
|
||||||
|
"Ear height (m)": "Ohrhöhe (m)",
|
||||||
|
"Fill 8″": "Fill 8″",
|
||||||
|
"Height (m)": "Höhe (m)",
|
||||||
|
"Its delay is aligned at the dashed target point (drag it to the middle of the area this speaker covers).": "Sein Delay wird am gestrichelten Zielpunkt ausgerichtet (in die Mitte des Bereichs ziehen, den dieser Lautsprecher beschallt).",
|
||||||
|
"Level in the audience area: {spread} dB spread, {pct} % within ±3 dB of the median.": "Pegel im Publikumsbereich: {spread} dB Streuung, {pct} % innerhalb ±3 dB vom Mittelwert.",
|
||||||
|
"Main": "Main",
|
||||||
|
"Main L": "Main L",
|
||||||
|
"Main R": "Main R",
|
||||||
|
"Mains and subs are aligned at the reference position, delay and fill speakers at their target point plus {ms} ms so the mains are heard first.": "Mains und Subs werden an der Referenzposition ausgerichtet, Delay- und Fill-Lautsprecher an ihrem Zielpunkt plus {ms} ms, damit man die Mains zuerst hört.",
|
||||||
|
"Max SPL @1 m (dB)": "Max. SPL @1 m (dB)",
|
||||||
|
"No DSP in the device list yet.": "Noch kein DSP in der Geräteliste.",
|
||||||
|
"Nothing to improve with the current layout.": "Mit dem aktuellen Aufbau gibt es nichts zu verbessern.",
|
||||||
|
"Now on DSP": "Jetzt im DSP",
|
||||||
|
"Offset (ms)": "Versatz (ms)",
|
||||||
|
"Quick start": "Schnellstart",
|
||||||
|
"REF": "REF",
|
||||||
|
"Raise": "Anheben",
|
||||||
|
"Raise the mains to {h} m: front-to-back difference {a} dB → {b} dB.": "Mains auf {h} m anheben: Unterschied vorne/hinten {a} dB → {b} dB.",
|
||||||
|
"Role": "Rolle",
|
||||||
|
"Room": "Raum",
|
||||||
|
"Room plan": "Raumplan",
|
||||||
|
"STAGE": "BÜHNE",
|
||||||
|
"Select a speaker in the plan, or add one above. Drag to move, use the white handle to aim, drag the reference cross to your listening / mixing position.": "Einen Lautsprecher im Plan wählen oder oben hinzufügen. Ziehen zum Verschieben, mit dem weißen Griff ausrichten, das Referenzkreuz an deine Hör- bzw. Mischposition ziehen.",
|
||||||
|
"Speaker": "Lautsprecher",
|
||||||
|
"Speed of sound at {t} °C: {c} m/s.": "Schallgeschwindigkeit bei {t} °C: {c} m/s.",
|
||||||
|
"Stage depth (m)": "Bühnentiefe (m)",
|
||||||
|
"Stage width (m)": "Bühnenbreite (m)",
|
||||||
|
"Start with a stereo pair at the front edge of the stage and a sub in the centre.": "Mit einem Stereo-Paar an der Bühnenkante und einem Sub in der Mitte beginnen.",
|
||||||
|
"Sub 18″": "Sub 18″",
|
||||||
|
"Sub 2×18″": "Sub 2×18″",
|
||||||
|
"Sub frequency": "Sub-Frequenz",
|
||||||
|
"Suggestions": "Vorschläge",
|
||||||
|
"Temperature (°C)": "Temperatur (°C)",
|
||||||
|
"The back of the room is {db} dB quieter than the front third. A delay line with {n} speaker(s) at about {y} m keeps it even.": "Hinten ist es {db} dB leiser als im vorderen Drittel. Eine Delay-Linie mit {n} Lautsprecher(n) bei etwa {y} m gleicht das aus.",
|
||||||
|
"The first rows in the centre get {db} dB less than the middle of the room – front fills at the stage edge help.": "Die ersten Reihen in der Mitte bekommen {db} dB weniger als die Raummitte – Front-Fills an der Bühnenkante helfen.",
|
||||||
|
"The subs are {m} m apart – at 80 Hz that causes cancellation lanes through the room (power alley). A centre cluster sounds even everywhere.": "Die Subs stehen {m} m auseinander – bei 80 Hz entstehen dadurch Auslöschungs-Gassen durch den Raum (Power Alley). Mittig gebündelt klingt es überall gleichmäßig.",
|
||||||
|
"Timing": "Timing",
|
||||||
|
"Timing: in {a} % of the area a delay/fill arrives before the mains, in {b} % more than 30 ms late. Check positions and apply the calculated delays.": "Timing: In {a} % der Fläche kommt ein Delay/Fill vor den Mains an, in {b} % mehr als 30 ms zu spät. Positionen prüfen und die berechneten Delays übernehmen.",
|
||||||
|
"Top 12″": "Top 12″",
|
||||||
|
"Top 15″": "Top 15″",
|
||||||
|
"Width (m)": "Breite (m)",
|
||||||
|
"audience: {spread} dB spread · {pct} % within ±3 dB": "Publikum: {spread} dB Streuung · {pct} % innerhalb ±3 dB",
|
||||||
|
"delay too early": "Delay zu früh",
|
||||||
|
"median": "Median",
|
||||||
|
"no output": "kein Ausgang",
|
||||||
|
"{m} m to the nearest main": "{m} m zum nächsten Main",
|
||||||
|
"{n} output delay(s) set": "{n} Ausgangs-Delay(s) gesetzt",
|
||||||
|
"{n} output(s) not connected": "{n} Ausgang/Ausgänge nicht verbunden",
|
||||||
|
// channel colours
|
||||||
|
"Channel colours": "Kanalfarben",
|
||||||
|
"Shown on the mixer strips and in the channel view. Linked channels share one colour; every colour can only be used once per DSP.": "Wird im Mixer und in der Kanalansicht angezeigt. Verknüpfte Kanäle teilen sich eine Farbe; jede Farbe gibt es pro DSP nur einmal.",
|
||||||
|
"Used by {ch}": "Vergeben an {ch}",
|
||||||
|
"Custom colour": "Eigene Farbe",
|
||||||
|
"Colour for {ch}": "Farbe für {ch}",
|
||||||
|
"Linked channels always share their colour.": "Verknüpfte Kanäle teilen sich immer ihre Farbe.",
|
||||||
|
"Default": "Standard",
|
||||||
|
// SoundField stacks
|
||||||
|
"Or ground stacks: a sub left and right with the top on a distance pole.": "Oder als Stacks: links und rechts ein Sub mit dem Top auf einer Distanzstange.",
|
||||||
|
"Stacks": "Stacks",
|
||||||
|
"Stack": "Stack",
|
||||||
|
"The tops then stay where they are on their own stands.": "Die Tops bleiben dann auf eigenen Stativen, wo sie sind.",
|
||||||
|
"{top} now stands on {sub} (distance pole)": "{top} steht jetzt auf {sub} (Distanzstange)",
|
||||||
|
"Own stand / flown": "Eigenes Stativ / geflogen",
|
||||||
|
"On a pole on {sub}": "Auf Distanzstange auf {sub}",
|
||||||
|
"Stand": "Aufstellung",
|
||||||
|
"Edit {name}": "{name} bearbeiten",
|
||||||
|
"{top} stands on this sub (distance pole).": "{top} steht auf diesem Sub (Distanzstange).",
|
||||||
|
"Detach": "Abnehmen",
|
||||||
|
"Height on the pole (m)": "Höhe auf der Stange (m)",
|
||||||
|
"Sub with a top on a distance pole": "Sub mit Top auf Distanzstange",
|
||||||
|
"Add a DSP…": "DSP hinzufügen…",
|
||||||
|
"simulated": "simuliert",
|
||||||
|
// logo
|
||||||
|
"Logo": "Logo",
|
||||||
|
"Your own logo top left (and as the browser icon). PNG, JPG, WebP or SVG, ideally square, at least 64×64 pixels, transparent background recommended. It is scaled to 128×128 pixels; other shapes are centred without distortion.": "Eigenes Logo oben links (und als Browser-Symbol). PNG, JPG, WebP oder SVG, am besten quadratisch, mindestens 64×64 Pixel, transparenter Hintergrund empfohlen. Es wird auf 128×128 Pixel skaliert; andere Formate werden unverzerrt zentriert.",
|
||||||
|
"Choose image…": "Bild wählen…",
|
||||||
|
"Default logo": "Standard-Logo",
|
||||||
|
"Logo replaced": "Logo ersetzt",
|
||||||
|
"Logo replaced – the image was not square and has been centred": "Logo ersetzt – das Bild war nicht quadratisch und wurde zentriert",
|
||||||
|
"Please choose a PNG, JPG, WebP or SVG image": "Bitte ein PNG-, JPG-, WebP- oder SVG-Bild wählen",
|
||||||
|
"The logo could not be read": "Das Logo konnte nicht gelesen werden",
|
||||||
|
"The image is too small – at least {n}×{n} pixels": "Das Bild ist zu klein – mindestens {n}×{n} Pixel",
|
||||||
|
"Test": "Test",
|
||||||
|
// settings page
|
||||||
|
"Language of the app on this device.": "Sprache der App auf diesem Gerät.",
|
||||||
|
"Add a DSP": "DSP hinzufügen",
|
||||||
|
"Over the network or with a USB cable": "Über das Netzwerk oder per USB-Kabel",
|
||||||
|
"General": "Allgemein",
|
||||||
|
"Language, demo mode and your logo.": "Sprache, Demo-Modus und dein Logo.",
|
||||||
|
"Several DSPs can be connected at the same time – pick one at the top. A DSP accepts only one connection: close the Thomann editor first.": "Mehrere DSPs können gleichzeitig verbunden sein – oben auswählen. Ein DSP erlaubt nur eine Verbindung: den Thomann-Editor vorher schließen.",
|
||||||
|
"Let phones and tablets in your network control this computer – they log in with the PIN.": "Handys und Tablets im Netzwerk können diesen Computer fernsteuern – sie melden sich mit der PIN an.",
|
||||||
|
"Who may use this web interface.": "Wer diese Weboberfläche benutzen darf.",
|
||||||
|
"Save and restore the settings of this app.": "Einstellungen dieser App sichern und wiederherstellen.",
|
||||||
|
// network search, device ID, links
|
||||||
|
"Already linked – unlink the group first": "Bereits verknüpft – zuerst die Gruppe trennen",
|
||||||
|
"Advanced": "Erweitert",
|
||||||
|
"Device ID": "Geräte-ID",
|
||||||
|
"Only needed if the ID was changed on the DSP (e.g. several DSPs on one RS-485 cable). Default 1.": "Nur nötig, wenn die ID am DSP geändert wurde (z. B. mehrere DSPs an einem RS-485-Kabel). Standard 1.",
|
||||||
|
"Searching the network for DSPs…": "Suche DSPs im Netzwerk…",
|
||||||
|
"Search network": "Im Netzwerk suchen",
|
||||||
|
"Unknown device": "Unbekanntes Gerät",
|
||||||
|
"in the list": "in der Liste",
|
||||||
|
"connected": "verbunden",
|
||||||
|
"no answer (another program connected, or a different device ID)": "keine Antwort (anderes Programm verbunden oder andere Geräte-ID)",
|
||||||
|
"No DSP found. Is it in the same network and switched on? Close the Thomann editor – a DSP accepts only one connection.": "Kein DSP gefunden. Ist er im selben Netzwerk und eingeschaltet? Den Thomann-Editor schließen – ein DSP erlaubt nur eine Verbindung.",
|
||||||
|
"Finds DSPs in your network automatically": "Findet DSPs in deinem Netzwerk automatisch",
|
||||||
|
"Channel settings": "Kanaleinstellungen",
|
||||||
|
"Channels": "Kanäle",
|
||||||
|
"Links": "Verknüpfungen",
|
||||||
|
"Colours": "Farben",
|
||||||
|
// max level
|
||||||
|
"Max level": "Max. Pegel",
|
||||||
|
"no limit": "keine Grenze",
|
||||||
|
"now above – set on the DSP": "liegt gerade darüber – am DSP eingestellt",
|
||||||
|
"Software lock for the gain faders: the app does not let them go higher. If the DSP itself is turned up further, the app shows it and the fader can only be pulled down until it snaps into the limit again.": "Software-Sperre für die Gain-Fader: Die App lässt sie nicht höher. Wird am DSP selbst weiter aufgedreht, zeigt die App das an, und der Fader lässt sich nur nach unten ziehen, bis er wieder in die Grenze einrastet.",
|
||||||
|
"Above the max level of {lim} – press Apply twice to set it anyway.": "Über dem max. Pegel von {lim} – zum Setzen trotzdem zweimal Übernehmen drücken.",
|
||||||
|
"Max level: {lim}": "Max. Pegel: {lim}",
|
||||||
|
"Set anyway": "Trotzdem setzen",
|
||||||
|
"Group name": "Gruppenname",
|
||||||
|
"Group name saved": "Gruppenname gespeichert",
|
||||||
|
"Group name removed": "Gruppenname entfernt",
|
||||||
|
"Unlink group": "Gruppe trennen",
|
||||||
|
"Unlink {names}? Every channel keeps its current settings.": "{names} trennen? Jeder Kanal behält seine aktuellen Einstellungen.",
|
||||||
|
"{names} join the group and take over its settings (names{routing} stay).": "{names} kommen in die Gruppe und übernehmen ihre Einstellungen – außer Namen{routing}.",
|
||||||
|
" and routing": " und Routing",
|
||||||
|
"{names} leave the group and keep their current settings.": "{names} verlassen die Gruppe und behalten ihre aktuellen Einstellungen.",
|
||||||
|
"Change group": "Gruppe ändern",
|
||||||
|
"Group changed: {names}": "Gruppe geändert: {names}",
|
||||||
|
"Fewer than two channels – the group will be dissolved": "Weniger als zwei Kanäle – die Gruppe wird aufgelöst",
|
||||||
|
"Edit {names}: tap channels to add or remove them": "{names} bearbeiten: Kanäle antippen zum Hinzufügen oder Entfernen",
|
||||||
|
"Dissolve group": "Gruppe auflösen",
|
||||||
|
"{names} joins the group and takes over its settings (name{routing} stays).": "{names} kommt in die Gruppe und übernimmt ihre Einstellungen – außer Name{routing}.",
|
||||||
|
"{names} leaves the group and keeps its current settings.": "{names} verlässt die Gruppe und behält seine aktuellen Einstellungen.",
|
||||||
|
"Beta: this model has not been tested on a real device yet. Keep the amplifiers off for the first test.": "Beta: Dieses Modell wurde noch nicht an einem echten Gerät getestet. Beim ersten Test die Endstufen ausgeschaltet lassen.",
|
||||||
|
"Band-pass": "Bandpass",
|
||||||
|
"From file": "Aus Datei",
|
||||||
|
"Bypass": "Bypass",
|
||||||
|
"This is not a list of FIR coefficients": "Das ist keine Liste von FIR-Koeffizienten",
|
||||||
|
"Too many coefficients: {n}, at most {max} here": "Zu viele Koeffizienten: {n}, hier höchstens {max}",
|
||||||
|
"Load FIR filter": "FIR-Filter laden",
|
||||||
|
"Send {n} coefficients from {file} to {ch}? This changes the sound immediately – keep the amplifiers low.": "{n} Koeffizienten aus {file} an {ch} senden? Das ändert den Klang sofort – Endstufen leise halten.",
|
||||||
|
"Send": "Senden",
|
||||||
|
"FIR filter loaded": "FIR-Filter geladen",
|
||||||
|
"taps": "Taps",
|
||||||
|
"off": "aus",
|
||||||
|
"FIR filters": "FIR-Filter",
|
||||||
|
"{used} of 4096 taps in use": "{used} von 4096 Taps belegt",
|
||||||
|
"Window": "Fenster",
|
||||||
|
"Taps": "Taps",
|
||||||
|
"Low cut (Hz)": "Untere Grenze (Hz)",
|
||||||
|
"High cut (Hz)": "Obere Grenze (Hz)",
|
||||||
|
"The low cut must be below the high cut.": "Die untere Grenze muss unter der oberen liegen.",
|
||||||
|
"Not enough taps left: {free} free, this needs {need}.": "Nicht genug Taps frei: {free} frei, nötig sind {need}.",
|
||||||
|
"More than 512 taps add noticeable delay (over 10 ms at 1024).": "Mehr als 512 Taps bringen spürbare Verzögerung (über 10 ms bei 1024).",
|
||||||
|
"Loaded: {name}": "Geladen: {name}",
|
||||||
|
"Choose a file with up to {max} coefficients (txt or csv).": "Datei mit bis zu {max} Koeffizienten wählen (txt oder csv).",
|
||||||
|
"Sending…": "Wird gesendet…",
|
||||||
|
"Load file…": "Datei laden…",
|
||||||
|
"FIR filter set": "FIR-Filter gesetzt",
|
||||||
|
"The DSP can't send coefficients back, so the curve only appears after loading a file here.": "Der DSP kann Koeffizienten nicht zurücksenden, die Kurve erscheint daher erst nach dem Laden einer Datei hier.",
|
||||||
|
"Calculated by this app – the DSP calculates the filter itself, so details can differ.": "Von dieser App berechnet – der DSP berechnet den Filter selbst, Details können abweichen.",
|
||||||
|
"Filter is off.": "Filter ist aus.",
|
||||||
|
"Loaded: {name} ({n} taps)": "Geladen: {name} ({n} Taps)",
|
||||||
|
"Inputs only take filters from a file: up to {max} coefficients (txt or csv).": "Eingänge nehmen nur Filter aus einer Datei: bis zu {max} Koeffizienten (txt oder csv).",
|
||||||
|
"Frequency response": "Frequenzgang",
|
||||||
|
"Out of FIR taps: all channels together have 4096": "Keine FIR-Taps mehr frei: alle Kanäle zusammen haben 4096",
|
||||||
|
"Not valid FIR coefficients": "Keine gültigen FIR-Koeffizienten",
|
||||||
|
"{name} is not connected.": "{name} ist nicht verbunden.",
|
||||||
|
"No DSP added yet.": "Noch kein DSP angelegt.",
|
||||||
|
"DSP overview": "DSP-Übersicht",
|
||||||
|
"Open in the mixer": "Im Mixer öffnen",
|
||||||
|
"Levels": "Pegel",
|
||||||
|
"Faders": "Fader",
|
||||||
|
"{n} bands active": "{n} Bänder aktiv",
|
||||||
|
"flat": "flach",
|
||||||
|
"Sources": "Quellen",
|
||||||
|
"{name} has no FIR filters.": "{name} hat keine FIR-Filter.",
|
||||||
|
"Notes": "Notizen",
|
||||||
|
"Empty – add text in the module settings.": "Leer – Text in den Moduleinstellungen eintragen.",
|
||||||
|
"Title": "Titel",
|
||||||
|
"Text": "Text",
|
||||||
|
"Add modules": "Module hinzufügen",
|
||||||
|
"Drag into the page or tap": "Auf die Seite ziehen oder antippen",
|
||||||
|
"This module can't show this DSP.": "Dieses Modul kann diesen DSP nicht anzeigen.",
|
||||||
|
"Drag to move": "Zum Verschieben ziehen",
|
||||||
|
"Narrower": "Schmaler",
|
||||||
|
"Wider": "Breiter",
|
||||||
|
"Module settings": "Moduleinstellungen",
|
||||||
|
"Done": "Fertig",
|
||||||
|
"Customise": "Anpassen",
|
||||||
|
"Nothing here yet – press “Customise” and add modules.": "Noch nichts da – „Anpassen“ drücken und Module hinzufügen.",
|
||||||
|
"Channels shown together as “Overlay”": "Kanäle, die zusammen als „Overlay“ angezeigt werden",
|
||||||
|
"Drag to resize": "Zum Ändern der Größe ziehen",
|
||||||
|
"Read-only – tap to edit": "Nur ansehen – antippen zum Bearbeiten",
|
||||||
|
"Editing – tap for read-only": "Bearbeiten – antippen für Nur ansehen",
|
||||||
|
"Read-only": "Nur ansehen",
|
||||||
|
"Edit mode – changes go to the DSP": "Bearbeiten – Änderungen gehen an den DSP",
|
||||||
|
"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, so Sound Lab is part of the Windows and macOS apps only.": "Die API von REW antwortet nur auf dem eigenen Computer, darum gibt es das Sound Lab nur in den Apps für Windows und macOS.",
|
||||||
|
"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.",
|
||||||
|
"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 the API": "Ohne die API",
|
||||||
|
"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.",
|
||||||
|
"Only show dashboard while locked": "Während der Sperre nur das Dashboard zeigen",
|
||||||
|
"With the lock on, this window then shows just your dashboard, until it is unlocked with the PIN.": "Bei aktiver Sperre zeigt dieses Fenster dann nur dein Dashboard, bis es mit der PIN entsperrt wird.",
|
||||||
|
"A page for a tablet at the DJ booth: a big red light comes on when a limiter is working, so turning up more won't help.": "Eine Seite für ein Tablet am DJ-Pult: Ein großes rotes Licht geht an, wenn ein Limiter arbeitet, mehr Gas also nichts mehr bringt.",
|
||||||
|
"Share the page /djbrake": "Seite /djbrake freigeben",
|
||||||
|
"Address copied": "Adresse kopiert",
|
||||||
|
"Only reachable while remote access is on.": "Nur erreichbar, solange der Fernzugriff an ist.",
|
||||||
|
"Connect a DSP to choose.": "Verbinde einen DSP, um auszuwählen.",
|
||||||
|
"Show a short note that the limiter is not the goal": "Kurzen Hinweis anzeigen, dass der Limiter nicht das Ziel ist",
|
||||||
|
"Note always in English": "Hinweis immer auf Englisch",
|
||||||
|
"Overview": "Überblick",
|
||||||
|
"Correcting": "Korrigieren",
|
||||||
|
"Comparing": "Vergleichen",
|
||||||
|
"Trying first": "Erst ausprobieren",
|
||||||
|
"Planning": "Planen",
|
||||||
|
"The map": "Die Karte",
|
||||||
|
"Reading the map": "Die Karte lesen",
|
||||||
|
"Back of the hall": "Hinten in der Halle",
|
||||||
|
"Subs": "Subs",
|
||||||
|
"To the DSP": "Auf den DSP",
|
||||||
|
"A measurement taken over from REW: the orange curve is the prediction, the table lists each filter before anything reaches the DSP.": "Eine aus REW übernommene Messung: Die orange Kurve ist die Vorhersage, die Tabelle zeigt jeden Filter, bevor etwas auf den DSP kommt.",
|
||||||
|
"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.": "Senke lieber Spitzen ab, statt Löcher aufzufüllen. Ein Loch durch den Raum lässt sich mit mehr Leistung nicht füllen, und große Anhebungen kosten nur Headroom.",
|
||||||
|
"The “Level” map: green is around the median of the audience area, red is 12 dB below it.": "Die Karte „Pegel“: Grün liegt um den Median der Publikumsfläche, Rot 12 dB darunter.",
|
||||||
|
"“Level”: how loud each spot of the room is, compared with the median of the audience area.": "„Pegel“: wie laut jede Stelle im Raum ist, verglichen mit dem Median der Publikumsfläche.",
|
||||||
|
"“Sub”: where the subs add up and where they cancel at the chosen frequency.": "„Sub“: wo sich die Subs bei der gewählten Frequenz addieren und wo sie sich auslöschen.",
|
||||||
|
"“Timing”: marked areas mean a delay arrives before the mains or more than 30 ms late.": "„Timing“: Markierte Flächen bedeuten, dass ein Delay vor den Mains oder mehr als 30 ms zu spät ankommt.",
|
||||||
|
"The “Delays” table: distance and delay per speaker, next to what is set on the DSP now.": "Die Tabelle „Delays“: Abstand und Delay pro Lautsprecher, daneben der aktuelle Wert auf dem DSP.",
|
||||||
|
"Leave out these limiters": "Diese Limiter ausnehmen",
|
||||||
|
"All others count. Muted outputs never count.": "Alle anderen zählen. Stummgeschaltete Ausgänge zählen nie.",
|
||||||
|
"Colours and group names belong to the loaded preset (by its name) and come back when you load it.": "Farben und Gruppennamen gehören zum geladenen Preset (über seinen Namen) und kommen beim Laden wieder.",
|
||||||
|
"Widget settings": "Widget-Einstellungen",
|
||||||
|
"Reset all app settings…": "Alle App-Einstellungen zurücksetzen…",
|
||||||
|
"Reset all app settings?": "Alle App-Einstellungen zurücksetzen?",
|
||||||
|
"{names} still has the lowered levels of an interrupted audio test. The app can no longer undo that after the reset.": "{names} hat noch die abgesenkten Pegel eines abgebrochenen Audiotests. Nach dem Zurücksetzen kann die App das nicht mehr rückgängig machen.",
|
||||||
|
"To confirm, type these letters:": "Zum Bestätigen diese Buchstaben eingeben:",
|
||||||
|
"Letters": "Buchstaben",
|
||||||
|
"Nothing here yet – you can add modules on a computer.": "Noch nichts da – Module kannst du am Computer hinzufügen.",
|
||||||
|
"End the audio test first: the DSP would stay at the lowered level": "Beende zuerst den Audiotest: Der DSP würde sonst auf dem abgesenkten Pegel bleiben",
|
||||||
|
"Release mute all first: the DSPs would stay muted": "Hebe zuerst „Alle stumm“ auf: Die DSPs würden sonst stumm bleiben",
|
||||||
|
"All DSPs are disconnected first, then the app starts fresh.": "Zuerst werden alle DSPs getrennt, dann startet die App frisch.",
|
||||||
|
"Removed from the app": "Wird aus der App gelöscht",
|
||||||
|
"DSP list": "DSP-Liste",
|
||||||
|
"Colours and group names": "Farben und Gruppennamen",
|
||||||
|
"Amplifiers and SoundField plan": "Verstärker und SoundField-Plan",
|
||||||
|
"Dashboard and DJ Brake": "Dashboard und DJ Brake",
|
||||||
|
"Remote access and language": "Fernzugriff und Sprache",
|
||||||
|
"PIN, back to 1234": "PIN, zurück auf 1234",
|
||||||
|
"Stays as it is": "Bleibt, wie es ist",
|
||||||
|
"All settings in the DSPs": "Alle Einstellungen in den DSPs",
|
||||||
|
"Presets in the DSPs": "Presets in den DSPs",
|
||||||
|
"A copy of the old app settings": "Eine Kopie der alten App-Einstellungen",
|
||||||
|
"Anyone in your network can open it without a PIN. It shows only the light and changes nothing.": "Jeder in deinem Netzwerk kann sie ohne PIN öffnen. Sie zeigt nur das Licht und ändert nichts.",
|
||||||
};
|
};
|
||||||
|
|
||||||
const DE_PATTERNS = [
|
const DE_PATTERNS = [
|
||||||
|
[/^Too many FIR coefficients: at most (\d+) here$/, "Zu viele FIR-Koeffizienten: hier höchstens $1"],
|
||||||
|
[/^The DSP did not answer (\d+) frames$/, "Der DSP hat auf $1 Datenpakete nicht geantwortet"],
|
||||||
[/^Port (\d+) is already in use – please choose another port$/, "Port $1 ist schon belegt – bitte einen anderen Port wählen"],
|
[/^Port (\d+) is already in use – please choose another port$/, "Port $1 ist schon belegt – bitte einen anderen Port wählen"],
|
||||||
[/^Port (\d+) is not available \((.*)\)$/, "Port $1 ist nicht verfügbar ($2)"],
|
[/^Port (\d+) is not available \((.*)\)$/, "Port $1 ist nicht verfügbar ($2)"],
|
||||||
[/^Cannot open USB device \(error (.*)\)$/, "USB-Gerät lässt sich nicht öffnen (Fehler $1)"],
|
[/^Cannot open USB device \(error (.*)\)$/, "USB-Gerät lässt sich nicht öffnen (Fehler $1)"],
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
|
||||||
<meta name="theme-color" content="#0b0c0f">
|
<meta name="theme-color" content="#0b0c0f">
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
@@ -12,6 +12,28 @@
|
|||||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%23111418'/%3E%3Cpath d='M7 22V10M13 22V6M19 22V14M25 22V9' stroke='%2338bdf8' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E">
|
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%23111418'/%3E%3Cpath d='M7 22V10M13 22V6M19 22V14M25 22V9' stroke='%2338bdf8' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<script>
|
||||||
|
// no zoom on phones and tablets: it breaks the faders. Safari ignores the viewport tag for this
|
||||||
|
["gesturestart", "gesturechange", "gestureend"].forEach(function (t) { document.addEventListener(t, function (e) { e.preventDefault(); }); });
|
||||||
|
document.addEventListener("touchmove", function (e) { if (e.touches.length > 1) e.preventDefault(); }, { passive: false });
|
||||||
|
</script>
|
||||||
|
<div id="splash" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 32 32" width="72" height="72"><path d="M7 22V10"/><path d="M13 22V6"/><path d="M19 22V14"/><path d="M25 22V9"/></svg>
|
||||||
|
<b>DSP Control</b><small>VK-Audio</small>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
// start animation of the desktop apps: only their login arrives with this parameter, a reload doesn't.
|
||||||
|
// The language comes along: on the app's new port the browser storage is empty, and correcting it later needs a reload
|
||||||
|
(function () {
|
||||||
|
var el = document.getElementById("splash");
|
||||||
|
var m = /^\?start=app&lang=(en|de)$/.exec(location.search);
|
||||||
|
if (!m) return el.remove();
|
||||||
|
try { localStorage.setItem("dsp.lang", m[1]); } catch (e) { /* private mode */ }
|
||||||
|
history.replaceState(null, "", "/");
|
||||||
|
el.classList.add("show");
|
||||||
|
setTimeout(function () { el.remove(); }, 1500);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
<div id="login" hidden></div>
|
<div id="login" hidden></div>
|
||||||
<div id="app" hidden>
|
<div id="app" hidden>
|
||||||
<header id="top">
|
<header id="top">
|
||||||
@@ -20,12 +42,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="devtabs"></div>
|
<div id="devtabs"></div>
|
||||||
<nav id="viewtabs" aria-label="View" data-t-label="View">
|
<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>
|
||||||
<button data-view="mixer"><svg viewBox="0 0 24 24"><path d="M6 3v18M12 3v18M18 3v18"/><rect x="3.5" y="13" width="5" height="3" rx="1"/><rect x="9.5" y="7" width="5" height="3" rx="1"/><rect x="15.5" y="10" width="5" height="3" rx="1"/></svg><span>Mixer</span></button>
|
<button data-view="mixer"><svg viewBox="0 0 24 24"><path d="M6 3v18M12 3v18M18 3v18"/><rect x="3.5" y="13" width="5" height="3" rx="1"/><rect x="9.5" y="7" width="5" height="3" rx="1"/><rect x="15.5" y="10" width="5" height="3" rx="1"/></svg><span>Mixer</span></button>
|
||||||
<button data-view="channel"><svg viewBox="0 0 24 24"><path d="M2 14c3 0 3-7 6-7s3 10 6 10 3-6 6-6h2"/></svg><span data-t="Channel">Channel</span></button>
|
<button data-view="channel"><svg viewBox="0 0 24 24"><path d="M2 14c3 0 3-7 6-7s3 10 6 10 3-6 6-6h2"/></svg><span data-t="Channel">Channel</span></button>
|
||||||
<button data-view="routing"><svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16M8 3v18M16 3v18"/><circle cx="8" cy="6" r="2.2" class="f"/><circle cx="16" cy="12" r="2.2" class="f"/><circle cx="8" cy="18" r="2.2" class="f"/></svg><span>Routing</span></button>
|
<button data-view="routing"><svg viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16M8 3v18M16 3v18"/><circle cx="8" cy="6" r="2.2" class="f"/><circle cx="16" cy="12" r="2.2" class="f"/><circle cx="8" cy="18" r="2.2" class="f"/></svg><span>Routing</span></button>
|
||||||
<button data-view="link"><svg viewBox="0 0 24 24"><path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/></svg><span>Link</span></button>
|
<button data-view="link"><svg viewBox="0 0 24 24"><path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/></svg><span data-t="Channel settings">Channel settings</span><span class="short" data-t="Channels">Channels</span></button>
|
||||||
|
<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="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" hidden><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>
|
</nav>
|
||||||
|
<button id="btn-muteall" class="icon" aria-label="Mute all" title="Mute all"></button>
|
||||||
|
<button id="btn-guard" class="guard" hidden role="switch"></button>
|
||||||
<button id="btn-lock" class="icon" hidden aria-label="Lock" title="Lock"></button>
|
<button id="btn-lock" class="icon" hidden aria-label="Lock" title="Lock"></button>
|
||||||
<button id="btn-settings" class="icon" aria-label="Settings" title="Settings" data-t-label="Settings">
|
<button id="btn-settings" class="icon" aria-label="Settings" title="Settings" data-t-label="Settings">
|
||||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg>
|
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg>
|
||||||
@@ -38,5 +67,9 @@
|
|||||||
<div id="toast" hidden></div>
|
<div id="toast" hidden></div>
|
||||||
<script src="/i18n.js"></script>
|
<script src="/i18n.js"></script>
|
||||||
<script src="/app.js"></script>
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -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. Desktop apps only: REW's API only answers on the computer
|
||||||
|
// it runs on, so the server inside the app talks to it (see rew_call).
|
||||||
|
|
||||||
|
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"))))),
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,679 @@
|
|||||||
|
"use strict";
|
||||||
|
/* SoundField – top view of the room: place speakers, see level / sub / timing maps, get placement
|
||||||
|
suggestions and the delays to set on the DSP outputs.
|
||||||
|
|
||||||
|
Free-field model (no reflections, no air absorption): level falls 6 dB per doubling of distance,
|
||||||
|
directivity from the horizontal coverage angle (−6 dB at its edges, about −24 dB behind the box).
|
||||||
|
Subs are summed with phase (they interfere), everything else by energy. Positions are metres:
|
||||||
|
x across the room (0 = left wall), y from the stage wall into the room. Aim 0° points into the room. */
|
||||||
|
|
||||||
|
const SF_TYPES = {
|
||||||
|
top12: { role: "main", cov: 90, spl: 128, h: 2.4 },
|
||||||
|
top15: { role: "main", cov: 75, spl: 131, h: 2.6 },
|
||||||
|
column: { role: "main", cov: 120, spl: 124, h: 2.0 },
|
||||||
|
fill8: { role: "fill", cov: 100, spl: 118, h: 1.1 },
|
||||||
|
sub18: { role: "sub", cov: 360, spl: 132, h: 0.4 },
|
||||||
|
sub218: { role: "sub", cov: 360, spl: 137, h: 0.5 },
|
||||||
|
custom: {},
|
||||||
|
};
|
||||||
|
const sfTypeLabel = k => ({ top12: t("Top 12″"), top15: t("Top 15″"), column: t("Column"), fill8: t("Fill 8″"),
|
||||||
|
sub18: t("Sub 18″"), sub218: t("Sub 2×18″"), custom: t("Custom") }[k] || k);
|
||||||
|
const SF_ROLE_COLOR = { main: "#38bdf8", sub: "#f472b6", delay: "#f59e0b", fill: "#a3e635" };
|
||||||
|
const sfRoleLabel = r => ({ main: t("Main"), sub: "Sub", delay: "Delay", fill: "Fill" }[r] || r);
|
||||||
|
const SF_SUB_HZ = [40, 50, 63, 80, 100, 125];
|
||||||
|
|
||||||
|
const sf = { // view state (the plan itself is S.sf, shared through the server)
|
||||||
|
sel: null, canvas: null, geo: null, drag: null, hover: null, savedAt: 0, saveTimer: null,
|
||||||
|
panels: {}, // side panels, rebuilt after a change (never the canvas while dragging)
|
||||||
|
};
|
||||||
|
const sfMode = () => store.get("dsp.sfmap") || "level";
|
||||||
|
const sfSubHz = () => +(store.get("dsp.sfhz") || 63);
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ plan helpers
|
||||||
|
|
||||||
|
function sfDefault() {
|
||||||
|
return { room: { w: 20, d: 30 }, stage: { w: 8, d: 4 }, temp: 20, precedence: 5, ear: 1.7,
|
||||||
|
ref: { x: 10, y: 18 }, speakers: [] };
|
||||||
|
}
|
||||||
|
const sfPlan = () => S.sf || (S.sf = sfDefault());
|
||||||
|
const sfSpeed = p => 331.3 + 0.606 * p.temp; // speed of sound in m/s
|
||||||
|
const sfR = (p, s, x, y) => Math.max(0.5, Math.hypot(x - s.x, y - s.y, s.h - p.ear));
|
||||||
|
const sfMs = (p, s, x, y) => sfR(p, s, x, y) / sfSpeed(p) * 1000;
|
||||||
|
const sfDir = s => [Math.sin(s.aim * Math.PI / 180), Math.cos(s.aim * Math.PI / 180)];
|
||||||
|
const sfInAudience = (p, x, y) => !(y < p.stage.d && Math.abs(x - p.room.w / 2) < p.stage.w / 2);
|
||||||
|
|
||||||
|
function sfDirectivity(s, x, y) {
|
||||||
|
if (s.cov >= 360) return 0;
|
||||||
|
const [dx, dy] = sfDir(s), vx = x - s.x, vy = y - s.y, len = Math.hypot(vx, vy) || 1;
|
||||||
|
const th = Math.acos(clamp((vx * dx + vy * dy) / len, -1, 1)) * 180 / Math.PI, half = s.cov / 2;
|
||||||
|
return th <= half ? -6 * (th / half) ** 2 : -6 - 18 * Math.min(1, (th - half) / Math.max(1, 180 - half));
|
||||||
|
}
|
||||||
|
const sfLevel = (p, s, x, y) => s.spl - 20 * Math.log10(sfR(p, s, x, y)) + sfDirectivity(s, x, y);
|
||||||
|
|
||||||
|
// stacks: a top on a distance pole stands on a sub (same spot, higher up)
|
||||||
|
const SF_POLE = 1.8; // acoustic centre of a top on a pole, above the sub's
|
||||||
|
const sfOnSub = (p, s) => s.mount && p.speakers.find(x => x.id === s.mount && x.role === "sub");
|
||||||
|
const sfTopOf = (p, sub) => p.speakers.find(x => x.mount === sub.id);
|
||||||
|
function sfMount(p, top, sub) {
|
||||||
|
top.mount = sub.id; top.x = sub.x; top.y = sub.y;
|
||||||
|
top.h = Math.max(top.h, +(sub.h + SF_POLE).toFixed(1));
|
||||||
|
}
|
||||||
|
function sfMoveTo(p, s, x, y) { // move a speaker; a stack moves as one, delay/fill targets move along
|
||||||
|
const base = sfOnSub(p, s) || s;
|
||||||
|
const dx = x - base.x, dy = y - base.y;
|
||||||
|
for (const m of [base, ...p.speakers.filter(t2 => t2.mount === base.id)]) {
|
||||||
|
m.x = clamp(m.x + dx, 0, p.room.w); m.y = clamp(m.y + dy, 0, p.room.d);
|
||||||
|
if (m.role === "delay" || m.role === "fill") { m.tx = clamp(m.tx + dx, 0, p.room.w); m.ty = clamp(m.ty + dy, 0, p.room.d); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// free sub close to (x, y) a top could be put on
|
||||||
|
const sfSnapSub = (p, top, x, y) => top.role === "sub" ? null : p.speakers.find(u => u.role === "sub" && Math.hypot(u.x - x, u.y - y) < 0.8 &&
|
||||||
|
(!sfTopOf(p, u) || sfTopOf(p, u) === top));
|
||||||
|
|
||||||
|
function sfSave() {
|
||||||
|
sf.savedAt = Date.now();
|
||||||
|
clearTimeout(sf.saveTimer);
|
||||||
|
// the local plan stays the one being edited (panels and drags hold references into it)
|
||||||
|
sf.saveTimer = setTimeout(() => api("PUT", "/api/soundfield", S.sf)
|
||||||
|
.then(() => { sf.savedAt = Date.now(); }).catch(e => toast(t("Error: ") + trMsg(e.message))), 350);
|
||||||
|
}
|
||||||
|
function sfOnRemote(data) { // another device changed the plan
|
||||||
|
if (Date.now() - sf.savedAt < 1500 || sf.drag) return; // our own echo, or we are in the middle of a drag
|
||||||
|
S.sf = data;
|
||||||
|
if (S.view === "soundfield" && !S.settings) sfRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ delays
|
||||||
|
|
||||||
|
function sfDelays(p) {
|
||||||
|
const mains = p.speakers.filter(s => s.role === "main"), subs = p.speakers.filter(s => s.role === "sub");
|
||||||
|
const out = {}, info = {};
|
||||||
|
const R = p.ref;
|
||||||
|
const mainT = mains.length ? mains.reduce((a, s) => a + sfMs(p, s, R.x, R.y), 0) / mains.length : null;
|
||||||
|
let base = 0;
|
||||||
|
if (mainT != null) {
|
||||||
|
const subD = subs.map(s => mainT - sfMs(p, s, R.x, R.y));
|
||||||
|
base = Math.max(0, -Math.min(0, ...subD)); // a sub further away than the mains: delay the mains instead
|
||||||
|
subs.forEach((s, i) => { out[s.id] = subD[i] + base; info[s.id] = "ref"; });
|
||||||
|
}
|
||||||
|
mains.forEach(s => { out[s.id] = base; info[s.id] = "ref"; });
|
||||||
|
for (const s of p.speakers.filter(s => s.role === "delay" || s.role === "fill")) {
|
||||||
|
const tMain = mains.length ? Math.min(...mains.map(m => sfMs(p, m, s.tx, s.ty) + out[m.id])) : null;
|
||||||
|
out[s.id] = tMain == null ? 0 : Math.max(0, tMain - sfMs(p, s, s.tx, s.ty) + p.precedence);
|
||||||
|
info[s.id] = "target";
|
||||||
|
}
|
||||||
|
if (!mains.length) subs.forEach(s => { out[s.id] = 0; info[s.id] = "none"; });
|
||||||
|
return { ms: out, info };
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ maps
|
||||||
|
|
||||||
|
// level colours relative to the median of the audience area: cyan = clearly louder, green = typical, red = too quiet
|
||||||
|
const LEVEL_STOPS = [[9, [125, 211, 252]], [4.5, [45, 212, 191]], [0, [34, 197, 94]], [-3, [163, 230, 53]], [-6, [234, 179, 8]],
|
||||||
|
[-9, [249, 115, 22]], [-12, [239, 68, 68]], [-20, [110, 20, 20]]];
|
||||||
|
const TIME_STOPS = [[0, [34, 197, 94]], [10, [132, 204, 22]], [20, [234, 179, 8]], [30, [249, 115, 22]], [45, [239, 68, 68]]];
|
||||||
|
function sfStops(stops, v, desc) {
|
||||||
|
for (let i = 0; i < stops.length - 1; i++) {
|
||||||
|
const [a, ca] = stops[i], [b, cb] = stops[i + 1];
|
||||||
|
if (desc ? v >= b : v <= b) { const f = (v - a) / (b - a); return ca.map((c, k) => Math.round(c + (cb[k] - c) * clamp(f, 0, 1))); }
|
||||||
|
}
|
||||||
|
return stops[stops.length - 1][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// value grid over the room for the current map mode; null cells are left empty
|
||||||
|
function sfField(p, mode) {
|
||||||
|
const step = Math.max(0.2, Math.max(p.room.w, p.room.d) / 130);
|
||||||
|
const cols = Math.ceil(p.room.w / step), rows = Math.ceil(p.room.d / step);
|
||||||
|
const vals = new Float32Array(cols * rows).fill(NaN);
|
||||||
|
const dl = sfDelays(p).ms;
|
||||||
|
const tops = p.speakers.filter(s => s.role !== "sub"), subs = p.speakers.filter(s => s.role === "sub");
|
||||||
|
const mains = p.speakers.filter(s => s.role === "main"), late = p.speakers.filter(s => s.role === "delay" || s.role === "fill");
|
||||||
|
const k = 2 * Math.PI * sfSubHz() / 1000; // phase per ms
|
||||||
|
for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) {
|
||||||
|
const x = (c + 0.5) * step, y = (r + 0.5) * step;
|
||||||
|
let v = NaN;
|
||||||
|
if (mode === "level" && tops.length) {
|
||||||
|
let e = 0; for (const s of tops) e += 10 ** (sfLevel(p, s, x, y) / 10);
|
||||||
|
v = 10 * Math.log10(e);
|
||||||
|
} else if (mode === "sub" && subs.length) {
|
||||||
|
let re = 0, im = 0;
|
||||||
|
for (const s of subs) { const a = 10 ** (sfLevel(p, s, x, y) / 20), ph = k * (sfMs(p, s, x, y) + (dl[s.id] || 0)); re += a * Math.cos(ph); im -= a * Math.sin(ph); }
|
||||||
|
v = 10 * Math.log10(re * re + im * im || 1e-12);
|
||||||
|
} else if (mode === "time" && mains.length && late.length) {
|
||||||
|
// arrival of the strongest delay/fill speaker relative to the first main arrival, where it matters (≥ main − 6 dB)
|
||||||
|
let tm = Infinity, lm = -Infinity;
|
||||||
|
for (const s of mains) { tm = Math.min(tm, sfMs(p, s, x, y) + (dl[s.id] || 0)); lm = Math.max(lm, sfLevel(p, s, x, y)); }
|
||||||
|
let best = null, bl = -Infinity;
|
||||||
|
for (const s of late) { const l = sfLevel(p, s, x, y); if (l > bl) { bl = l; best = s; } }
|
||||||
|
if (best && bl >= lm - 6) v = sfMs(p, best, x, y) + (dl[best.id] || 0) - tm;
|
||||||
|
}
|
||||||
|
vals[r * cols + c] = v;
|
||||||
|
}
|
||||||
|
return { step, cols, rows, vals };
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfStats(p, field) {
|
||||||
|
const a = [];
|
||||||
|
for (let r = 0; r < field.rows; r++) for (let c = 0; c < field.cols; c++) {
|
||||||
|
const v = field.vals[r * field.cols + c];
|
||||||
|
if (!isNaN(v) && sfInAudience(p, (c + 0.5) * field.step, (r + 0.5) * field.step)) a.push(v);
|
||||||
|
}
|
||||||
|
if (!a.length) return null;
|
||||||
|
a.sort((x, y) => x - y);
|
||||||
|
const q = f => a[Math.min(a.length - 1, Math.floor(f * a.length))], med = q(0.5);
|
||||||
|
return { max: a[a.length - 1], min: a[0], med, spread: q(0.95) - q(0.05), within3: a.filter(v => Math.abs(v - med) <= 3).length / a.length,
|
||||||
|
early: a.filter(v => v < -1).length / a.length, echo: a.filter(v => v > 30).length / a.length };
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ suggestions
|
||||||
|
|
||||||
|
// level of the mains alone at (x, y), for the suggestions
|
||||||
|
const sfMainLevel = (p, x, y, mains = p.speakers.filter(s => s.role === "main")) =>
|
||||||
|
10 * Math.log10(mains.reduce((e, s) => e + 10 ** (sfLevel(p, s, x, y) / 10), 0) || 1e-12);
|
||||||
|
|
||||||
|
function sfSuggestions(p) {
|
||||||
|
const out = [], W = p.room.w, D = p.room.d, sd = p.stage.d;
|
||||||
|
const mains = p.speakers.filter(s => s.role === "main"), subs = p.speakers.filter(s => s.role === "sub");
|
||||||
|
const delays = p.speakers.filter(s => s.role === "delay"), fills = p.speakers.filter(s => s.role === "fill");
|
||||||
|
const add = (kind, text, apply, label) => out.push({ kind, text, apply, label });
|
||||||
|
if (!mains.length) {
|
||||||
|
add("tip", t("Start with a stereo pair at the front edge of the stage and a sub in the centre."), q => {
|
||||||
|
const x0 = W / 2 - Math.max(2, q.stage.w / 2), x1 = W / 2 + Math.max(2, q.stage.w / 2), y = Math.max(0.5, sd - 0.3);
|
||||||
|
q.speakers.push(sfNew(q, "top12", x0, y, t("Main L")), sfNew(q, "top12", x1, y, t("Main R")),
|
||||||
|
sfNew(q, "sub18", W / 2, Math.min(D - 1, sd + 0.6), "Sub"));
|
||||||
|
sfAimMains(q);
|
||||||
|
}, t("Quick start"));
|
||||||
|
add("tip", t("Or ground stacks: a sub left and right with the top on a distance pole."), q => {
|
||||||
|
const off = Math.max(2, q.stage.w / 2), y = Math.min(D - 1, sd + 0.5);
|
||||||
|
for (const [x, side] of [[W / 2 - off, "L"], [W / 2 + off, "R"]]) {
|
||||||
|
const sub = sfNew(q, "sub18", x, y, `Sub ${side}`), top = sfNew(q, "top12", x, y, t(side === "L" ? "Main L" : "Main R"));
|
||||||
|
sfMount(q, top, sub);
|
||||||
|
q.speakers.push(sub, top);
|
||||||
|
}
|
||||||
|
sfAimMains(q);
|
||||||
|
}, t("Stacks"));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
// 1. aim of the mains: towards ⅔ of the audience depth on the centre line
|
||||||
|
const aimFor = s => Math.round(Math.atan2(W / 2 - s.x, sd + (D - sd) * 2 / 3 - s.y) * 180 / Math.PI);
|
||||||
|
const offAim = mains.filter(s => s.cov < 360 && Math.abs(aimFor(s) - s.aim) > 8);
|
||||||
|
if (offAim.length)
|
||||||
|
add("tip", t("Aim the mains at ⅔ of the room depth on the centre line ({list}).", { list: offAim.map(s => `${s.name} ${aimFor(s)}°`).join(", ") }),
|
||||||
|
q => sfAimMains(q), t("Aim"));
|
||||||
|
// 2. height of the mains: smaller difference between front and back
|
||||||
|
const fb = h => { const m = mains.map(s => ({ ...s, h })); return sfMainLevel(p, W / 2, sd + 1, m) - sfMainLevel(p, W / 2, D - 1, m); };
|
||||||
|
const hNow = mains.reduce((a, s) => a + s.h, 0) / mains.length, now = fb(hNow);
|
||||||
|
let best = hNow, bestV = now;
|
||||||
|
const hMax = mains.some(s => sfOnSub(p, s)) ? 3 : 5; // tops on poles: no higher than about 3 m
|
||||||
|
for (let h = 2; h <= hMax + 0.01; h += 0.5) { const v = fb(h); if (v < bestV - 0.01) { bestV = v; best = h; } }
|
||||||
|
if (best > hNow + 0.3 && now - bestV >= 1.5)
|
||||||
|
add("tip", t("Raise the mains to {h} m: front-to-back difference {a} dB → {b} dB.", { h: best.toFixed(1), a: now.toFixed(1), b: bestV.toFixed(1) }),
|
||||||
|
q => q.speakers.forEach(s => { if (s.role === "main") s.h = best; }), t("Raise"));
|
||||||
|
// 3. delay line when the back gets too quiet
|
||||||
|
const L0 = sfMainLevel(p, W / 2, sd + (D - sd) * 0.3), back = sfMainLevel(p, W / 2, D - 1);
|
||||||
|
if (!delays.length && L0 - back > 6 && D - sd > 12) {
|
||||||
|
let yd = D - 1;
|
||||||
|
for (let y = sd + 4; y < D - 2; y += 0.25) if (sfMainLevel(p, W / 2, y) <= L0 - 4.5) { yd = y; break; }
|
||||||
|
const throwM = D - yd, n = clamp(Math.ceil(W / Math.max(5, 2 * throwM * Math.tan(45 * Math.PI / 180))), 1, 4);
|
||||||
|
add("warn", t("The back of the room is {db} dB quieter than the front third. A delay line with {n} speaker(s) at about {y} m keeps it even.",
|
||||||
|
{ db: (L0 - back).toFixed(0), n, y: yd.toFixed(1) }), q => {
|
||||||
|
for (let i = 0; i < n; i++) {
|
||||||
|
const s = sfNew(q, "top12", W * (i + 0.5) / n, yd, `Delay ${i + 1}`);
|
||||||
|
Object.assign(s, { role: "delay", h: 3, aim: 0, tx: s.x, ty: Math.min(D - 0.5, yd + throwM * 0.5) });
|
||||||
|
q.speakers.push(s);
|
||||||
|
}
|
||||||
|
}, t("Add delay line"));
|
||||||
|
}
|
||||||
|
// 4. subs: spacing creates cancellation lanes ("power alley")
|
||||||
|
if (subs.length > 1) {
|
||||||
|
const xs = subs.map(s => s.x), spread = Math.max(...xs) - Math.min(...xs), half = sfSpeed(p) / 80 / 2;
|
||||||
|
if (spread > half)
|
||||||
|
add("warn", t("The subs are {m} m apart – at 80 Hz that causes cancellation lanes through the room (power alley). A centre cluster sounds even everywhere.",
|
||||||
|
{ m: spread.toFixed(1) }) + (subs.some(u => sfTopOf(p, u)) ? " " + t("The tops then stay where they are on their own stands.") : ""), q => {
|
||||||
|
const ss = q.speakers.filter(s => s.role === "sub");
|
||||||
|
q.speakers.forEach(s => { s.mount = ""; }); // tops on poles stay where they are, on their own stands
|
||||||
|
ss.forEach((s, i) => Object.assign(s, { x: W / 2 + (i - (ss.length - 1) / 2) * 0.7, y: Math.min(D - 1, sd + 0.6), aim: 0 }));
|
||||||
|
}, t("Centre cluster"));
|
||||||
|
}
|
||||||
|
// 5. front rows in the shadow of high mains
|
||||||
|
const front = sfMainLevel(p, W / 2, sd + 1.2), mid = sfMainLevel(p, W / 2, sd + (D - sd) * 0.4);
|
||||||
|
if (!fills.length && mid - front > 3 && p.stage.w >= 2)
|
||||||
|
add("tip", t("The first rows in the centre get {db} dB less than the middle of the room – front fills at the stage edge help.", { db: (mid - front).toFixed(0) }), q => {
|
||||||
|
const n = clamp(Math.round(q.stage.w / 4), 1, 4);
|
||||||
|
for (let i = 0; i < n; i++) {
|
||||||
|
const s = sfNew(q, "fill8", W / 2 - q.stage.w / 2 + q.stage.w * (i + 0.5) / n, Math.max(0.3, sd - 0.2), `Fill ${i + 1}`);
|
||||||
|
Object.assign(s, { tx: s.x, ty: Math.min(D - 1, sd + 3) });
|
||||||
|
q.speakers.push(s);
|
||||||
|
}
|
||||||
|
}, t("Add front fills"));
|
||||||
|
// 6. coverage and timing summary
|
||||||
|
const lv = sfStats(p, sfField(p, "level"));
|
||||||
|
if (lv) add(lv.spread <= 6 ? "ok" : "info", t("Level in the audience area: {spread} dB spread, {pct} % within ±3 dB of the median.",
|
||||||
|
{ spread: lv.spread.toFixed(1), pct: Math.round(lv.within3 * 100) }));
|
||||||
|
if (delays.length || fills.length) {
|
||||||
|
const tm = sfStats(p, sfField(p, "time"));
|
||||||
|
if (tm && (tm.early > 0.05 || tm.echo > 0.05))
|
||||||
|
add("warn", t("Timing: in {a} % of the area a delay/fill arrives before the mains, in {b} % more than 30 ms late. Check positions and apply the calculated delays.",
|
||||||
|
{ a: Math.round(tm.early * 100), b: Math.round(tm.echo * 100) }));
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfAimMains(q) {
|
||||||
|
const W = q.room.w, aimY = q.stage.d + (q.room.d - q.stage.d) * 2 / 3;
|
||||||
|
q.speakers.forEach(s => { if (s.role === "main" && s.cov < 360) s.aim = Math.round(Math.atan2(W / 2 - s.x, aimY - s.y) * 180 / Math.PI); });
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfNew(q, type, x, y, name) {
|
||||||
|
const d = SF_TYPES[type] || {};
|
||||||
|
const s = { id: Math.random().toString(36).slice(2, 10), name: name || sfTypeLabel(type), role: d.role || "main", type,
|
||||||
|
x: clamp(x, 0, q.room.w), y: clamp(y, 0, q.room.d), h: d.h ?? 2, aim: 0, cov: d.cov ?? 90, spl: d.spl ?? 125, outs: [] };
|
||||||
|
s.tx = s.x; s.ty = Math.min(q.room.d, s.y + 6);
|
||||||
|
s.mount = "";
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ drawing
|
||||||
|
|
||||||
|
function sfDraw() {
|
||||||
|
const cv = sf.canvas, p = sfPlan();
|
||||||
|
if (!cv || !cv.isConnected) return;
|
||||||
|
const W = cv.clientWidth;
|
||||||
|
if (!W) return;
|
||||||
|
const m = 30, maxH = Math.max(320, Math.min(window.innerHeight * 0.7, 900));
|
||||||
|
const sc = Math.min((W - 2 * m) / p.room.w, (maxH - 2 * m) / p.room.d);
|
||||||
|
const H = Math.round(p.room.d * sc + 2 * m), ox = (W - p.room.w * sc) / 2;
|
||||||
|
if (cv.style.height !== H + "px") cv.style.height = H + "px";
|
||||||
|
const dpr = window.devicePixelRatio || 1;
|
||||||
|
cv.width = W * dpr; cv.height = H * dpr;
|
||||||
|
const g = cv.getContext("2d");
|
||||||
|
g.scale(dpr, dpr);
|
||||||
|
const X = x => ox + x * sc, Y = y => m + y * sc;
|
||||||
|
sf.geo = { X, Y, sc, toM: (px, py) => [(px - ox) / sc, (py - m) / sc] };
|
||||||
|
// room
|
||||||
|
g.fillStyle = "#0e1116"; g.fillRect(X(0), Y(0), p.room.w * sc, p.room.d * sc);
|
||||||
|
// map
|
||||||
|
const mode = sfMode();
|
||||||
|
let field = null;
|
||||||
|
if (mode !== "off") {
|
||||||
|
field = sfField(p, mode);
|
||||||
|
const st = sfStats(p, field), ref = mode === "time" ? 0 : st ? st.med : 0;
|
||||||
|
const img = new ImageData(field.cols, field.rows);
|
||||||
|
for (let i = 0; i < field.vals.length; i++) {
|
||||||
|
const v = field.vals[i];
|
||||||
|
if (isNaN(v)) continue;
|
||||||
|
let col;
|
||||||
|
if (mode === "time") col = v < -1 ? [217, 70, 239] : sfStops(TIME_STOPS, v, false);
|
||||||
|
else col = sfStops(LEVEL_STOPS, Math.min(9, v - ref), true);
|
||||||
|
img.data.set([...col, 120], i * 4);
|
||||||
|
}
|
||||||
|
const off = document.createElement("canvas");
|
||||||
|
off.width = field.cols; off.height = field.rows;
|
||||||
|
off.getContext("2d").putImageData(img, 0, 0);
|
||||||
|
g.imageSmoothingEnabled = true;
|
||||||
|
g.drawImage(off, X(0), Y(0), field.cols * field.step * sc, field.rows * field.step * sc);
|
||||||
|
sf.field = field; sf.fieldRef = ref; sf.stats = st;
|
||||||
|
} else { sf.field = null; sf.stats = null; }
|
||||||
|
// grid
|
||||||
|
g.font = "10px system-ui"; g.fillStyle = "#5b6673"; g.lineWidth = 1;
|
||||||
|
for (let x = 0; x <= p.room.w + 0.001; x++) {
|
||||||
|
g.strokeStyle = x % 5 ? "#ffffff0d" : "#ffffff22"; g.beginPath(); g.moveTo(X(x), Y(0)); g.lineTo(X(x), Y(p.room.d)); g.stroke();
|
||||||
|
if (x % 5 === 0) g.fillText(x + " m", X(x) - 6, m - 8);
|
||||||
|
}
|
||||||
|
for (let y = 0; y <= p.room.d + 0.001; y++) {
|
||||||
|
g.strokeStyle = y % 5 ? "#ffffff0d" : "#ffffff22"; g.beginPath(); g.moveTo(X(0), Y(y)); g.lineTo(X(p.room.w), Y(y)); g.stroke();
|
||||||
|
if (y % 5 === 0) { g.textAlign = "end"; g.fillText(y, X(0) - 5, Y(y) + 3); g.textAlign = "start"; }
|
||||||
|
}
|
||||||
|
g.strokeStyle = "#3a4552"; g.lineWidth = 2; g.strokeRect(X(0), Y(0), p.room.w * sc, p.room.d * sc);
|
||||||
|
// stage
|
||||||
|
if (p.stage.w > 0 && p.stage.d > 0) {
|
||||||
|
const sx = X(p.room.w / 2 - p.stage.w / 2), sw = p.stage.w * sc, sh = p.stage.d * sc;
|
||||||
|
g.fillStyle = "#1c2027e6"; g.fillRect(sx, Y(0), sw, sh);
|
||||||
|
g.save(); g.beginPath(); g.rect(sx, Y(0), sw, sh); g.clip(); g.strokeStyle = "#ffffff12"; g.lineWidth = 1;
|
||||||
|
for (let i = -sh; i < sw; i += 10) { g.beginPath(); g.moveTo(sx + i, Y(0)); g.lineTo(sx + i + sh, Y(0) + sh); g.stroke(); }
|
||||||
|
g.restore();
|
||||||
|
g.fillStyle = "#8a95a3"; g.font = "600 11px system-ui"; g.textAlign = "center"; g.fillText(t("STAGE"), sx + sw / 2, Y(0) + Math.min(sh - 6, 16)); g.textAlign = "start";
|
||||||
|
}
|
||||||
|
// delay / fill targets
|
||||||
|
for (const s of p.speakers.filter(s => s.role === "delay" || s.role === "fill")) {
|
||||||
|
g.strokeStyle = SF_ROLE_COLOR[s.role] + "99"; g.setLineDash([4, 4]); g.lineWidth = 1.2;
|
||||||
|
g.beginPath(); g.moveTo(X(s.x), Y(s.y)); g.lineTo(X(s.tx), Y(s.ty)); g.stroke(); g.setLineDash([]);
|
||||||
|
g.beginPath(); g.arc(X(s.tx), Y(s.ty), 6, 0, 2 * Math.PI); g.stroke();
|
||||||
|
}
|
||||||
|
// speakers (names step aside when boxes stand close together)
|
||||||
|
const labels = [];
|
||||||
|
const order = [...p.speakers].sort((a, b) => (b.role === "sub") - (a.role === "sub")); // tops drawn on top of subs
|
||||||
|
if (sf.snap) { // a top dragged over a free sub: show where it would land
|
||||||
|
const u = p.speakers.find(x => x.id === sf.snap);
|
||||||
|
if (u) { g.strokeStyle = "#fff"; g.setLineDash([3, 3]); g.lineWidth = 1.5; g.beginPath(); g.arc(X(u.x), Y(u.y), 18, 0, 2 * Math.PI); g.stroke(); g.setLineDash([]); }
|
||||||
|
}
|
||||||
|
for (const s of order) {
|
||||||
|
const col = SF_ROLE_COLOR[s.role], sel = s.id === sf.sel || (s.role === "sub" && sfTopOf(p, s)?.id === sf.sel), x = X(s.x), y = Y(s.y);
|
||||||
|
const top = s.role === "sub" && sfTopOf(p, s), onSub = sfOnSub(p, s);
|
||||||
|
if (s.cov < 360) { // coverage wedge
|
||||||
|
const r = Math.max(40, 3 * sc), a0 = Math.PI / 2 - (s.aim + s.cov / 2) * Math.PI / 180, a1 = Math.PI / 2 - (s.aim - s.cov / 2) * Math.PI / 180;
|
||||||
|
g.beginPath(); g.moveTo(x, y); g.arc(x, y, r, a0, a1); g.closePath();
|
||||||
|
g.fillStyle = col + (sel ? "33" : "1f"); g.fill(); g.strokeStyle = col + (sel ? "aa" : "55"); g.lineWidth = 1; g.stroke();
|
||||||
|
}
|
||||||
|
g.fillStyle = col; g.strokeStyle = sel ? "#fff" : "#0b0c0f"; g.lineWidth = sel ? 2.5 : 1.5;
|
||||||
|
g.beginPath();
|
||||||
|
if (s.role === "sub") { const r = top ? 12 : 9; g.rect(x - r, y - r, 2 * r, 2 * r); }
|
||||||
|
else { const [dx, dy] = sfDir(s); g.moveTo(x + dx * 11, y + dy * 11); g.lineTo(x - dy * 9 - dx * 7, y + dx * 9 - dy * 7); g.lineTo(x + dy * 9 - dx * 7, y - dx * 9 - dy * 7); g.closePath(); }
|
||||||
|
g.fill(); g.stroke();
|
||||||
|
if (onSub) { g.fillStyle = "#0b0c0f"; g.beginPath(); g.arc(x, y, 2.5, 0, 2 * Math.PI); g.fill(); } // the pole
|
||||||
|
if (top) continue; // the stack is labelled by its top
|
||||||
|
const label = onSub ? `${s.name} + ${onSub.name}` : s.name;
|
||||||
|
g.fillStyle = "#e8edf3"; g.font = (sel ? "600 " : "") + "11px system-ui"; g.textAlign = "center";
|
||||||
|
const lw = g.measureText(label).width + 6;
|
||||||
|
let ly = y + 24;
|
||||||
|
for (let k = 0; k < 4 && labels.some(b => Math.abs(b.x - x) < (b.w + lw) / 2 && Math.abs(b.y - ly) < 13); k++) ly = k % 2 ? y + 24 + 13 * (k + 1) / 2 : y - 16 - 13 * k / 2;
|
||||||
|
labels.push({ x, y: ly, w: lw });
|
||||||
|
g.fillText(label, x, ly); g.textAlign = "start";
|
||||||
|
if (sel && s.cov < 360) { // rotation handle
|
||||||
|
const [dx, dy] = sfDir(s), hr = Math.max(34, 1.6 * sc);
|
||||||
|
g.strokeStyle = "#ffffffaa"; g.lineWidth = 1.5; g.beginPath(); g.moveTo(x, y); g.lineTo(x + dx * hr, y + dy * hr); g.stroke();
|
||||||
|
g.fillStyle = "#fff"; g.beginPath(); g.arc(x + dx * hr, y + dy * hr, 6, 0, 2 * Math.PI); g.fill();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// reference position
|
||||||
|
const rx = X(p.ref.x), ry = Y(p.ref.y);
|
||||||
|
g.strokeStyle = "#e8edf3"; g.lineWidth = 2;
|
||||||
|
g.beginPath(); g.moveTo(rx - 10, ry); g.lineTo(rx + 10, ry); g.moveTo(rx, ry - 10); g.lineTo(rx, ry + 10); g.stroke();
|
||||||
|
g.beginPath(); g.arc(rx, ry, 6, 0, 2 * Math.PI); g.stroke();
|
||||||
|
g.fillStyle = "#e8edf3"; g.font = "600 10px system-ui"; g.fillText(t("REF"), rx + 9, ry - 8);
|
||||||
|
sfLegend();
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfLegend() {
|
||||||
|
const el = sf.panels.legend;
|
||||||
|
if (!el) return;
|
||||||
|
const mode = sfMode(), st = sf.stats;
|
||||||
|
const sw = (c, label) => h("span", { class: "sw" }, h("i", { style: `background:rgb(${c.join(",")})` }), label);
|
||||||
|
if (mode === "off") return el.replaceChildren();
|
||||||
|
if (mode === "time") return el.replaceChildren(sw([217, 70, 239], t("delay too early")), sw(TIME_STOPS[0][1], "0–10 ms"),
|
||||||
|
sw(TIME_STOPS[2][1], "20 ms"), sw(TIME_STOPS[4][1], t(">30 ms echo")));
|
||||||
|
el.replaceChildren(...[[6, LEVEL_STOPS[1][1]], [0, LEVEL_STOPS[2][1]], [-3, LEVEL_STOPS[3][1]], [-6, LEVEL_STOPS[4][1]], [-9, LEVEL_STOPS[5][1]], [-12, LEVEL_STOPS[6][1]]]
|
||||||
|
.map(([db, c]) => sw(c, db ? `${db > 0 ? "+" : ""}${db} dB` : t("median"))),
|
||||||
|
...(st ? [h("span", { class: "stat" }, mode === "sub" ? `${sfSubHz()} Hz · ` : "", t("audience: {spread} dB spread · {pct} % within ±3 dB",
|
||||||
|
{ spread: st.spread.toFixed(1), pct: Math.round(st.within3 * 100) }))] : []));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ interaction
|
||||||
|
|
||||||
|
function sfHit(px, py) {
|
||||||
|
const p = sfPlan(), { X, Y, sc } = sf.geo;
|
||||||
|
const sel = p.speakers.find(s => s.id === sf.sel);
|
||||||
|
if (sel && sel.cov < 360) {
|
||||||
|
const [dx, dy] = sfDir(sel), hr = Math.max(34, 1.6 * sc);
|
||||||
|
if (Math.hypot(px - (X(sel.x) + dx * hr), py - (Y(sel.y) + dy * hr)) < 12) return { kind: "rot", s: sel };
|
||||||
|
}
|
||||||
|
const near = p.speakers.filter(s => Math.hypot(px - X(s.x), py - Y(s.y)) < 15);
|
||||||
|
const hit = near.find(s => s.role !== "sub") || near[near.length - 1]; // a stack is grabbed by its top
|
||||||
|
if (hit) return { kind: "move", s: hit };
|
||||||
|
for (const s of p.speakers) if ((s.role === "delay" || s.role === "fill") && Math.hypot(px - X(s.tx), py - Y(s.ty)) < 10) return { kind: "target", s };
|
||||||
|
if (Math.hypot(px - X(p.ref.x), py - Y(p.ref.y)) < 14) return { kind: "ref" };
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfBindCanvas(cv) {
|
||||||
|
const pos = e => { const r = cv.getBoundingClientRect(); return [e.clientX - r.left, e.clientY - r.top]; };
|
||||||
|
const snap = v => Math.round(v * 10) / 10;
|
||||||
|
cv.addEventListener("pointerdown", e => {
|
||||||
|
if (!sf.geo) return;
|
||||||
|
const [px, py] = pos(e), hit = sfHit(px, py);
|
||||||
|
if (!hit) { if (sf.sel) { sf.sel = null; sfDraw(); sfPanels(); } return; }
|
||||||
|
e.preventDefault();
|
||||||
|
if (hit.s && sf.sel !== hit.s.id) { sf.sel = hit.s.id; sfPanels(); }
|
||||||
|
sf.drag = { ...hit, id: e.pointerId, moved: false };
|
||||||
|
cv.setPointerCapture(e.pointerId);
|
||||||
|
beginBusy();
|
||||||
|
sfDraw();
|
||||||
|
});
|
||||||
|
cv.addEventListener("pointermove", e => {
|
||||||
|
const [px, py] = pos(e);
|
||||||
|
if (!sf.drag) { sfHover(px, py); return; }
|
||||||
|
if (e.pointerId !== sf.drag.id) return;
|
||||||
|
const p = sfPlan(), [mx, my] = sf.geo.toM(px, py), x = clamp(snap(mx), 0, p.room.w), y = clamp(snap(my), 0, p.room.d);
|
||||||
|
const d = sf.drag;
|
||||||
|
if (d.kind === "move") {
|
||||||
|
if (d.s.mount && !sfOnSub(p, d.s)) d.s.mount = "";
|
||||||
|
sfMoveTo(p, d.s, x, y);
|
||||||
|
const u = !d.s.mount && sfSnapSub(p, d.s, x, y);
|
||||||
|
sf.snap = u ? u.id : null;
|
||||||
|
}
|
||||||
|
else if (d.kind === "rot") { let a = Math.atan2(mx - d.s.x, my - d.s.y) * 180 / Math.PI; if (!e.shiftKey) a = Math.round(a); else a = Math.round(a / 15) * 15; d.s.aim = a; }
|
||||||
|
else if (d.kind === "target") { d.s.tx = x; d.s.ty = y; }
|
||||||
|
else if (d.kind === "ref") { p.ref.x = x; p.ref.y = y; }
|
||||||
|
d.moved = true;
|
||||||
|
sfDraw(); sfHover(px, py);
|
||||||
|
});
|
||||||
|
const end = e => {
|
||||||
|
if (!sf.drag || e.pointerId !== sf.drag.id) return;
|
||||||
|
const moved = sf.drag.moved, d = sf.drag;
|
||||||
|
sf.drag = null;
|
||||||
|
if (sf.snap && d.kind === "move") { // dropped onto a free sub: put it on the pole
|
||||||
|
const p = sfPlan(), u = p.speakers.find(x => x.id === sf.snap);
|
||||||
|
if (u) { sfMount(p, d.s, u); toast(t("{top} now stands on {sub} (distance pole)", { top: d.s.name, sub: u.name })); }
|
||||||
|
}
|
||||||
|
sf.snap = null;
|
||||||
|
endBusy();
|
||||||
|
if (moved) { sfSave(); sfDraw(); sfPanels(); }
|
||||||
|
};
|
||||||
|
cv.addEventListener("pointerup", end);
|
||||||
|
cv.addEventListener("pointercancel", end);
|
||||||
|
cv.addEventListener("pointerleave", () => { if (!sf.drag && sf.panels.readout) sf.panels.readout.textContent = ""; });
|
||||||
|
cv.addEventListener("keydown", e => {
|
||||||
|
if ((e.key === "Delete" || e.key === "Backspace") && sf.sel) { e.preventDefault(); sfRemove(sf.sel); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfHover(px, py) {
|
||||||
|
const el = sf.panels.readout;
|
||||||
|
if (!el || !sf.geo) return;
|
||||||
|
const p = sfPlan(), [x, y] = sf.geo.toM(px, py);
|
||||||
|
if (x < 0 || y < 0 || x > p.room.w || y > p.room.d) { el.textContent = ""; return; }
|
||||||
|
let txt = `x ${x.toFixed(1)} m · y ${y.toFixed(1)} m`;
|
||||||
|
const f = sf.field;
|
||||||
|
if (f) {
|
||||||
|
const c = Math.floor(x / f.step), r = Math.floor(y / f.step), v = f.vals[r * f.cols + c];
|
||||||
|
if (!isNaN(v)) txt += sfMode() === "time" ? ` · ${v >= 0 ? "+" : ""}${v.toFixed(1)} ms` : ` · ${v.toFixed(1)} dB (${(v - sf.fieldRef).toFixed(1)})`;
|
||||||
|
}
|
||||||
|
const mains = p.speakers.filter(s => s.role === "main");
|
||||||
|
if (mains.length) txt += " · " + t("{m} m to the nearest main", { m: Math.min(...mains.map(s => Math.hypot(x - s.x, y - s.y))).toFixed(1) });
|
||||||
|
el.textContent = txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfChange(fn, full = true) { // change the plan from a panel
|
||||||
|
fn(sfPlan());
|
||||||
|
sfSave();
|
||||||
|
sfDraw();
|
||||||
|
if (full) sfPanels();
|
||||||
|
}
|
||||||
|
function sfRemove(id) {
|
||||||
|
sfChange(p => { p.speakers = p.speakers.filter(s => s.id !== id); p.speakers.forEach(s => { if (s.mount === id) s.mount = ""; }); });
|
||||||
|
if (sf.sel === id) { sf.sel = null; sfPanels(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ panels
|
||||||
|
|
||||||
|
const sfNum = (value, step, onset, attrs = {}) => {
|
||||||
|
const el = h("input", { type: "number", value: +(+value).toFixed(2), step, ...attrs });
|
||||||
|
el.addEventListener("change", () => { const v = parseFloat(el.value); if (!isNaN(v)) onset(v); });
|
||||||
|
return el;
|
||||||
|
};
|
||||||
|
|
||||||
|
function sfOutputs() { // every DSP output known from the device list (also offline ones)
|
||||||
|
return S.order.map(id => S.devices[id]).filter(d => !d.demo || S.demo.enabled).map(d => {
|
||||||
|
const n = d.n_out || (MODEL_CH[d.model] || [0, 0])[1];
|
||||||
|
return { d, outs: Array.from({ length: n }, (_, o) => o) };
|
||||||
|
}).filter(x => x.outs.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfEditor() {
|
||||||
|
const p = sfPlan(), s = p.speakers.find(x => x.id === sf.sel);
|
||||||
|
if (!s) return h("div", { class: "card sfedit" }, h("h3", {}, t("Speaker")),
|
||||||
|
h("p", { class: "info" }, t("Select a speaker in the plan, or add one above. Drag to move, use the white handle to aim, drag the reference cross to your listening / mixing position.")));
|
||||||
|
const up = (k, conv = v => v) => v => sfChange(() => { s[k] = conv(v); });
|
||||||
|
const typeSel = h("select", { onchange: () => sfChange(() => { const d = SF_TYPES[typeSel.value]; s.type = typeSel.value; Object.assign(s, d.role ? { role: d.role, cov: d.cov, spl: d.spl, h: d.h } : {}); }) },
|
||||||
|
Object.keys(SF_TYPES).map(k => h("option", { value: k, selected: s.type === k }, sfTypeLabel(k))));
|
||||||
|
const roleSel = h("select", { onchange: () => sfChange(() => { s.role = roleSel.value; if ((s.role === "delay" || s.role === "fill") && s.tx === s.x && s.ty === s.y) s.ty = Math.min(p.room.d, s.y + 6); }) },
|
||||||
|
["main", "sub", "delay", "fill"].map(r => h("option", { value: r, selected: s.role === r }, sfRoleLabel(r))));
|
||||||
|
const name = h("input", { type: "text", value: s.name, maxlength: 24 });
|
||||||
|
name.addEventListener("change", () => sfChange(() => { s.name = name.value.trim() || s.name; }));
|
||||||
|
const outs = sfOutputs().map(({ d, outs }) => h("div", { class: "sfouts" }, h("small", {}, d.name),
|
||||||
|
h("div", { class: "chips" }, outs.map(o => {
|
||||||
|
const key = `${d.id}:${o}`, on = s.outs.includes(key);
|
||||||
|
return h("button", { class: "chip" + (on ? " on" : ""), "aria-pressed": String(on),
|
||||||
|
onclick: () => sfChange(() => { s.outs = s.outs.includes(key) ? s.outs.filter(x => x !== key) : [...s.outs, key]; }) }, `Out ${o + 1}`);
|
||||||
|
}))));
|
||||||
|
const base = sfOnSub(p, s), topOn = s.role === "sub" && sfTopOf(p, s);
|
||||||
|
let stand = null;
|
||||||
|
if (s.role !== "sub") { // top: free, or on the pole of a sub
|
||||||
|
const subs = p.speakers.filter(u => u.role === "sub" && (!sfTopOf(p, u) || u.id === s.mount));
|
||||||
|
const standSel = h("select", { onchange: () => sfChange(q => {
|
||||||
|
const u = q.speakers.find(x => x.id === standSel.value);
|
||||||
|
if (u) sfMount(q, s, u); else { s.mount = ""; sfMoveTo(q, s, clamp(s.x + 1, 0, q.room.w), s.y); }
|
||||||
|
}) }, h("option", { value: "" }, t("Own stand / flown")),
|
||||||
|
subs.map(u => h("option", { value: u.id, selected: s.mount === u.id }, t("On a pole on {sub}", { sub: u.name }))));
|
||||||
|
stand = h("div", { class: "row sfstand" }, h("label", { class: "grow" }, t("Stand"), standSel),
|
||||||
|
base ? h("button", { class: "small", onclick: () => { sf.sel = base.id; sfRefresh(); } }, t("Edit {name}", { name: base.name })) : null);
|
||||||
|
} else if (topOn) {
|
||||||
|
stand = h("div", { class: "row sfstand" }, h("span", { class: "grow info" }, t("{top} stands on this sub (distance pole).", { top: topOn.name })),
|
||||||
|
h("button", { class: "small", onclick: () => { sf.sel = topOn.id; sfRefresh(); } }, t("Edit {name}", { name: topOn.name })),
|
||||||
|
h("button", { class: "small", onclick: () => sfChange(q => { topOn.mount = ""; sfMoveTo(q, topOn, clamp(topOn.x + 1, 0, q.room.w), topOn.y); }) }, t("Detach")));
|
||||||
|
}
|
||||||
|
return h("div", { class: "card sfedit", style: `--rc:${SF_ROLE_COLOR[s.role]}` },
|
||||||
|
h("h3", {}, h("span", { class: "dotc" }), h("span", { class: "grow" }, s.name),
|
||||||
|
h("button", { class: "small danger", onclick: () => sfRemove(s.id) }, t("Remove"))),
|
||||||
|
h("div", { class: "sfgrid" },
|
||||||
|
h("label", { class: "full" }, "Name", name),
|
||||||
|
h("label", {}, t("Type"), typeSel), h("label", {}, t("Role"), roleSel),
|
||||||
|
h("label", {}, "x (m)", sfNum(s.x, 0.1, v => sfChange(q => sfMoveTo(q, s, clamp(v, 0, q.room.w), s.y)))),
|
||||||
|
h("label", {}, "y (m)", sfNum(s.y, 0.1, v => sfChange(q => sfMoveTo(q, s, s.x, clamp(v, 0, q.room.d))))),
|
||||||
|
h("label", {}, base ? t("Height on the pole (m)") : t("Height (m)"), sfNum(s.h, 0.1, up("h", v => clamp(v, 0, 30)))),
|
||||||
|
h("label", {}, t("Aim (°)"), sfNum(s.aim, 1, up("aim", v => ((v + 540) % 360) - 180))),
|
||||||
|
h("label", {}, t("Coverage (°)"), sfNum(s.cov, 5, up("cov", v => clamp(v, 20, 360)))),
|
||||||
|
h("label", {}, t("Max SPL @1 m (dB)"), sfNum(s.spl, 1, up("spl", v => clamp(v, 80, 160))))),
|
||||||
|
stand,
|
||||||
|
s.role === "delay" || s.role === "fill" ? h("p", { class: "info" }, t("Its delay is aligned at the dashed target point (drag it to the middle of the area this speaker covers).")) : null,
|
||||||
|
h("div", { class: "sub" }, t("DSP outputs")), outs.length ? outs : h("p", { class: "info" }, t("No DSP in the device list yet.")));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfRoomCard() {
|
||||||
|
const p = sfPlan();
|
||||||
|
const set = (fn) => v => sfChange(q => {
|
||||||
|
fn(q, v);
|
||||||
|
for (const s of q.speakers) { s.x = clamp(s.x, 0, q.room.w); s.y = clamp(s.y, 0, q.room.d); s.tx = clamp(s.tx, 0, q.room.w); s.ty = clamp(s.ty, 0, q.room.d); }
|
||||||
|
for (const s of q.speakers) { const u = sfOnSub(q, s); if (u) { s.x = u.x; s.y = u.y; } }
|
||||||
|
q.ref.x = clamp(q.ref.x, 0, q.room.w); q.ref.y = clamp(q.ref.y, 0, q.room.d);
|
||||||
|
});
|
||||||
|
return h("div", { class: "card" }, h("h3", {}, t("Room")),
|
||||||
|
h("div", { class: "sfgrid" },
|
||||||
|
h("label", {}, t("Width (m)"), sfNum(p.room.w, 0.5, set((q, v) => { q.room.w = clamp(v, 4, 200); }))),
|
||||||
|
h("label", {}, t("Depth (m)"), sfNum(p.room.d, 0.5, set((q, v) => { q.room.d = clamp(v, 4, 300); }))),
|
||||||
|
h("label", {}, t("Stage width (m)"), sfNum(p.stage.w, 0.5, set((q, v) => { q.stage.w = clamp(v, 0, q.room.w); }))),
|
||||||
|
h("label", {}, t("Stage depth (m)"), sfNum(p.stage.d, 0.5, set((q, v) => { q.stage.d = clamp(v, 0, q.room.d / 2); }))),
|
||||||
|
h("label", {}, t("Temperature (°C)"), sfNum(p.temp, 1, set((q, v) => { q.temp = clamp(v, -10, 45); }))),
|
||||||
|
h("label", {}, t("Ear height (m)"), sfNum(p.ear, 0.1, set((q, v) => { q.ear = clamp(v, 0.5, 3); })))),
|
||||||
|
h("p", { class: "info" }, t("Speed of sound at {t} °C: {c} m/s.", { t: p.temp, c: sfSpeed(p).toFixed(1) })));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfSuggestCard() {
|
||||||
|
const items = sfSuggestions(sfPlan());
|
||||||
|
return h("div", { class: "card sfsug" }, h("h3", {}, t("Suggestions")),
|
||||||
|
items.length ? items.map(it => h("div", { class: "sfitem " + it.kind },
|
||||||
|
h("span", { class: "grow" }, it.text),
|
||||||
|
it.apply ? h("button", { class: "small on", onclick: () => sfChange(q => it.apply(q)) }, it.label) : null))
|
||||||
|
: h("p", { class: "info" }, t("Nothing to improve with the current layout.")));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfDelayCard() {
|
||||||
|
const p = sfPlan(), { ms, info } = sfDelays(p);
|
||||||
|
const rows = p.speakers.filter(s => ms[s.id] != null);
|
||||||
|
const cur = s => s.outs.map(k => {
|
||||||
|
const [id, o] = k.split(":"), d = S.devices[id];
|
||||||
|
return d && d.status === "online" && d.state ? d.state.outputs[+o]?.delay / 96 : null;
|
||||||
|
});
|
||||||
|
const apply = async list => {
|
||||||
|
let n = 0, skipped = 0;
|
||||||
|
for (const s of list) for (const k of s.outs) {
|
||||||
|
const [id, o] = k.split(":"), d = S.devices[id];
|
||||||
|
if (!d || d.status !== "online" || !d.state) { skipped++; continue; }
|
||||||
|
try { await api("POST", `/api/devices/${id}/set`, { kind: "out", idx: +o, param: "delay", value: clamp(Math.round(ms[s.id] * 96), 0, 65280) }); n++; }
|
||||||
|
catch (e) { toast(t("Error: ") + trMsg(e.message)); return; }
|
||||||
|
}
|
||||||
|
toast(t("{n} output delay(s) set", { n }) + (skipped ? " · " + t("{n} output(s) not connected", { n: skipped }) : ""));
|
||||||
|
};
|
||||||
|
const withOuts = rows.filter(s => s.outs.length);
|
||||||
|
return h("div", { class: "card sfdelays" },
|
||||||
|
h("h3", {}, h("span", { class: "grow" }, t("Delays")),
|
||||||
|
withOuts.length ? h("button", { class: "small on", onclick: () => apply(withOuts) }, t("Apply all")) : null),
|
||||||
|
rows.length ? h("table", { class: "sftable" },
|
||||||
|
h("tr", {}, h("th", {}, t("Speaker")), h("th", {}, t("Distance")), h("th", {}, t("Delay")), h("th", {}, t("Now on DSP")), h("th", {}, "")),
|
||||||
|
rows.map(s => {
|
||||||
|
const pt = info[s.id] === "target" ? [s.tx, s.ty] : [p.ref.x, p.ref.y], now = cur(s).filter(v => v != null);
|
||||||
|
return h("tr", {},
|
||||||
|
h("td", {}, h("span", { class: "dotc", style: `--rc:${SF_ROLE_COLOR[s.role]}` }), s.name,
|
||||||
|
h("small", {}, s.outs.length ? s.outs.map(k => { const [id, o] = k.split(":"); return `${S.devices[id]?.name || id} Out ${+o + 1}`; }).join(", ") : t("no output"))),
|
||||||
|
h("td", {}, `${sfR(p, s, pt[0], pt[1]).toFixed(1)} m`),
|
||||||
|
h("td", { class: "num" }, `${ms[s.id].toFixed(2)} ms`),
|
||||||
|
h("td", { class: "num" }, now.length ? now.map(v => v.toFixed(2)).join(" / ") + " ms" : "—"),
|
||||||
|
h("td", {}, s.outs.length ? h("button", { class: "small", onclick: () => apply([s]) }, t("Apply")) : null));
|
||||||
|
})) : h("p", { class: "info" }, t("Add speakers to calculate delays.")),
|
||||||
|
h("p", { class: "info" }, t("Mains and subs are aligned at the reference position, delay and fill speakers at their target point plus {ms} ms so the mains are heard first.", { ms: p.precedence }),
|
||||||
|
" ", h("label", { class: "inline" }, t("Offset (ms)"), sfNum(p.precedence, 0.5, v => sfChange(q => { q.precedence = clamp(v, 0, 30); }), { class: "short" }))));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sfPanels() { // rebuild everything except the canvas
|
||||||
|
const box = sf.panels.side;
|
||||||
|
if (!box || !box.isConnected) return;
|
||||||
|
box.replaceChildren(sfEditor(), sfSuggestCard(), sfDelayCard(), sfRoomCard());
|
||||||
|
sfLegend();
|
||||||
|
}
|
||||||
|
function sfRefresh() { sfDraw(); sfPanels(); }
|
||||||
|
|
||||||
|
function viewSoundField() {
|
||||||
|
const p = sfPlan();
|
||||||
|
if (sf.sel && !p.speakers.some(s => s.id === sf.sel)) sf.sel = null;
|
||||||
|
const cv = h("canvas", { class: "sfcanvas", tabindex: "0", "aria-label": t("Room plan") });
|
||||||
|
sf.canvas = cv;
|
||||||
|
sfBindCanvas(cv);
|
||||||
|
const addBtn = (type, role, label) => h("button", { class: "small", onclick: () => sfChange(q => {
|
||||||
|
const n = q.speakers.filter(s => s.role === role).length + 1;
|
||||||
|
const y = role === "delay" ? q.room.d * 0.55 : role === "fill" ? Math.max(0.3, q.stage.d - 0.2) : role === "sub" ? Math.min(q.room.d, q.stage.d + 0.6) : Math.max(0.5, q.stage.d - 0.3);
|
||||||
|
const s = sfNew(q, type, q.room.w / 2 + (n - 1) * 1.5, y, `${label} ${n}`);
|
||||||
|
s.role = role;
|
||||||
|
if (role === "delay") s.h = 3;
|
||||||
|
q.speakers.push(s); sf.sel = s.id;
|
||||||
|
}) }, "+ " + label);
|
||||||
|
const modeSeg = h("div", { class: "seg small" });
|
||||||
|
const hzSel = h("select", { class: "short", "aria-label": t("Sub frequency"), onchange: () => { store.set("dsp.sfhz", hzSel.value); sfDraw(); } },
|
||||||
|
SF_SUB_HZ.map(f => h("option", { value: f, selected: f === sfSubHz() }, `${f} Hz`)));
|
||||||
|
const setMode = m => {
|
||||||
|
store.set("dsp.sfmap", m);
|
||||||
|
modeSeg.replaceChildren(...[["level", t("Level")], ["sub", "Sub"], ["time", t("Timing")], ["off", t("Off")]].map(([k, label]) =>
|
||||||
|
h("button", { class: sfMode() === k ? "on" : "", onclick: () => { setMode(k); sfDraw(); } }, label)));
|
||||||
|
hzSel.hidden = m !== "sub";
|
||||||
|
};
|
||||||
|
setMode(sfMode());
|
||||||
|
sf.panels.legend = h("div", { class: "sflegend" });
|
||||||
|
sf.panels.readout = h("div", { class: "sfreadout" });
|
||||||
|
sf.panels.side = h("div", { class: "sfside" });
|
||||||
|
requestAnimationFrame(() => { sfDraw(); sfPanels(); });
|
||||||
|
new ResizeObserver(() => { if (!sf.drag) sfDraw(); }).observe(cv);
|
||||||
|
return h("div", { class: "sflayout" },
|
||||||
|
h("div", { class: "card sfmain" },
|
||||||
|
h("div", { class: "sfbar" },
|
||||||
|
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);
|
||||||
|
const sub = sfNew(q, "sub18", x, y, `Sub ${n}`), top = sfNew(q, "top12", x, y, `${t("Main")} ${q.speakers.filter(z => z.role === "main").length + 1}`);
|
||||||
|
sfMount(q, top, sub); q.speakers.push(sub, top); sf.sel = top.id;
|
||||||
|
}) }, "+ " + t("Stack")),
|
||||||
|
addBtn("top12", "delay", "Delay"), addBtn("fill8", "fill", "Fill")),
|
||||||
|
h("div", { class: "sfmode" }, modeSeg, hzSel)),
|
||||||
|
cv, h("div", { class: "sffoot" }, sf.panels.legend, sf.panels.readout),
|
||||||
|
h("p", { class: "info" }, t("A planning aid: free field without reflections, coverage from the nominal angle. Check the result by ear or measurement."))),
|
||||||
|
sf.panels.side);
|
||||||
|
}
|
||||||
@@ -67,7 +67,7 @@ label.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; co
|
|||||||
border-bottom: 1px solid var(--line);
|
border-bottom: 1px solid var(--line);
|
||||||
}
|
}
|
||||||
.brand { display: flex; flex: none; }
|
.brand { display: flex; flex: none; }
|
||||||
#devtabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
|
#devtabs { display: flex; gap: 6px; flex: 0 1 auto; min-width: 0; position: relative; }
|
||||||
#devtabs::-webkit-scrollbar { display: none; }
|
#devtabs::-webkit-scrollbar { display: none; }
|
||||||
.devtab { white-space: nowrap; flex: none; max-width: 220px; background: var(--panel); }
|
.devtab { white-space: nowrap; flex: none; max-width: 220px; background: var(--panel); }
|
||||||
.devtab .dn { overflow: hidden; text-overflow: ellipsis; }
|
.devtab .dn { overflow: hidden; text-overflow: ellipsis; }
|
||||||
@@ -79,7 +79,8 @@ label.inline { display: flex; align-items: center; gap: 8px; font-size: 13px; co
|
|||||||
.dot.error { background: var(--bad); }
|
.dot.error { background: var(--bad); }
|
||||||
@keyframes blink { 50% { opacity: .3; } }
|
@keyframes blink { 50% { opacity: .3; } }
|
||||||
|
|
||||||
#viewtabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 3px; flex: none; }
|
#viewtabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 3px; flex: none;
|
||||||
|
margin-left: auto; } /* logo + DSP choice on the left, menu and buttons on the right */
|
||||||
#viewtabs button { border: 0; background: none; min-height: 36px; padding: 6px 14px; color: var(--dim); border-radius: 8px; }
|
#viewtabs button { border: 0; background: none; min-height: 36px; padding: 6px 14px; color: var(--dim); border-radius: 8px; }
|
||||||
#viewtabs button svg { width: 18px; height: 18px; }
|
#viewtabs button svg { width: 18px; height: 18px; }
|
||||||
#viewtabs button svg .f { fill: currentColor; stroke: none; }
|
#viewtabs button svg .f { fill: currentColor; stroke: none; }
|
||||||
@@ -100,14 +101,17 @@ body[data-view=settings] #viewtabs button.active { background: none; color: var(
|
|||||||
/* phones: view switcher becomes a bottom navigation bar */
|
/* phones: view switcher becomes a bottom navigation bar */
|
||||||
@media (max-width: 759px) {
|
@media (max-width: 759px) {
|
||||||
:root { --bnav: calc(62px + env(safe-area-inset-bottom)); }
|
:root { --bnav: calc(62px + env(safe-area-inset-bottom)); }
|
||||||
.brand { display: none; }
|
.brand img, .brand svg { width: 24px; height: 24px; }
|
||||||
|
#btn-muteall { margin-left: auto; } /* the menu moved to the bottom bar: buttons stay on the right */
|
||||||
/* backdrop-filter would make the header the containing block of the fixed bottom bar */
|
/* backdrop-filter would make the header the containing block of the fixed bottom bar */
|
||||||
#top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
|
#top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
|
||||||
#viewtabs {
|
#viewtabs {
|
||||||
position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 0; border: 0; border-top: 1px solid var(--line);
|
position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 0; border: 0; border-top: 1px solid var(--line);
|
||||||
padding: 4px 6px env(safe-area-inset-bottom); background: rgba(16, 18, 22, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
|
padding: 4px 6px env(safe-area-inset-bottom); background: rgba(16, 18, 22, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
|
||||||
}
|
}
|
||||||
#viewtabs button { flex: 1; flex-direction: column; gap: 2px; font-size: 11px; min-height: 54px; padding: 4px; }
|
#viewtabs { overflow-x: auto; scrollbar-width: none; }
|
||||||
|
#viewtabs::-webkit-scrollbar { display: none; }
|
||||||
|
#viewtabs button { flex: 1 0 60px; flex-direction: column; gap: 2px; font-size: 11px; min-height: 54px; padding: 4px; }
|
||||||
#viewtabs button svg { width: 22px; height: 22px; }
|
#viewtabs button svg { width: 22px; height: 22px; }
|
||||||
#toast { bottom: calc(var(--bnav) + 12px) !important; }
|
#toast { bottom: calc(var(--bnav) + 12px) !important; }
|
||||||
}
|
}
|
||||||
@@ -117,7 +121,8 @@ body[data-view=settings] #viewtabs button.active { background: none; color: var(
|
|||||||
.card h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim);
|
.card h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim);
|
||||||
display: flex; align-items: center; gap: 8px; min-height: 22px; }
|
display: flex; align-items: center; gap: 8px; min-height: 22px; }
|
||||||
.grow { flex: 1; }
|
.grow { flex: 1; }
|
||||||
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; margin-bottom: 10px; }
|
html { scrollbar-gutter: stable; }
|
||||||
|
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: stretch; margin-bottom: 10px; }
|
||||||
.cards .wide { grid-column: 1 / -1; }
|
.cards .wide { grid-column: 1 / -1; }
|
||||||
h2.section { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 14px 2px 8px; }
|
h2.section { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 14px 2px 8px; }
|
||||||
.empty { color: var(--dim); text-align: center; padding: 60px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
|
.empty { color: var(--dim); text-align: center; padding: 60px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
|
||||||
@@ -188,7 +193,28 @@ input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius:
|
|||||||
.mixer { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
|
.mixer { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
|
||||||
.mgroup { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
|
.mgroup { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
|
||||||
.mgroup h4 { margin: 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 600; }
|
.mgroup h4 { margin: 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 600; }
|
||||||
.strips { display: flex; gap: 6px; }
|
/* strips sit in row 2 of a grid; row 1 holds the brackets of link groups (spanning their strips) */
|
||||||
|
.strips { display: grid; grid-template-columns: repeat(var(--n), 92px); grid-template-rows: 0 auto; gap: 0 6px; }
|
||||||
|
.mixer.hasbands .strips { grid-template-rows: 30px auto; }
|
||||||
|
.strips > .strip { grid-row: 2; }
|
||||||
|
.lkband { --lc: var(--warn); grid-row: 1; position: relative; align-self: end; height: 13px; margin: 0 14px 5px;
|
||||||
|
border: 2px solid var(--lc); border-bottom: 0; border-radius: 14px 14px 0 0;
|
||||||
|
filter: drop-shadow(0 0 5px color-mix(in srgb, var(--lc) 55%, transparent)); }
|
||||||
|
.lkband::before, .lkband::after { content: ""; position: absolute; bottom: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--lc); }
|
||||||
|
.lkband::before { left: -4px; } .lkband::after { right: -4px; }
|
||||||
|
.lkband.single { margin: 0 16px 5px; }
|
||||||
|
.lkband.single .lkname { max-width: calc(100% + 30px); padding: 1px 7px; }
|
||||||
|
.lkname { position: absolute; left: 50%; top: -1px; transform: translate(-50%, -50%); max-width: calc(100% - 20px);
|
||||||
|
display: flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; white-space: nowrap;
|
||||||
|
background: var(--bg); border: 1px solid color-mix(in srgb, var(--lc) 60%, transparent); color: var(--lc);
|
||||||
|
font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
|
||||||
|
.lkname b { overflow: hidden; text-overflow: ellipsis; font-weight: inherit; }
|
||||||
|
.lkname svg { flex: none; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
|
||||||
|
.lkname.anon { padding: 2px 6px; }
|
||||||
|
.lkgroup { display: flex; flex-direction: column; gap: 6px; padding-right: 8px; }
|
||||||
|
.lkgroup > .row { flex-wrap: nowrap; }
|
||||||
|
.lkgroup .lkmembers { min-width: 0; font-weight: 600; }
|
||||||
|
.lkgroup .lkname-in { width: 100%; height: 34px; padding: 4px 10px; font-size: 13px; }
|
||||||
.strip { --cc: var(--warn); flex: none; width: 92px; background: linear-gradient(var(--panel), var(--bg2)); border: 1px solid var(--line);
|
.strip { --cc: var(--warn); flex: none; width: 92px; background: linear-gradient(var(--panel), var(--bg2)); border: 1px solid var(--line);
|
||||||
border-radius: var(--radius); padding: 0 6px 8px; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
|
border-radius: var(--radius); padding: 0 6px 8px; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
|
||||||
scroll-snap-align: start; position: relative; overflow: hidden; }
|
scroll-snap-align: start; position: relative; overflow: hidden; }
|
||||||
@@ -206,8 +232,9 @@ input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius:
|
|||||||
button.mute.on { background: var(--mute); border-color: #f87171; color: #fff; box-shadow: 0 0 10px #dc262655; }
|
button.mute.on { background: var(--mute); border-color: #f87171; color: #fff; box-shadow: 0 0 10px #dc262655; }
|
||||||
.strip.muted { background: linear-gradient(#1f1517, var(--bg2)); }
|
.strip.muted { background: linear-gradient(#1f1517, var(--bg2)); }
|
||||||
@media (min-width: 1200px) {
|
@media (min-width: 1200px) {
|
||||||
.mgroup { flex-shrink: 1; flex-basis: 0; }
|
.mgroup { flex: 0 1 auto !important; }
|
||||||
.strip { flex: 1 1 92px; max-width: 128px; }
|
.strips { grid-template-columns: repeat(var(--n), minmax(92px, 128px)); }
|
||||||
|
.strip { width: auto; max-width: 128px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------- channel view */
|
/* ------------------------------------------------------------- channel view */
|
||||||
@@ -358,7 +385,9 @@ canvas.curve { width: 100%; height: clamp(200px, 32vw, 320px); display: block; b
|
|||||||
.lw small { font-size: 14px; font-weight: 500; color: var(--dim); }
|
.lw small { font-size: 14px; font-weight: 500; color: var(--dim); }
|
||||||
.lsub { font-size: 13px; color: var(--dim); margin-top: 2px; }
|
.lsub { font-size: 13px; color: var(--dim); margin-top: 2px; }
|
||||||
.lbar { position: relative; height: 8px; border-radius: 4px; background: var(--panel3); margin: 10px 0 4px; }
|
.lbar { position: relative; height: 8px; border-radius: 4px; background: var(--panel3); margin: 10px 0 4px; }
|
||||||
.lres.none .lbar { display: none; }
|
.lres.none .lbar, .lres.none .lw, .lres.none .lnotes { display: none; }
|
||||||
|
.lres.none { padding: 7px 10px; }
|
||||||
|
.lres.none .lsub { margin: 0; }
|
||||||
.lbar i { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); border-radius: 4px; background: var(--c); transition: width .15s; }
|
.lbar i { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); border-radius: 4px; background: var(--c); transition: width .15s; }
|
||||||
.lbar b, .lbar::after { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); left: calc(var(--a) * 100% - 1px); }
|
.lbar b, .lbar::after { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); left: calc(var(--a) * 100% - 1px); }
|
||||||
.lbar::after { content: ""; display: none; background: var(--warn); left: calc(var(--s) * 100% - 1px); }
|
.lbar::after { content: ""; display: none; background: var(--warn); left: calc(var(--s) * 100% - 1px); }
|
||||||
@@ -438,7 +467,609 @@ body.locked #statusbar :is(button, select):not([data-view-ok]) { cursor: not-all
|
|||||||
.limled { flex: none; display: block; width: 34px; height: 4px; margin-top: 3px; border-radius: 1px;
|
.limled { flex: none; display: block; width: 34px; height: 4px; margin-top: 3px; border-radius: 1px;
|
||||||
background: color-mix(in srgb, var(--led-o) 16%, transparent); transition: background .08s, box-shadow .08s; }
|
background: color-mix(in srgb, var(--led-o) 16%, transparent); transition: background .08s, box-shadow .08s; }
|
||||||
.limled.ph { visibility: hidden; }
|
.limled.ph { visibility: hidden; }
|
||||||
|
.limled.dot { width: 9px; height: 9px; margin: 0 8px 0 4px; border-radius: 50%; }
|
||||||
|
.limcard h3 > .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.limcard h3 .led.h { width: 96px; }
|
||||||
|
.limled.txt { width: auto; height: auto; margin: 1px 0 0; background: none; font-size: 9px; line-height: 11px; font-weight: 800; letter-spacing: .08em;
|
||||||
|
color: color-mix(in srgb, var(--led-o) 22%, transparent); transition: color .08s; }
|
||||||
|
.limled.txt.on { background: none; box-shadow: none; color: var(--led-o); text-shadow: 0 0 5px color-mix(in srgb, var(--led-o) 55%, transparent); }
|
||||||
.limled.on { background: var(--led-o); box-shadow: 0 0 6px var(--led-o), 0 0 2px var(--led-o); }
|
.limled.on { background: var(--led-o); box-shadow: 0 0 6px var(--led-o), 0 0 2px var(--led-o); }
|
||||||
.limled.h { width: auto; height: auto; margin: 0; padding: 2px 6px; font-size: 10px; font-weight: 700; letter-spacing: .06em;
|
.limled.h { width: auto; height: auto; margin: 0; padding: 2px 6px; font-size: 10px; font-weight: 700; letter-spacing: .06em;
|
||||||
color: color-mix(in srgb, var(--led-o) 45%, transparent); }
|
color: color-mix(in srgb, var(--led-o) 45%, transparent); }
|
||||||
.limled.h.on { color: #1a1000; }
|
.limled.h.on { color: #1a1000; }
|
||||||
|
|
||||||
|
/* ---- demo mode */
|
||||||
|
.demo-badge { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #1a1000 !important;
|
||||||
|
background: var(--warn) !important; border-radius: 5px; padding: 1px 6px; }
|
||||||
|
.devtab.demo { border-color: var(--warn); }
|
||||||
|
.devtab.paused, .card.paused { opacity: .45; }
|
||||||
|
.devtab.paused { cursor: not-allowed; }
|
||||||
|
.card.demo-on { border-color: var(--warn); }
|
||||||
|
|
||||||
|
/* ---- device lock (hardware) */
|
||||||
|
input.code { width: 7.5em; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace;
|
||||||
|
font-size: 20px; letter-spacing: .3em; text-transform: uppercase; }
|
||||||
|
.dialog input.code { display: block; margin: 8px auto 4px; }
|
||||||
|
.lockbox .row { align-items: center; gap: 8px; margin: 6px 0; }
|
||||||
|
.lockbox .sub { margin-top: 10px; }
|
||||||
|
.dot.locked { background: var(--warn); }
|
||||||
|
.dialog label.chk { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
|
||||||
|
.dialog label.chk input { width: 20px; height: 20px; }
|
||||||
|
.dialog .err { text-align: center; }
|
||||||
|
.lockbox input.code { flex: none; width: 7.5em; }
|
||||||
|
|
||||||
|
/* ---- audio test */
|
||||||
|
.test-badge { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #fff !important;
|
||||||
|
background: var(--bad) !important; border-radius: 5px; padding: 1px 6px; }
|
||||||
|
.testbanner { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font-weight: 600;
|
||||||
|
background: color-mix(in srgb, var(--bad) 18%, transparent); border: 1px solid var(--bad); }
|
||||||
|
.cards.testcards { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
.srcgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
|
||||||
|
.srcgrid .src { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; text-align: left;
|
||||||
|
text-transform: none; letter-spacing: 0; min-height: 58px; }
|
||||||
|
.srcgrid .src small { color: var(--dim); font-weight: 400; }
|
||||||
|
.srcgrid .src.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
|
||||||
|
.srcgrid .src.noise.on { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--panel)); }
|
||||||
|
.sinefreq { margin-top: 12px; align-items: center; gap: 10px; }
|
||||||
|
.sinefreq.dim { opacity: .5; }
|
||||||
|
.testfader.off .tf { opacity: .35; pointer-events: none; }
|
||||||
|
.testbody { display: flex; gap: 18px; align-items: flex-start; min-width: 0; }
|
||||||
|
.tf { display: flex; flex-direction: column; align-items: center; gap: 8px; }
|
||||||
|
.tf .fader { height: 300px; }
|
||||||
|
.testval { white-space: nowrap; width: 6.5em; text-align: center; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
|
||||||
|
.tf { flex: none; width: 6.5em; }
|
||||||
|
.tmeters { flex: 1; display: flex; gap: 6px; overflow-x: auto; min-width: 0; padding-bottom: 4px; }
|
||||||
|
.tmeter { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1 0 auto; max-width: 120px; }
|
||||||
|
.tmeter .led { height: 300px; }
|
||||||
|
.testfader h3 .info { margin-left: 8px; text-transform: none; letter-spacing: 0; font-weight: 400; }
|
||||||
|
.tmeter small { font-size: 11px; color: var(--dim); }
|
||||||
|
button.wide { width: 100%; margin-top: 14px; }
|
||||||
|
.tmeter button.mute { padding: 6px 8px; font-size: 11px; min-width: 52px; }
|
||||||
|
.tmeter.muted .led { opacity: .35; }
|
||||||
|
|
||||||
|
/* ---- curve: phase view, overlays, master bypass */
|
||||||
|
.seg.small button { padding: 5px 10px; font-size: 12px; min-height: 0; }
|
||||||
|
.card h3 .seg.small { margin-right: 8px; }
|
||||||
|
button.bypass.on { background: #991b1b; border-color: var(--bad); color: #fff; }
|
||||||
|
.card.eq-off .bands { opacity: .45; }
|
||||||
|
.chips.overlay { margin-top: 8px; align-items: center; gap: 6px; flex-wrap: wrap; }
|
||||||
|
.chips.overlay .sub { margin-right: 4px; }
|
||||||
|
button.chip.ov { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; font-size: 12px; text-transform: none; letter-spacing: 0; }
|
||||||
|
button.chip.ov i { width: 10px; height: 10px; border-radius: 3px; border: 2px solid var(--oc); }
|
||||||
|
button.chip.ov.on { border-color: var(--oc); background: color-mix(in srgb, var(--oc) 18%, var(--panel)); }
|
||||||
|
button.chip.ov.on i { background: var(--oc); }
|
||||||
|
.geq { position: relative; }
|
||||||
|
.geq.bypassed > * { opacity: .35; }
|
||||||
|
.geq.bypassed::after { content: "BYPASS"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
|
||||||
|
font: 700 34px system-ui; color: #ef444499; pointer-events: none; }
|
||||||
|
body.testlock #viewtabs button:disabled, body.testlock #btn-settings:disabled, body.testlock .devtab:disabled { opacity: .35; cursor: not-allowed; }
|
||||||
|
.testbanner small { display: block; font-weight: 400; margin-top: 2px; color: var(--dim); }
|
||||||
|
.pol { display: inline-block; margin-left: 4px; font-size: 13px; font-weight: 700; line-height: 14px; color: #e879f9; vertical-align: -1px; }
|
||||||
|
|
||||||
|
/* ---- global mute */
|
||||||
|
#btn-muteall svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
||||||
|
#btn-muteall.on { background: #991b1b; border-color: var(--bad); color: #fff; animation: mutepulse 1.6s ease-in-out infinite; }
|
||||||
|
@keyframes mutepulse { 50% { box-shadow: 0 0 14px #ef4444aa; } }
|
||||||
|
|
||||||
|
/* ---- copy dialog */
|
||||||
|
.copydlg .sub { margin: 12px 0 6px; }
|
||||||
|
.copygroups { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px 14px; }
|
||||||
|
.copygroups label.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; }
|
||||||
|
.copygroups label.chk input { width: 18px; height: 18px; }
|
||||||
|
.copydev .chips { margin-top: 0; }
|
||||||
|
button.chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--panel)); color: var(--text); }
|
||||||
|
|
||||||
|
/* ---- SoundField */
|
||||||
|
.sflayout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
|
||||||
|
@media (min-width: 1100px) { .sflayout { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); align-items: start; } }
|
||||||
|
.sfmain { padding-bottom: 10px; }
|
||||||
|
.sfbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
|
||||||
|
.sfbar h3 { margin: 0 auto 0 0; }
|
||||||
|
.sfadd { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||||
|
.sfmode { display: flex; gap: 6px; align-items: center; }
|
||||||
|
.sfmode select.short { width: auto; padding: 4px 8px; min-height: 0; font-size: 12px; }
|
||||||
|
.sfcanvas { display: block; width: 100%; height: 480px; touch-action: none; border-radius: 8px; outline: none; cursor: crosshair; }
|
||||||
|
.sffoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 8px; min-height: 18px; font-size: 12px; color: var(--dim); }
|
||||||
|
.sflegend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
|
||||||
|
.sflegend .sw { display: inline-flex; align-items: center; gap: 5px; }
|
||||||
|
.sflegend .sw i { width: 12px; height: 12px; border-radius: 3px; opacity: .85; }
|
||||||
|
.sflegend .stat { color: var(--text); }
|
||||||
|
.sfreadout { font-variant-numeric: tabular-nums; }
|
||||||
|
.sfside { display: grid; gap: 14px; }
|
||||||
|
.sfgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
|
||||||
|
.sfgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); }
|
||||||
|
.sfgrid label.full { grid-column: 1 / -1; }
|
||||||
|
.sfgrid input, .sfgrid select { width: 100%; min-width: 0; }
|
||||||
|
.sfedit .dotc, .sftable .dotc { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--rc); margin-right: 8px; flex: none; }
|
||||||
|
.sfedit h3 { display: flex; align-items: center; }
|
||||||
|
.sfedit .sub { margin: 12px 0 4px; }
|
||||||
|
.sfouts { margin-top: 6px; }
|
||||||
|
.sfouts small { color: var(--dim); }
|
||||||
|
.sfouts .chips { margin-top: 4px; }
|
||||||
|
.sfsug .sfitem { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; margin-top: 8px; font-size: 13px;
|
||||||
|
background: var(--panel2); border-left: 3px solid var(--accent); }
|
||||||
|
.sfsug .sfitem.warn { border-left-color: var(--warn); }
|
||||||
|
.sfsug .sfitem.ok { border-left-color: var(--ok); }
|
||||||
|
.sfsug .sfitem.info { border-left-color: var(--dim); }
|
||||||
|
.sfsug .sfitem button { flex: none; }
|
||||||
|
.sftable { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||||
|
.sftable th { text-align: left; font-weight: 600; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 4px 6px; }
|
||||||
|
.sftable td { padding: 6px; border-top: 1px solid var(--line); vertical-align: middle; }
|
||||||
|
.sftable td small { display: block; color: var(--dim); font-size: 11px; margin-left: 18px; }
|
||||||
|
.sftable td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||||
|
.sfdelays .info label.inline { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
|
||||||
|
.sfdelays .info input.short { width: 70px; }
|
||||||
|
|
||||||
|
/* ---- channel colours */
|
||||||
|
.strip.tinted .nm { color: color-mix(in srgb, var(--cc) 55%, #fff); }
|
||||||
|
.colorbox .colgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 6px; }
|
||||||
|
.colorbox .sub { margin: 4px 0; }
|
||||||
|
button.colrow { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 6px; padding: 6px 10px; min-height: 0;
|
||||||
|
text-transform: none; letter-spacing: 0; font-weight: 500; text-align: left; }
|
||||||
|
button.colrow small { display: block; color: var(--dim); font-size: 11px; font-weight: 400; }
|
||||||
|
.swatch { width: 18px; height: 18px; border-radius: 5px; flex: none; border: 1px solid #ffffff33; }
|
||||||
|
.swatch.none { background: repeating-linear-gradient(45deg, #ffffff22 0 3px, transparent 3px 6px); }
|
||||||
|
.coldlg .swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
|
||||||
|
button.swatch.big { width: 100%; height: 38px; padding: 0; min-height: 0; border-radius: 8px; border: 2px solid transparent; }
|
||||||
|
button.swatch.big.on { border-color: #fff; box-shadow: 0 0 0 2px #0b0c0f inset; }
|
||||||
|
button.swatch.big:disabled { opacity: .25; cursor: not-allowed;
|
||||||
|
background-image: linear-gradient(135deg, transparent 46%, #0b0c0f 46%, #0b0c0f 54%, transparent 54%) !important; }
|
||||||
|
.coldlg .custom { margin-top: 12px; align-items: center; }
|
||||||
|
.coldlg input[type=color] { width: 56px; height: 34px; padding: 2px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); }
|
||||||
|
.coldlg .custom input[type=color] { flex: none; width: 56px; }
|
||||||
|
.sfstand { align-items: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
|
||||||
|
.sfstand label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); }
|
||||||
|
|
||||||
|
/* ---- DSP drop-down */
|
||||||
|
.devpick { max-width: 320px; gap: 8px; }
|
||||||
|
.devpick .chev { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: -4px -4px -4px 2px;
|
||||||
|
border-radius: 6px; background: var(--panel3); color: var(--text); }
|
||||||
|
.devpick .chev svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
|
||||||
|
transition: transform .15s; }
|
||||||
|
.devpick .chev.open svg { transform: rotate(180deg); }
|
||||||
|
.devpick:hover .chev { background: var(--accent); color: #06121c; }
|
||||||
|
.devpick .minidots { display: inline-flex; gap: 3px; margin-left: 2px; padding-left: 8px; border-left: 1px solid var(--line); }
|
||||||
|
.devpick .minidots .dot { width: 6px; height: 6px; box-shadow: none; animation: none; }
|
||||||
|
.devmenu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 280px; max-width: min(420px, 92vw);
|
||||||
|
max-height: 60vh; overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
|
||||||
|
box-shadow: 0 12px 40px #000a; display: flex; flex-direction: column; gap: 4px; }
|
||||||
|
button.devitem { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: flex-start; text-transform: none; letter-spacing: 0;
|
||||||
|
font-weight: 500; background: transparent; border-color: transparent; padding: 9px 10px; }
|
||||||
|
button.devitem:hover:not(:disabled) { background: var(--panel2); }
|
||||||
|
button.devitem.on { background: var(--panel3); border-color: var(--accent); }
|
||||||
|
button.devitem .dn { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
button.devitem .where { font-size: 11px; color: var(--dim); }
|
||||||
|
button.devitem small { font-size: 11px; color: var(--dim); background: var(--panel3); border-radius: 5px; padding: 1px 5px; }
|
||||||
|
button.devitem.paused, button.devitem:disabled { opacity: .45; cursor: not-allowed; }
|
||||||
|
|
||||||
|
/* ---- custom logo */
|
||||||
|
.brand img { width: 26px; height: 26px; object-fit: contain; border-radius: 6px; display: block; }
|
||||||
|
.logorow { align-items: flex-start; gap: 14px; }
|
||||||
|
.logoprev { width: 72px; height: 72px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px;
|
||||||
|
background: repeating-conic-gradient(#ffffff10 0 25%, transparent 0 50%) 0 0 / 14px 14px, var(--panel2); border: 1px solid var(--line); }
|
||||||
|
.logoprev img, .logoprev svg { width: 56px; height: 56px; object-fit: contain; }
|
||||||
|
|
||||||
|
/* ---- menu as a sidebar when the top bar is too narrow (tablets, small windows) */
|
||||||
|
:root { --side: 92px; }
|
||||||
|
@media (min-width: 760px) {
|
||||||
|
body.navside #viewtabs { position: fixed; top: var(--hdr); left: 0; bottom: 0; width: var(--side); z-index: 15; margin: 0;
|
||||||
|
flex-direction: column; gap: 4px; padding: 8px 6px max(8px, env(safe-area-inset-bottom)); overflow-y: auto;
|
||||||
|
border: 0; border-right: 1px solid var(--line); border-radius: 0; background: var(--panel); }
|
||||||
|
body.navside #viewtabs button { flex-direction: column; gap: 4px; width: 100%; min-height: 60px; padding: 8px 4px; font-size: 11px;
|
||||||
|
line-height: 1.15; text-align: center; white-space: normal; }
|
||||||
|
body.navside #viewtabs button svg { width: 22px; height: 22px; }
|
||||||
|
body.navside #statusbar, body.navside #main { margin-left: var(--side); }
|
||||||
|
body.navside #main { max-width: none; }
|
||||||
|
body.navside #btn-muteall { margin-left: auto; }
|
||||||
|
/* backdrop-filter would make the header the containing block of the fixed sidebar */
|
||||||
|
body.navside #top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
|
||||||
|
}
|
||||||
|
/* phones: all menu items fit in the bottom bar, long labels are shortened */
|
||||||
|
@media (max-width: 759px) {
|
||||||
|
#viewtabs button { min-width: 0; font-size: 10px; letter-spacing: 0; }
|
||||||
|
#viewtabs button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
#viewtabs button:has(.short) > span:not(.short) { display: none; } /* long labels: short form in the bottom bar */
|
||||||
|
#viewtabs button span.short { display: inline; }
|
||||||
|
}
|
||||||
|
#viewtabs button .short { display: none; }
|
||||||
|
.logorow + .actions { margin-top: 12px; }
|
||||||
|
|
||||||
|
/* ---- settings page */
|
||||||
|
.setwrap { max-width: 1180px; margin: 0 auto; }
|
||||||
|
.setnav { position: sticky; top: var(--hdr); z-index: 9; display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 0 16px; margin-bottom: 2px;
|
||||||
|
background: linear-gradient(var(--bg) 75%, transparent); }
|
||||||
|
.setnav .chip { min-height: 32px; }
|
||||||
|
.setsec { margin: 6px 0 30px; scroll-margin-top: calc(var(--hdr) + 64px); }
|
||||||
|
.setsec > header { margin: 0 2px 12px; }
|
||||||
|
.setsec > header h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .01em; }
|
||||||
|
.setsec > header p { margin: 4px 0 0; color: var(--dim); font-size: 13px; max-width: 760px; }
|
||||||
|
.setgrid { display: grid; gap: 12px; align-items: stretch; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
|
||||||
|
.setgrid.wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
|
||||||
|
.setgrid > .card { display: flex; flex-direction: column; margin: 0; }
|
||||||
|
.setgrid > .card > h3 { margin-bottom: 8px; }
|
||||||
|
.setgrid > .card > p.info { margin: 0 0 12px; }
|
||||||
|
.setgrid > .card > :last-child { margin-top: auto; } /* buttons and switches line up at the bottom of each row */
|
||||||
|
.setgrid > .card > .actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; }
|
||||||
|
.setgrid > .card > .actions button { flex: 1 1 0; min-width: max-content; }
|
||||||
|
.setgrid > .card .devform { align-content: start; }
|
||||||
|
.setgrid .seg { width: 100%; }
|
||||||
|
.setgrid .seg button { min-height: 40px; }
|
||||||
|
.setgrid > .card .row { gap: 8px; }
|
||||||
|
.setgrid > .card > .row > button { flex: 1 1 auto; }
|
||||||
|
button.devadd { min-height: 180px; border: 2px dashed var(--line); background: transparent; flex-direction: column; justify-content: center;
|
||||||
|
align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; color: var(--dim); }
|
||||||
|
button.devadd:hover { border-color: var(--accent); color: var(--text); background: var(--panel); }
|
||||||
|
button.devadd .plus { font-size: 34px; line-height: 1; color: var(--accent); }
|
||||||
|
button.devadd b { font-size: 15px; color: var(--text); }
|
||||||
|
.setgrid > button.devadd > :last-child { margin-top: 0; }
|
||||||
|
/* narrow top bar: the DSP button shrinks (name gets shortened) instead of covering the buttons */
|
||||||
|
.devpick { min-width: 0; max-width: min(320px, 100%); }
|
||||||
|
.devpick .dn { min-width: 0; }
|
||||||
|
@media (max-width: 480px) { .devpick .minidots, .devpick small { display: none; } }
|
||||||
|
|
||||||
|
/* ---- link tab: channels already in a link */
|
||||||
|
.lkch.taken { cursor: not-allowed; opacity: .55; }
|
||||||
|
.lkch.taken:hover { background: inherit; }
|
||||||
|
/* ---- device ID, network search */
|
||||||
|
.idrow { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 13px; color: var(--text); }
|
||||||
|
.idrow input.short { width: 80px; }
|
||||||
|
button.devadd .plus svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
|
||||||
|
.scanres { display: flex; flex-direction: column; gap: 6px; min-width: min(460px, 80vw); max-height: 55vh; overflow-y: auto; }
|
||||||
|
.scanres .empty.small { padding: 24px 8px; }
|
||||||
|
.scanrow { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; background: var(--panel2); }
|
||||||
|
.scanrow small { display: block; color: var(--dim); font-size: 12px; }
|
||||||
|
|
||||||
|
/* ---- software max level: a striped "locked" zone in the track above the limit, behind the knob */
|
||||||
|
:root { --limgrey: repeating-linear-gradient(-45deg, #8a95a366 0 3px, #8a95a314 3px 6px); --limstripe: repeating-linear-gradient(-45deg, #ef444466 0 3px, #ef444414 3px 6px); }
|
||||||
|
/* --p = limit, --q = knob: between them (knob above the limit, set on the DSP) the stripes turn grey, above the knob red */
|
||||||
|
input[type=range].haslim { --p: calc(13px + var(--lim) * (100% - 26px)); --q: calc(13px + var(--val, var(--lim)) * (100% - 26px)); }
|
||||||
|
input[type=range].haslim::-webkit-slider-runnable-track {
|
||||||
|
background: linear-gradient(90deg, var(--line) 0 var(--p), #f87171 var(--p) calc(var(--p) + 2px), transparent calc(var(--p) + 2px)),
|
||||||
|
var(--limgrey) var(--p) 0 / calc(var(--q) - var(--p)) 100% no-repeat,
|
||||||
|
linear-gradient(var(--line), var(--line)) var(--p) 0 / calc(var(--q) - var(--p)) 100% no-repeat,
|
||||||
|
var(--limstripe) var(--line); }
|
||||||
|
input[type=range].haslim::-moz-range-track {
|
||||||
|
background: linear-gradient(90deg, var(--line) 0 var(--p), #f87171 var(--p) calc(var(--p) + 2px), transparent calc(var(--p) + 2px)),
|
||||||
|
var(--limgrey) var(--p) 0 / calc(var(--q) - var(--p)) 100% no-repeat,
|
||||||
|
linear-gradient(var(--line), var(--line)) var(--p) 0 / calc(var(--q) - var(--p)) 100% no-repeat,
|
||||||
|
var(--limstripe) var(--line); }
|
||||||
|
.fader .limzone { position: absolute; left: var(--tx); width: 10px; margin-left: -5px; top: 12px; border-radius: 5px 5px 2px 2px;
|
||||||
|
height: calc((1 - var(--f)) * (100% - 24px)); background: var(--limstripe); pointer-events: none; z-index: 0; }
|
||||||
|
.fader .limzone::after { content: ""; position: absolute; left: -6px; right: -6px; bottom: -1px; height: 2px; border-radius: 1px;
|
||||||
|
background: #f87171; box-shadow: 0 0 6px #ef444488; }
|
||||||
|
.limnote { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; }
|
||||||
|
.limnote svg, .overlim svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
|
||||||
|
.overlim { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 9px 10px; border-radius: 8px; font-size: 13px;
|
||||||
|
color: #fecaca; background: #ef44441f; border: 1px solid #ef444466; }
|
||||||
|
.overlim[hidden] { display: none; }
|
||||||
|
.mlrow { display: grid; grid-template-columns: 110px minmax(0, 1fr) 84px; align-items: center; gap: 10px; margin-top: 8px; }
|
||||||
|
.mllabel { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
|
||||||
|
.mlval { font-size: 12px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
|
||||||
|
.mlval.on { color: var(--bad); font-weight: 600; }
|
||||||
|
.mlwarn { grid-column: 2 / -1; color: var(--warn); font-size: 11px; margin-top: -4px; }
|
||||||
|
.fader .limbelow { position: absolute; left: var(--tx); width: 10px; margin-left: -5px; pointer-events: none; z-index: 0;
|
||||||
|
bottom: calc(12px + var(--f) * (100% - 24px)); height: calc(max(0, var(--v, 0) - var(--f)) * (100% - 24px));
|
||||||
|
background: var(--limgrey), #0b0d10; border-radius: 2px; }
|
||||||
|
/* ---- editing a link group */
|
||||||
|
.lkediting .lkgrid { outline: 1px dashed var(--accent); outline-offset: 6px; border-radius: 10px; }
|
||||||
|
.lkgroup.editing { background: color-mix(in srgb, var(--lc) 14%, var(--panel2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lc) 45%, transparent); }
|
||||||
|
.lkgroup.dim { opacity: .5; }
|
||||||
|
.lkactions button + button { margin-left: 6px; }
|
||||||
|
/* ---- note on beta models in the add-device form */
|
||||||
|
.betanote { margin: 0; padding: 8px 10px; border-radius: 8px; color: var(--text); background: #f59e0b1f; border: 1px solid #f59e0b66; }
|
||||||
|
.betanote[hidden] { display: none; }
|
||||||
|
/* ---- FIR tab */
|
||||||
|
#viewtabs button[hidden] { display: none; }
|
||||||
|
.firuse { font-size: 12px; font-weight: 600; color: var(--dim); text-transform: none; letter-spacing: 0; }
|
||||||
|
.firuse.over { color: #f87171; }
|
||||||
|
.firmeter { height: 6px; margin: 2px 0 12px; border-radius: 3px; background: var(--line); overflow: hidden; }
|
||||||
|
.firmeter span { display: block; height: 100%; background: var(--accent); }
|
||||||
|
.firchs { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||||
|
.firsep { width: 1px; margin: 0 4px; background: var(--line); }
|
||||||
|
.firch { flex-direction: column; gap: 0; min-width: 66px; min-height: 48px; padding: 4px 8px; }
|
||||||
|
.firch small { color: var(--dim); font-size: 11px; font-weight: 400; }
|
||||||
|
.firch.used small { color: var(--accent); }
|
||||||
|
.firch.on { background: var(--accent2); border-color: var(--accent); color: #fff; }
|
||||||
|
.firch.on small { color: #dbeafe; }
|
||||||
|
.firform { margin-bottom: 8px; }
|
||||||
|
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; 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; }
|
||||||
|
.dmod { position: relative; grid-column: span var(--w); grid-row: span var(--h); }
|
||||||
|
.dbody { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; scrollbar-width: thin; }
|
||||||
|
@media (max-width: 1100px) { .dmod { grid-column: span var(--wt); } }
|
||||||
|
/* phones: one column, as high as the content */
|
||||||
|
@media (max-width: 759px) {
|
||||||
|
.dash { grid-auto-rows: auto; }
|
||||||
|
.dmod { grid-column: span 12; grid-row: auto; }
|
||||||
|
.dhelp, .dgrab { display: none; }
|
||||||
|
.dm .led { flex: none !important; height: 130px !important; }
|
||||||
|
canvas.dcurve { flex: none !important; height: 170px !important; }
|
||||||
|
}
|
||||||
|
.dmod > h3 svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
||||||
|
.dtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
|
||||||
|
.ddev { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; }
|
||||||
|
.dctl { display: flex; gap: 3px; flex: none; }
|
||||||
|
.dctl button { min-height: 26px; min-width: 26px; padding: 0 6px; text-transform: none; letter-spacing: 0; }
|
||||||
|
.dash.editing .dmod > h3 { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
|
||||||
|
.dgrab { position: absolute; z-index: 2; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px;
|
||||||
|
font-size: 12px; line-height: 1; color: var(--text); background: var(--panel3); border: 1px solid var(--line2); touch-action: none; user-select: none; -webkit-user-select: none; }
|
||||||
|
.dgrab:hover { background: var(--accent2); border-color: var(--accent); color: #fff; }
|
||||||
|
.de { right: -7px; top: 50%; margin-top: -10px; cursor: ew-resize; }
|
||||||
|
.ds { bottom: -7px; left: 50%; margin-left: -10px; cursor: ns-resize; }
|
||||||
|
.dse { right: -7px; bottom: -7px; cursor: nwse-resize; }
|
||||||
|
body.dresizing { user-select: none; -webkit-user-select: none; }
|
||||||
|
.dresizing .dmod { transition: none; }
|
||||||
|
.dash.editing .dmod { border-style: dashed; border-color: var(--line2, #3a4250); }
|
||||||
|
.dempty { margin: auto; text-align: center; padding: 16px 4px; }
|
||||||
|
.dblank { padding: 40px 12px; text-align: center; color: var(--dim); }
|
||||||
|
.dpalette { margin-bottom: 10px; }
|
||||||
|
.dpalette h3 { margin-bottom: 8px; }
|
||||||
|
.dhelp { margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400; }
|
||||||
|
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||||
|
.dchip { gap: 6px; min-height: 34px; padding: 4px 11px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
|
||||||
|
.dchip svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
||||||
|
.dph { min-height: 110px; border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 8%, transparent); }
|
||||||
|
.dghost { position: fixed; left: 0; top: 0; z-index: 90; margin: 0; pointer-events: none; opacity: .85; max-height: 240px; overflow: hidden; box-shadow: 0 12px 30px #000a; }
|
||||||
|
body.ddragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
|
||||||
|
.dlist { display: flex; flex-direction: column; gap: 4px; }
|
||||||
|
.dlist hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
|
||||||
|
.drow { display: flex; align-items: center; gap: 8px; min-height: 26px; font-size: 13px; min-width: 0; }
|
||||||
|
.dlink { width: 100%; justify-content: flex-start; min-height: 42px; padding: 5px 9px; text-align: left; font-weight: 400; background: var(--panel2); }
|
||||||
|
.dname { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
|
||||||
|
.dname b, .dname small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.dname small { color: var(--dim); font-size: 11px; }
|
||||||
|
.dtag { flex: none; padding: 1px 6px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: .05em; }
|
||||||
|
.dtag.mute { color: #fff; background: var(--mute); }
|
||||||
|
.dlab { flex: none; min-width: 3.1em; color: var(--dim); font-size: 12px; }
|
||||||
|
.dsub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 12px; }
|
||||||
|
.dval { flex: none; min-width: 4.6em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }
|
||||||
|
.dbar { --cc: var(--accent); flex: 1; position: relative; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 30px; }
|
||||||
|
.dbar i { position: absolute; inset: 0 auto 0 0; background: var(--cc); opacity: .85; }
|
||||||
|
.dbar u { position: absolute; left: 70%; top: 0; bottom: 0; width: 1px; background: #ffffff66; }
|
||||||
|
.dgain.muted .dbar i { background: var(--dim); opacity: .4; }
|
||||||
|
.dgain.muted .dval { color: #f87171; font-size: 10px; }
|
||||||
|
.drow.zero { opacity: .5; }
|
||||||
|
.dmeters { flex: 1; min-height: 0; display: flex; gap: 14px; }
|
||||||
|
.dmgroup { flex: 1 1 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
|
||||||
|
.dmgroup .sub { flex: none !important; margin: 0; }
|
||||||
|
.dms { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: 5px minmax(0, 1fr) 18px 3px; gap: 0 4px; }
|
||||||
|
.dmeters.hasnames .dms { grid-template-rows: 15px minmax(0, 1fr) 18px 3px; }
|
||||||
|
.dms > .dm { grid-row: 2; position: relative; margin-bottom: 3px; }
|
||||||
|
.dgrp { grid-row: 1 / -1; border-radius: 8px; background: color-mix(in srgb, var(--lc) 6%, transparent); }
|
||||||
|
.dgrpname { grid-row: 1; position: relative; align-self: center; padding: 0 4px; min-width: 0; color: var(--lc); font-size: 10px; line-height: 12px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.dmlab { grid-row: 3; position: relative; align-self: center; text-align: center; font-size: 11px; font-weight: 700; line-height: 18px; }
|
||||||
|
.dm { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; min-height: 0; }
|
||||||
|
.dm .led { flex: 1 1 0; height: auto; min-height: 0; padding: 0; }
|
||||||
|
.dm.muted .led { opacity: .35; }
|
||||||
|
.led > .limled.seg { flex: 1; width: auto; height: auto; min-height: 0; margin: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
|
||||||
|
border-radius: 1.5px; font-size: 6px; line-height: 1; font-weight: 800; letter-spacing: 0; color: color-mix(in srgb, var(--led-o) 30%, transparent);
|
||||||
|
background: color-mix(in srgb, var(--led-o) 8%, transparent); }
|
||||||
|
.led > .limled.seg.on { color: var(--led-o); background: color-mix(in srgb, var(--led-o) 20%, transparent); box-shadow: none; }
|
||||||
|
.dnav { flex: none; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
|
||||||
|
.dnav button { min-height: 28px; min-width: 32px; padding: 0 8px; font-size: 16px; line-height: 1; }
|
||||||
|
.dnavname { flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--dim); }
|
||||||
|
.dnavname b { color: var(--text); }
|
||||||
|
canvas.dcurve { display: block; width: 100%; flex: 1 1 0; min-height: 70px; background: var(--bg2); border-radius: 8px; }
|
||||||
|
.dlegend { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 5px; font-size: 11px; color: var(--dim); }
|
||||||
|
.dlegend span { display: inline-flex; align-items: center; gap: 4px; }
|
||||||
|
.dlegend i { width: 10px; height: 3px; border-radius: 2px; }
|
||||||
|
.doverlays { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 6px; }
|
||||||
|
.doverlays label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
|
||||||
|
.doverlays i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
|
||||||
|
.dbands { flex: none; display: flex; gap: 3px; margin-top: 6px; overflow-x: auto; }
|
||||||
|
.dband { flex: 1 0 34px; flex-direction: column; gap: 0; min-height: 34px; padding: 2px; font-weight: 400; background: var(--panel2); }
|
||||||
|
.dband b { font-size: 12px; }
|
||||||
|
.dband small { color: var(--dim); font-size: 10px; }
|
||||||
|
.dband.act b { color: var(--accent); }
|
||||||
|
.dband.off { opacity: .45; }
|
||||||
|
.dband.on { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--panel2)); }
|
||||||
|
.dbandinfo { margin: 6px 2px 0; min-height: 1.3em; }
|
||||||
|
.dkvs { display: flex; flex-direction: column; }
|
||||||
|
.dkv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
|
||||||
|
.dkv:last-child { border-bottom: 0; }
|
||||||
|
.dkv span { color: var(--dim); flex: none; }
|
||||||
|
.dkv b { font-weight: 600; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.dkv.bad b { color: #f87171; }
|
||||||
|
.dmatrix { display: grid; grid-template-columns: minmax(3.4em, auto) repeat(var(--n), minmax(16px, 1fr)); gap: 4px 3px; align-items: center; justify-items: center; font-size: 12px; }
|
||||||
|
.dmatrix span { justify-self: start; color: var(--dim); white-space: nowrap; }
|
||||||
|
.dmatrix b { font-size: 11px; }
|
||||||
|
.dmatrix i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
|
||||||
|
.dmatrix i.on { background: var(--c); box-shadow: 0 0 6px var(--c); }
|
||||||
|
.dnote { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
|
||||||
|
.dform textarea { width: 100%; resize: vertical; min-height: 110px; font: inherit; }
|
||||||
|
/* ---- read-only switch (phones, tablets) */
|
||||||
|
.guard { flex: none; gap: 6px; min-height: 34px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--dim); background: var(--panel2); }
|
||||||
|
.guardtrack { position: relative; width: 28px; height: 16px; border-radius: 8px; background: var(--line2); transition: background .15s; }
|
||||||
|
.guardtrack i { position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; }
|
||||||
|
.guard.on { color: #fff; border-color: var(--accent); }
|
||||||
|
.guard.on .guardtrack { background: var(--accent); }
|
||||||
|
.guard.on .guardtrack i { left: 14px; }
|
||||||
|
body.locked #main input[type=range] { pointer-events: none; }
|
||||||
|
.nodsp { gap: 10px; }
|
||||||
|
.nodsp svg { width: 44px; height: 44px; fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
||||||
|
.nodsp b { color: var(--text); font-size: 18px; }
|
||||||
|
.nodsp p { max-width: 420px; margin: 0 0 6px; line-height: 1.45; }
|
||||||
|
/* ---- start animation, VK-Audio */
|
||||||
|
#splash { display: none; }
|
||||||
|
#splash.show { position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
|
||||||
|
background: var(--bg); pointer-events: none; animation: splashout .3s ease-in 1.15s forwards; }
|
||||||
|
#splash svg { margin-bottom: 8px; fill: none; stroke: #38bdf8; stroke-width: 3; stroke-linecap: round; overflow: visible; }
|
||||||
|
#splash path { transform-box: fill-box; transform-origin: bottom; animation: splashbar .75s cubic-bezier(.3, 1.5, .5, 1) backwards; }
|
||||||
|
#splash path:nth-child(2) { animation-delay: .08s; } #splash path:nth-child(3) { animation-delay: .16s; } #splash path:nth-child(4) { animation-delay: .24s; }
|
||||||
|
#splash b { font-size: 20px; font-weight: 650; color: var(--text); animation: splashtext .4s ease-out .35s backwards; }
|
||||||
|
#splash small { font-size: 12px; letter-spacing: .14em; color: var(--dim); animation: splashtext .4s ease-out .5s backwards; }
|
||||||
|
@keyframes splashbar { from { transform: scaleY(0); } }
|
||||||
|
@keyframes splashtext { from { opacity: 0; transform: translateY(5px); } }
|
||||||
|
@keyframes splashout { to { opacity: 0; } }
|
||||||
|
@media (prefers-reduced-motion: reduce) { #splash.show { 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; }
|
||||||
|
.dialog:has(> .docbody) { display: flex; flex-direction: column; width: min(820px, 100%); max-height: calc(100dvh - 32px); }
|
||||||
|
.docbody { position: relative; flex: 1; min-height: 0; overflow-y: auto; margin-right: -8px; padding-right: 8px; scrollbar-width: thin; scrollbar-color: var(--line2) transparent;
|
||||||
|
font-size: 14px; line-height: 1.55; }
|
||||||
|
.docnav { position: sticky; top: 0; z-index: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 0 10px; background: var(--panel); }
|
||||||
|
.docnav button { flex: none; }
|
||||||
|
.docbody section { padding: 16px 0; border-top: 1px solid var(--line); }
|
||||||
|
.docbody section:first-of-type { padding-top: 6px; border-top: 0; }
|
||||||
|
.docbody section:last-child { padding-bottom: 4px; }
|
||||||
|
.docbody h4 { margin: 0 0 8px; font-size: 16px; font-weight: 650; color: var(--text); }
|
||||||
|
.docbody p { margin: 0 0 10px; }
|
||||||
|
.docbody p:last-child { margin-bottom: 0; }
|
||||||
|
.docbody ol, .docbody ul { margin: 0; padding: 0; list-style: none; }
|
||||||
|
.docbody ol { counter-reset: step; }
|
||||||
|
.docbody li { position: relative; margin: 8px 0; padding-left: 32px; }
|
||||||
|
.docbody ol li { counter-increment: step; }
|
||||||
|
.docbody ol li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
|
||||||
|
font-size: 12px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
|
||||||
|
.docbody ul li::before { content: ""; position: absolute; left: 8px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
|
||||||
|
.docui { padding: 0 5px; border-radius: 4px; font-weight: 600; white-space: nowrap; background: var(--panel3); }
|
||||||
|
.doctip { margin: 12px 0 0 !important; padding: 9px 12px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; color: var(--dim); background: var(--panel2); }
|
||||||
|
.docbody figure { margin: 12px 0; }
|
||||||
|
.docbody figure img { display: block; width: auto; max-width: 100%; max-height: 480px; height: auto; margin: 0 auto; border: 1px solid var(--line); border-radius: 10px; }
|
||||||
|
.docbody figcaption { margin-top: 6px; text-align: center; font-size: 12px; color: var(--dim); }
|
||||||
|
@media (max-width: 480px) { .dialog:has(> .docbody) { max-height: 92dvh; } .docui { white-space: normal; } }
|
||||||
|
/* ---- locked with "only show dashboard" */
|
||||||
|
body.dashonly #viewtabs, body.dashonly #devtabs, body.dashonly #btn-settings, body.dashonly #statusbar { display: none; }
|
||||||
|
body.dashonly #main { margin-left: 0; }
|
||||||
|
body.dashonly #btn-muteall { margin-left: auto; }
|
||||||
|
body.dashonly .dlink { cursor: default; }
|
||||||
|
.limled.gainlim { margin: 0 2px 0 auto; font-size: 10px; }
|
||||||
|
.limled.barlim { margin: 0 2px; font-size: 10px; }
|
||||||
|
/* ---- routing: a soft pulse runs down from the input into the crosspoint, then out along the output */
|
||||||
|
.xp.on .node { position: relative; z-index: 1; }
|
||||||
|
.xp.on::before, .xp.on::after { content: ""; position: absolute; pointer-events: none; --pulse: color-mix(in srgb, var(--cc) 35%, #fff); opacity: 0; }
|
||||||
|
.xp.on::before { top: 0; left: calc(50% - 1.5px); width: 3px; height: 50%;
|
||||||
|
background: linear-gradient(transparent, var(--pulse), transparent) 0 0 / 100% 16px no-repeat; animation: xpdown 2.8s linear infinite; }
|
||||||
|
.xp.on::after { top: calc(50% - 1.5px); left: 0; right: 0; height: 3px;
|
||||||
|
background: linear-gradient(90deg, transparent, var(--pulse), transparent) 50% 0 / 16px 100% no-repeat,
|
||||||
|
linear-gradient(90deg, transparent, var(--pulse), transparent) 50% 0 / 16px 100% no-repeat; animation: xpout 2.8s linear infinite; }
|
||||||
|
@keyframes xpdown {
|
||||||
|
0% { background-position: 0 -16px; opacity: 0; } 8% { opacity: .9; }
|
||||||
|
35% { background-position: 0 100%; opacity: .9; } 40%, 100% { background-position: 0 100%; opacity: 0; }
|
||||||
|
}
|
||||||
|
@keyframes xpout {
|
||||||
|
0%, 35% { background-position: 50% 0, 50% 0; opacity: 0; } 42% { opacity: .9; }
|
||||||
|
85% { opacity: .5; } 92%, 100% { background-position: 0% 0, 100% 0; opacity: 0; }
|
||||||
|
}
|
||||||
|
@media (prefers-reduced-motion: reduce) { .xp.on::before, .xp.on::after { animation: none; } }
|
||||||
|
/* level of a connection inside its point */
|
||||||
|
.xp.on .node { width: 36px; height: 36px; border-width: 2px; transform: none; background: color-mix(in srgb, var(--cc) 62%, #0b0c0f); border-color: var(--cc); }
|
||||||
|
.xp.on small { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; pointer-events: none;
|
||||||
|
font-size: 10px; font-weight: 700; letter-spacing: -.02em; color: #fff; }
|
||||||
|
/* routing switched: the point pops in or sinks away, a soft ring spreads once */
|
||||||
|
.xp.fx .node { position: relative; }
|
||||||
|
.xp.fx .node::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--cc); opacity: 0; pointer-events: none; animation: xpring .5s ease-out; }
|
||||||
|
.xp.fx.on .node { animation: xpin .28s cubic-bezier(.3, 1.4, .5, 1); }
|
||||||
|
.xp.fx:not(.on) .node { animation: xpoff .3s ease-out; }
|
||||||
|
.xp.fx.on small { animation: xptext .3s ease-out; }
|
||||||
|
@keyframes xpring { from { transform: scale(1); opacity: .55; } to { transform: scale(1.8); opacity: 0; } }
|
||||||
|
@keyframes xpin { from { transform: scale(.6); } }
|
||||||
|
@keyframes xpoff { from { transform: scale(1.45); background: color-mix(in srgb, var(--cc) 45%, var(--bg)); border-color: var(--cc); } }
|
||||||
|
@keyframes xptext { from { opacity: 0; } }
|
||||||
|
@media (prefers-reduced-motion: reduce) { .xp.fx .node, .xp.fx .node::after, .xp.fx.on small { animation: none; } }
|
||||||
|
.lockopt { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
|
||||||
|
/* ---- DJ Brake setting */
|
||||||
|
.djurl { margin-top: 8px; align-items: center; flex-wrap: nowrap; }
|
||||||
|
.djurl code { flex: 1; min-width: 0; padding: 5px 8px; border-radius: 6px; background: var(--bg2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
|
.djwarn { color: var(--warn); }
|
||||||
|
.djurl button { flex: none; width: auto; }
|
||||||
|
.djlim { margin: 12px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
|
||||||
|
.djdev { margin-top: 8px; }
|
||||||
|
.djdev > small { display: block; margin-bottom: 4px; color: var(--dim); }
|
||||||
|
.djchs { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||||
|
.djch { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 5px 8px; line-height: 1.2; }
|
||||||
|
.djch small { font-size: 10px; color: var(--dim); }
|
||||||
|
.djch.out { border-color: var(--warn); color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); text-decoration: line-through; }
|
||||||
|
.djch.out small { color: inherit; }
|
||||||
|
.djlim label.chk { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
|
||||||
|
.djlim label.chk input { flex: none; margin: 3px 0 0; }
|
||||||
|
.row.djurl button.small { flex: 0 0 auto; width: auto; padding-inline: 14px; }
|
||||||
|
.row.djurl code { flex: 1 1 auto; }
|
||||||
|
/* ---- UI pass: controls of one kind line up and have one size */
|
||||||
|
.kv { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
|
||||||
|
.kv > span { flex: 1; min-width: 0; }
|
||||||
|
.kvc { flex: 0 0 180px; display: flex; gap: 6px; align-items: stretch; }
|
||||||
|
.kvc button { flex: 1; }
|
||||||
|
.kvc input.short { flex: 0 0 76px !important; }
|
||||||
|
.setgrid > .card > div.info { margin: 0 2px 10px; }
|
||||||
|
.setgrid > .card > .remote-urls { margin-top: 10px; }
|
||||||
|
label.chk { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
|
||||||
|
label.chk input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
|
||||||
|
.paramgrid { display: grid; gap: 2px 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
|
||||||
|
.card:has(> .lkgrid) { display: flex; flex-direction: column; container-type: inline-size; }
|
||||||
|
.lkgrid { grid-template-columns: repeat(2, 1fr); }
|
||||||
|
@container (min-width: 280px) { .lkgrid { grid-template-columns: repeat(4, 1fr); } }
|
||||||
|
.lkch { min-width: 0; padding-inline: 4px; }
|
||||||
|
.lkactions { margin-top: auto; padding-top: 10px; }
|
||||||
|
.labcards .card > .row > button:only-child { flex: 1 1 100%; }
|
||||||
|
@media (max-width: 1150px) { .firsep { flex-basis: 100%; width: auto; height: 0; margin: 0; } }
|
||||||
|
/* phone: the limiter display must stay readable at arm's length */
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.limled.txt { font-size: 11px; line-height: 13px; }
|
||||||
|
.limled.gainlim, .limled.barlim { font-size: 11px; }
|
||||||
|
.limled.dot { width: 11px; height: 11px; }
|
||||||
|
.led > .limled.seg { color: transparent; }
|
||||||
|
.led > .limled.seg.on { color: transparent; background: var(--led-o); }
|
||||||
|
}
|
||||||
|
@media (max-width: 600px) { .cards .card > h3 { flex-wrap: wrap; row-gap: 6px; height: auto; } .cards .card > h3 > * { min-width: 0; } }
|
||||||
|
.docui { padding: 0 4px; }
|
||||||
|
html { touch-action: pan-x pan-y; }
|
||||||
|
.dialog:has(> .resetbody) { width: min(520px, 100%); padding: 22px; }
|
||||||
|
.dialog:has(> .resetbody) > h2 { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 19px; }
|
||||||
|
.dialog:has(> .resetbody) > h2::before { content: "!"; flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 19px; font-weight: 800;
|
||||||
|
color: #fca5a5; background: color-mix(in srgb, #ef4444 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #ef4444 45%, transparent); }
|
||||||
|
.resetlead { margin: 0 0 14px; color: var(--dim); }
|
||||||
|
.resetlists { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; }
|
||||||
|
.resetlist { padding: 12px 14px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
|
||||||
|
.resetlist > b { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 650; }
|
||||||
|
.resetlist ul { margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.35; color: var(--dim); }
|
||||||
|
.resetlist li { position: relative; margin-top: 6px; padding-left: 20px; }
|
||||||
|
.resetlist li::before { position: absolute; left: 0; top: 0; width: 14px; text-align: center; font-weight: 800; }
|
||||||
|
.resetlist.gone > b { color: #fca5a5; }
|
||||||
|
.resetlist.gone li::before { content: "×"; color: #f87171; }
|
||||||
|
.resetlist.stays { border-color: color-mix(in srgb, var(--ok, #22c55e) 35%, var(--line)); }
|
||||||
|
.resetlist.stays > b { color: #86efac; }
|
||||||
|
.resetlist.stays li { color: var(--text); }
|
||||||
|
.resetlist.stays li::before { content: "✓"; color: #4ade80; }
|
||||||
|
.resetwarn { margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; font-size: 13px; color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
|
||||||
|
.resetcheck { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
|
||||||
|
.resetcheck > span { display: block; margin-bottom: 10px; font-size: 13px; color: var(--dim); }
|
||||||
|
.resetrow { display: flex; align-items: center; justify-content: center; gap: 12px; }
|
||||||
|
.resetletters { display: flex; gap: 6px; user-select: none; -webkit-user-select: none; }
|
||||||
|
.resetletters i { display: grid; place-items: center; width: 42px; height: 48px; border-radius: 10px; font: 700 23px ui-monospace, Menlo, Consolas, monospace; color: var(--text); background: var(--panel3); border: 1px solid var(--line2); }
|
||||||
|
.resetarrow { color: var(--dim); font-size: 18px; }
|
||||||
|
input.resetcode { width: 90px; height: 48px; padding: 0 0 0 .3em; border-radius: 10px; text-align: center; font: 700 23px ui-monospace, Menlo, Consolas, monospace; letter-spacing: .3em; text-transform: uppercase; }
|
||||||
|
.dialog:has(> .resetbody) > .dlg-actions { margin-top: 18px; }
|
||||||
|
.dialog:has(> .resetbody) > .dlg-actions button { flex: 1 1 0; }
|
||||||
|
.dialog:has(> .resetbody) > .dlg-actions button:disabled { color: var(--dim); background: var(--panel2); border-color: var(--line); opacity: 1; }
|
||||||
|
@media (max-width: 480px) { .resetlists { grid-template-columns: 1fr; } }
|
||||||
|
.dialog input.resetcode { flex: none; margin: 0; }
|
||||||
@@ -35,7 +35,7 @@ def test_layout_matches_devices():
|
|||||||
|
|
||||||
|
|
||||||
def test_state_roundtrip():
|
def test_state_roundtrip():
|
||||||
for m in P.MODELS.values():
|
for m in (m for m in P.MODELS.values() if not m.fir):
|
||||||
st = P.default_state(m)
|
st = P.default_state(m)
|
||||||
st["outputs"][-1]["comp"]["threshold"] = 123
|
st["outputs"][-1]["comp"]["threshold"] = 123
|
||||||
st["inputs"][0]["geq"][30] = 7
|
st["inputs"][0]["geq"][30] = 7
|
||||||
@@ -120,6 +120,184 @@ def test_channel_names():
|
|||||||
assert P.param_command(m, "in", 0, {"name": "Süd"}, "name") == (0x3D, b"\x00Sued ")
|
assert P.param_command(m, "in", 0, {"name": "Süd"}, "name") == (0x3D, b"\x00Sued ")
|
||||||
|
|
||||||
|
|
||||||
|
def test_device_lock():
|
||||||
|
# answer to 0x2C: [time lock][4 bytes time lock data][device lock]
|
||||||
|
assert P.device_locked(bytes([0, 0, 0, 0, 0, 1]))
|
||||||
|
assert not P.device_locked(bytes([0, 0, 0, 0, 0, 0]))
|
||||||
|
assert not P.device_locked(bytes([0, 20])) # short answer: no lock information
|
||||||
|
assert P.LOCK_CODE.fullmatch("A1BA") and not P.LOCK_CODE.fullmatch("a1ba") and not P.LOCK_CODE.fullmatch("A1B")
|
||||||
|
assert P.build_frame(P.CMD_UNLOCK, b"\x00A1BA")[5:11] == bytes([0x2D, 0x00]) + b"A1BA"
|
||||||
|
import sim
|
||||||
|
dsp = sim.SimDSP("204", "A1BA")
|
||||||
|
assert P.device_locked(dsp.handle(P.CMD_PRESET_COUNT, b"")[1])
|
||||||
|
assert dsp.handle(P.CMD_UNLOCK, b"\x00ZZZZ") == (P.CMD_UNLOCK, bytes([0, 0]))
|
||||||
|
assert dsp.handle(P.CMD_UNLOCK, b"\x00A1BA") == (P.CMD_UNLOCK, bytes([0, 1]))
|
||||||
|
assert not P.device_locked(dsp.handle(P.CMD_PRESET_COUNT, b"")[1])
|
||||||
|
dsp.handle(P.CMD_SET_LOCK_CODE, b"B2C3")
|
||||||
|
assert dsp.lock_code == "B2C3"
|
||||||
|
|
||||||
|
|
||||||
|
def test_test_signal():
|
||||||
|
# source/frequency follow the mute masks and one word per channel (editor: 0x2C8 on the 204, 0x59C on the 408)
|
||||||
|
assert P.MODELS["204"].test_base == 0x2C8 and P.MODELS["408"].test_base == 0x59C
|
||||||
|
for m in (m for m in P.MODELS.values() if not m.fir):
|
||||||
|
st = P.default_state(m)
|
||||||
|
st["test"] = {"source": 3, "freq": 17}
|
||||||
|
assert P.parse_state(m, bytes(P.build_state_buffer(m, st)))["test"] == {"source": 3, "freq": 17}
|
||||||
|
st = P.default_state(P.MODELS["204"])
|
||||||
|
P.apply_command(P.MODELS["204"], st, P.CMD_TEST_SIGNAL, bytes([1, 5]))
|
||||||
|
assert st["test"] == {"source": 1, "freq": 5}
|
||||||
|
|
||||||
|
|
||||||
|
def test_master_bypass():
|
||||||
|
# masks after the test signal: [?][PEQ inputs][PEQ outputs][GEQ inputs] (editor: 0x2CE/0x2D0/0x2D2 on the 204)
|
||||||
|
m = P.MODELS["204"]
|
||||||
|
assert m.test_base + 6 == 0x2CE and m.test_base + 10 == 0x2D2 == m.size - 2
|
||||||
|
st = P.default_state(m)
|
||||||
|
st["inputs"][1]["peq_bypass"] = st["inputs"][0]["geq_bypass"] = st["outputs"][3]["peq_bypass"] = True
|
||||||
|
buf = P.build_state_buffer(m, st)
|
||||||
|
assert buf[0x2CE:0x2D4] == bytes([2, 0, 8, 0, 1, 0])
|
||||||
|
back = P.parse_state(m, bytes(buf))
|
||||||
|
assert back["inputs"][1]["peq_bypass"] and back["inputs"][0]["geq_bypass"] and back["outputs"][3]["peq_bypass"]
|
||||||
|
assert not back["inputs"][0]["peq_bypass"] and not back["outputs"][0]["peq_bypass"]
|
||||||
|
assert P.param_command(m, "out", 3, back["outputs"][3], "peq_bypass") == (0x3C, bytes([5, 1]))
|
||||||
|
assert P.param_command(m, "in", 0, back["inputs"][0], "geq_bypass") == (0x49, bytes([0, 1]))
|
||||||
|
assert P.MODELS["408"].test_base + 6 == 0x5A2
|
||||||
|
|
||||||
|
|
||||||
|
def test_beta_models():
|
||||||
|
assert P.detect_model("DSP408 V010") == "408" and P.detect_model("DSP 204") == "204"
|
||||||
|
for info in ("DSP206 V1", "FIR DSP408 V1", "FIRDSP408", "DSP408FIR"): # only selectable by hand
|
||||||
|
assert P.detect_model(info) is None, info
|
||||||
|
for key in ("206", "408fir"):
|
||||||
|
m = P.MODELS[key]
|
||||||
|
assert m.beta
|
||||||
|
st = P.default_state(m)
|
||||||
|
st["outputs"][m.n_out - 1]["gain"] = 123
|
||||||
|
back = P.parse_state(m, bytes(P.build_state_buffer(m, st)))
|
||||||
|
assert back["outputs"][m.n_out - 1]["gain"] == 123 and len(back["inputs"]) == m.n_in
|
||||||
|
|
||||||
|
|
||||||
|
def test_fir_model():
|
||||||
|
m = P.MODELS["408fir"]
|
||||||
|
assert (m.in_size, m.out_size, m.out_base, m.globals_base, m.size, m.chunks) == (138, 108, 0x238, 0x598, 0x625, 32)
|
||||||
|
st = P.default_state(m)
|
||||||
|
o = st["outputs"][7]
|
||||||
|
o["gain"], o["limit"]["threshold"], o["hp"], o["peq"][8]["bypass"] = 123, 77, {"freq": 40, "slope": 5}, True
|
||||||
|
o["fir"].update(type=3, window=8, low=200, high=8000, taps=24, name="SUB")
|
||||||
|
st["inputs"][3]["comp"]["threshold"], st["inputs"][3]["fir"] = 55, {"taps": 2048, "bypass": False, "name": "ROOM"}
|
||||||
|
st["inputs"][0]["peq"][7]["bypass"] = True
|
||||||
|
buf = bytes(P.build_state_buffer(m, st))
|
||||||
|
assert buf[0x238 + 7 * 108 + 28:0x238 + 7 * 108 + 36] == bytes([3, 8]) + (200).to_bytes(2, "little") + (8000).to_bytes(2, "little") + (24).to_bytes(2, "little")
|
||||||
|
assert buf[0x5B4 + 8 * 11:0x5B4 + 8 * 11 + 3] == b"SUB" and buf[0x59C:0x59E] == (128).to_bytes(2, "little")
|
||||||
|
back = P.parse_state(m, buf)
|
||||||
|
assert back["outputs"] == st["outputs"] and back["inputs"] == st["inputs"]
|
||||||
|
assert len(back["inputs"][0]["peq"]) == 8 and len(back["outputs"][0]["peq"]) == 9 and "geq" not in back["inputs"][0]
|
||||||
|
assert P.param_command(m, "out", 7, back["outputs"][7], "fir") == (0x4B, bytes.fromhex("0b 03 08 c8 00 40 1f 18 00"))
|
||||||
|
assert P.param_command(m, "out", 7, back["outputs"][7], "hp") == (0x32, bytes.fromhex("0b 28 00 04 00"))
|
||||||
|
assert P.param_command(m, "out", 0, back["outputs"][0], "hp") == (0x32, bytes.fromhex("04 00 00 00 01"))
|
||||||
|
assert P.param_command(m, "in", 3, back["inputs"][3], "fir.bypass") == (0x4F, bytes.fromhex("03 00"))
|
||||||
|
assert P.param_command(m, "out", 7, back["outputs"][7], "limit")[1][:3] == bytes.fromhex("0b 00 00")
|
||||||
|
assert P.fir_channel_taps(back["outputs"][7]) == 1024 and P.fir_channel_taps(back["inputs"][3]) == 2048
|
||||||
|
frames = P.fir_coef_frames(4, [1.0] + [0.0] * 12)
|
||||||
|
assert len(frames) == 2 and frames[0][:8] == bytes.fromhex("04 00 0d 00 3f 80 00 00") and len(frames[0]) == 4 + 48 and len(frames[1]) == 8
|
||||||
|
for cmd, p in ((0x4B, bytes.fromhex("04 01 02 96 00 20 4e 08 00")), (0x4E, frames[0]), (0x5B, b"\x04ABC ")):
|
||||||
|
P.apply_command(m, st, cmd, p)
|
||||||
|
assert st["outputs"][0]["fir"]["type"] == 1 and st["outputs"][0]["fir"]["name"] == "ABC"
|
||||||
|
|
||||||
|
|
||||||
|
def test_dj_brake_light():
|
||||||
|
import server, tempfile
|
||||||
|
from types import SimpleNamespace
|
||||||
|
with tempfile.TemporaryDirectory() as d:
|
||||||
|
app = server.App(Path(d) / "c.json")
|
||||||
|
out = {"mute": False}
|
||||||
|
app.devices["x"] = SimpleNamespace(id="x", demo=True, state={"outputs": [out, {"mute": False}]}, status="online")
|
||||||
|
note = lambda t, *limit: app.dj_note({"device": "x", "out": [0.1, 0.1], "limit": list(limit)}, now=t)
|
||||||
|
note(10.0, False, False)
|
||||||
|
assert app.dj_state(10.0)["ready"] and not app.dj_state(10.0)["on"]
|
||||||
|
# on with the limiter, and one more second afterwards
|
||||||
|
note(100.0, True, False)
|
||||||
|
assert app.dj_state(100.0)["on"] and app.dj_state(100.9)["on"] and not app.dj_state(101.1)["on"]
|
||||||
|
# a limiter left out doesn't count, the others do
|
||||||
|
app.dj_ignore = {"x": [0]}
|
||||||
|
note(200.0, True, False)
|
||||||
|
assert not app.dj_state(200.0)["on"]
|
||||||
|
note(210.0, False, True)
|
||||||
|
assert app.dj_state(210.0)["on"]
|
||||||
|
# neither does a muted output, and with nothing left to watch the page says so
|
||||||
|
app.dj_ignore = {}
|
||||||
|
out["mute"] = True
|
||||||
|
note(300.0, True, False)
|
||||||
|
assert not app.dj_state(300.0)["on"] and app.dj_state(300.0)["ready"]
|
||||||
|
app.dj_ignore = {"x": [1]}
|
||||||
|
note(310.0, True, True)
|
||||||
|
assert not app.dj_state(310.0)["on"] and not app.dj_state(310.0)["ready"]
|
||||||
|
# only these three things leave here
|
||||||
|
assert set(app.dj_state(1.0)) == {"on", "ready", "hint"}
|
||||||
|
|
||||||
|
|
||||||
|
def test_reset_config():
|
||||||
|
import asyncio, json, server, tempfile
|
||||||
|
with tempfile.TemporaryDirectory() as d:
|
||||||
|
path = Path(d) / "c.json"
|
||||||
|
app = server.App(path)
|
||||||
|
app.load()
|
||||||
|
app.set_pin("9999", save=False)
|
||||||
|
app.djbrake, app.lang, app.dj_ignore = True, "de", {"x": [0]}
|
||||||
|
app.dashboard = {"modules": []}
|
||||||
|
app.app_token = "t"
|
||||||
|
app.app_sessions, app.sessions = {"a"}, {"a": 9e12, "b": 9e12}
|
||||||
|
app.save()
|
||||||
|
app.mute_all["active"] = True
|
||||||
|
try:
|
||||||
|
asyncio.run(app.reset_config())
|
||||||
|
raise AssertionError("mute all must block the reset")
|
||||||
|
except ValueError:
|
||||||
|
assert app.djbrake
|
||||||
|
app.mute_all["active"] = False
|
||||||
|
app.remote["enabled"] = False
|
||||||
|
asyncio.run(app.reset_config())
|
||||||
|
assert not app.djbrake and app.lang == "" and app.dashboard is None and app.dj_ignore == {} and app.check_pin("1234")
|
||||||
|
assert app.app_token == "t" and app.app_sessions == {"a"} and set(app.sessions) == {"a"}
|
||||||
|
assert json.loads(path.with_name("config.before-reset.json").read_text())["djbrake"] is True
|
||||||
|
|
||||||
|
|
||||||
|
def test_looks_follow_presets():
|
||||||
|
from dsp.device import Device
|
||||||
|
d = Device("x", "x", "127.0.0.1")
|
||||||
|
d.state = {"preset_name": "A"}
|
||||||
|
d.colors, d.linknames = {"out0": "#111111"}, {"out:0,1": "Tops"}
|
||||||
|
d.sync_look()
|
||||||
|
d.state = {"preset_name": "B"} # has no look of its own: starts without
|
||||||
|
d.sync_look()
|
||||||
|
assert d.colors == {} and d.linknames == {}
|
||||||
|
d.colors, d.linknames = {"out0": "#222222"}, {"out:0,1": "Subs"}
|
||||||
|
d.remember_look()
|
||||||
|
d.state = {"preset_name": "A"}
|
||||||
|
d.sync_look()
|
||||||
|
assert d.colors == {"out0": "#111111"} and d.linknames == {"out:0,1": "Tops"}
|
||||||
|
d.state = {"preset_name": "B"}
|
||||||
|
d.sync_look()
|
||||||
|
assert d.colors == {"out0": "#222222"} and d.linknames == {"out:0,1": "Subs"}
|
||||||
|
assert "looks" not in d.snapshot()
|
||||||
|
# the first preset ever seen keeps what is there
|
||||||
|
e = Device("y", "y", "127.0.0.1", colors={"in0": "#333333"})
|
||||||
|
e.state = {"preset_name": "First"}
|
||||||
|
e.sync_look()
|
||||||
|
assert e.colors == {"in0": "#333333"} and "First" in e.looks
|
||||||
|
# a DSP whose memory image keeps the old name after loading a preset: the listed name counts
|
||||||
|
e.state = {"preset_name": "First"}
|
||||||
|
e.recalled, e.recalled_image = "Other", None
|
||||||
|
e.sync_look()
|
||||||
|
assert e.look_name == "Other" and e.colors == {}
|
||||||
|
e.sync_look()
|
||||||
|
assert e.look_name == "Other"
|
||||||
|
e.state = {"preset_name": "Third"} # loaded on the device itself
|
||||||
|
e.sync_look()
|
||||||
|
assert e.look_name == "Third" and e.recalled == ""
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
for name, fn in list(globals().items()):
|
for name, fn in list(globals().items()):
|
||||||
if name.startswith("test_"):
|
if name.startswith("test_"):
|
||||||
|
|||||||
@@ -0,0 +1,277 @@
|
|||||||
|
"""Finds out how a real DSP's output meter relates to its limiter threshold and output gain.
|
||||||
|
|
||||||
|
Play steady music into the DSP, close every other control software and run:
|
||||||
|
|
||||||
|
python tools/dsp_measure.py --usb
|
||||||
|
python tools/dsp_measure.py --host 192.168.1.101
|
||||||
|
|
||||||
|
It only ever lowers one output's gain (by 6 dB) and limiter threshold, never raises anything above where it was, stores
|
||||||
|
nothing in a preset slot and puts both back at the end, also on Ctrl+C. A preset export is written first as a backup.
|
||||||
|
Takes about two minutes. The result goes to dsp-measure-<time>.json.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import asyncio
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
import signal
|
||||||
|
import statistics
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||||
|
|
||||||
|
from dsp import preset # noqa: E402
|
||||||
|
from dsp import protocol as P # noqa: E402
|
||||||
|
from dsp.device import Device # noqa: E402
|
||||||
|
|
||||||
|
SIGNAL_MIN_DB = -50.0
|
||||||
|
THRESHOLD_FLOOR = 60 # raw, -60 dB: below that something is wrong
|
||||||
|
|
||||||
|
|
||||||
|
def db(power: float) -> float:
|
||||||
|
return 10 * math.log10(power) if power > 1e-12 else -120.0
|
||||||
|
|
||||||
|
|
||||||
|
class Run:
|
||||||
|
def __init__(self, dev: Device):
|
||||||
|
self.dev = dev
|
||||||
|
self.polls: list[dict] = []
|
||||||
|
self.o = 0
|
||||||
|
self.ins: list[int] = []
|
||||||
|
self.gain = None # known once the output is chosen
|
||||||
|
self.thr = None
|
||||||
|
|
||||||
|
def on_event(self, ev: dict):
|
||||||
|
if ev["type"] == "meters" and self.dev.state:
|
||||||
|
self.polls.append({"t": time.monotonic(), "out": ev["out"], "in": ev["in"], "limit": ev["limit"],
|
||||||
|
"gain": self.gain, "thr": self.thr})
|
||||||
|
|
||||||
|
async def set(self, gain: int | None = None, thr: int | None = None):
|
||||||
|
if gain is not None:
|
||||||
|
self.gain = gain
|
||||||
|
self.dev.set_param("out", self.o, "gain", gain)
|
||||||
|
if thr is not None:
|
||||||
|
self.thr = thr
|
||||||
|
self.dev.set_param("out", self.o, "limit.threshold", thr)
|
||||||
|
await self.dev.flush()
|
||||||
|
|
||||||
|
def window(self, since: float) -> list[dict]:
|
||||||
|
return [p for p in self.polls if p["t"] >= since]
|
||||||
|
|
||||||
|
def level(self, polls: list[dict]) -> dict:
|
||||||
|
"""Mean power and upper percentile of the output, and the mean power of the inputs feeding it."""
|
||||||
|
out = [p["out"][self.o] for p in polls]
|
||||||
|
loud = sorted(20 * math.log10(v) if v > 0 else -120.0 for v in out) or [-120.0]
|
||||||
|
inp = [sum(p["in"][i] ** 2 for i in self.ins) for p in polls]
|
||||||
|
return {"mean_db": round(db(statistics.fmean(v * v for v in out)) if out else -120.0, 2),
|
||||||
|
"p95_db": round(loud[int(len(loud) * 0.95) - 1 if len(loud) > 1 else 0], 2), "max_db": round(loud[-1], 2),
|
||||||
|
"in_db": round(db(statistics.fmean(inp)) if inp else -120.0, 2), "polls": len(polls),
|
||||||
|
"limit_share": round(sum(bool(p["limit"][self.o]) for p in polls) / max(1, len(polls)), 2)}
|
||||||
|
|
||||||
|
async def hold(self, seconds: float, settle: float = 1.0) -> dict:
|
||||||
|
await asyncio.sleep(settle)
|
||||||
|
since = time.monotonic()
|
||||||
|
await asyncio.sleep(seconds)
|
||||||
|
return self.level(self.window(since))
|
||||||
|
|
||||||
|
async def find_limit(self, start: int, gain: int) -> dict:
|
||||||
|
"""Lowers the threshold step by step until the limiter acts, then goes back up to where it was."""
|
||||||
|
await self.set(gain=gain)
|
||||||
|
await asyncio.sleep(1.0)
|
||||||
|
raw = start
|
||||||
|
result = {"gain_db": P.gain_to_db(gain), "hit": False}
|
||||||
|
while raw >= THRESHOLD_FLOOR:
|
||||||
|
await self.set(thr=raw)
|
||||||
|
since = time.monotonic()
|
||||||
|
await asyncio.sleep(0.45)
|
||||||
|
if any(p["limit"][self.o] for p in self.window(since)):
|
||||||
|
before = self.level(self.window(since - 3.0))
|
||||||
|
result.update(hit=True, threshold_db=P.threshold_to_db(raw), before=before,
|
||||||
|
offset_p95_db=round(P.threshold_to_db(raw) - before["p95_db"], 2),
|
||||||
|
offset_max_db=round(P.threshold_to_db(raw) - before["max_db"], 2))
|
||||||
|
break
|
||||||
|
raw -= 2
|
||||||
|
await self.set(thr=self.start_thr, gain=self.start_gain)
|
||||||
|
result["flag_after_raise_s"] = await self.flag_clear()
|
||||||
|
return result
|
||||||
|
|
||||||
|
async def flag_clear(self) -> float:
|
||||||
|
"""The flag was seen staying on for 4 s after raising the threshold: the next round must not take that for a hit."""
|
||||||
|
start = time.monotonic()
|
||||||
|
await asyncio.sleep(3.0)
|
||||||
|
while time.monotonic() - start < 15:
|
||||||
|
recent = self.window(time.monotonic() - 0.8)
|
||||||
|
if recent and not any(p["limit"][self.o] for p in recent):
|
||||||
|
break
|
||||||
|
await asyncio.sleep(0.2)
|
||||||
|
on = [p["t"] for p in self.window(start) if p["limit"][self.o]]
|
||||||
|
return round(on[-1] - start, 2) if on else 0.0
|
||||||
|
|
||||||
|
|
||||||
|
def conclude(res: dict) -> list[str]:
|
||||||
|
lines = []
|
||||||
|
d = res.get("gain_test", {}).get("meter_change_db")
|
||||||
|
if d is not None:
|
||||||
|
if abs(d + 6) < 1.5:
|
||||||
|
lines.append(f"Meter is AFTER the output gain: -6 dB gain moved it by {d:+.1f} dB.")
|
||||||
|
elif abs(d) < 1.5:
|
||||||
|
lines.append(f"Meter is BEFORE the output gain: -6 dB gain moved it by {d:+.1f} dB.")
|
||||||
|
else:
|
||||||
|
lines.append(f"Meter and gain: unclear, -6 dB gain moved it by {d:+.1f} dB.")
|
||||||
|
hits = [r for r in res.get("limit_rounds", []) if r.get("hit")]
|
||||||
|
plain = [r["offset_p95_db"] for r in hits if r["gain_db"] == res["start"]["gain_db"]]
|
||||||
|
if plain:
|
||||||
|
lines.append(f"Threshold minus meter at the moment the limiter starts: {statistics.fmean(plain):+.1f} dB "
|
||||||
|
f"(rounds: {plain}, spread {max(plain) - min(plain):.1f} dB).")
|
||||||
|
low = [r for r in hits if r["gain_db"] != res["start"]["gain_db"]]
|
||||||
|
if plain and low:
|
||||||
|
# the threshold alone moves with the music between rounds, threshold minus meter doesn't
|
||||||
|
a = statistics.fmean(r["offset_max_db"] for r in hits if r["gain_db"] == res["start"]["gain_db"])
|
||||||
|
b = statistics.fmean(r["offset_max_db"] for r in low)
|
||||||
|
lines.append(f"Threshold minus loudest meter reading: {a:+.1f} dB, with -6 dB gain {b:+.1f} dB. "
|
||||||
|
+ ("About the same, so meter and limiter seem to see the same level." if abs(a - b) < 2 else "They differ: compare with another run before concluding anything."))
|
||||||
|
c = res.get("limiting")
|
||||||
|
if c:
|
||||||
|
drop = (c["limiting"]["mean_db"] - c["limiting"]["in_db"]) - (c["free"]["mean_db"] - c["free"]["in_db"])
|
||||||
|
lines.append(f"Holding the threshold 6 dB below the start of limiting changed the meter by {drop:+.1f} dB against the input: "
|
||||||
|
+ ("the meter shows the level AFTER the limiter." if drop < -3 else "too little to say whether the meter is before or after the limiter."))
|
||||||
|
lines.append(f"While limiting, threshold minus meter: p95 {c['threshold_db'] - c['limiting']['p95_db']:+.1f} dB, "
|
||||||
|
f"mean {c['threshold_db'] - c['limiting']['mean_db']:+.1f} dB.")
|
||||||
|
return lines
|
||||||
|
|
||||||
|
|
||||||
|
async def measure(run: Run, args) -> dict:
|
||||||
|
dev = run.dev
|
||||||
|
print("Listening for music ...", flush=True)
|
||||||
|
since = time.monotonic()
|
||||||
|
await asyncio.sleep(5)
|
||||||
|
polls = run.window(since)
|
||||||
|
if not polls:
|
||||||
|
raise RuntimeError("no meter readings from the DSP")
|
||||||
|
outs = dev.state["outputs"]
|
||||||
|
power = [statistics.fmean(p["out"][i] ** 2 for p in polls) for i in range(len(outs))]
|
||||||
|
if args.output:
|
||||||
|
run.o = args.output - 1
|
||||||
|
else:
|
||||||
|
run.o = max((i for i in range(len(outs)) if not outs[i]["mute"]), key=lambda i: power[i], default=0)
|
||||||
|
ch = outs[run.o]
|
||||||
|
run.ins = [i for i in range(len(dev.state["inputs"])) if ch["matrix"] >> i & 1] or list(range(len(dev.state["inputs"])))
|
||||||
|
if ch["mute"] or db(power[run.o]) < SIGNAL_MIN_DB:
|
||||||
|
raise RuntimeError(f"Out {run.o + 1} has no signal ({db(power[run.o]):.0f} dB) or is muted: play music into the DSP and run again")
|
||||||
|
run.gain = run.start_gain = ch["gain"]
|
||||||
|
run.thr = run.start_thr = ch["limit"]["threshold"]
|
||||||
|
gain6 = P.db_to_gain(P.gain_to_db(run.gain) - 6)
|
||||||
|
print(f"Using Out {run.o + 1}: gain {P.gain_to_db(run.gain):+.1f} dB, limiter threshold {P.threshold_to_db(run.thr):+.1f} dB, "
|
||||||
|
f"level {db(power[run.o]):.1f} dB", flush=True)
|
||||||
|
res = {"device": dev.info, "model": dev.model_name, "output": run.o + 1, "inputs_feeding": [i + 1 for i in run.ins],
|
||||||
|
"start": {"gain_db": P.gain_to_db(run.gain), "threshold_db": P.threshold_to_db(run.thr), "limit": ch["limit"],
|
||||||
|
"level_mean_db": round(db(power[run.o]), 2)}}
|
||||||
|
|
||||||
|
print("1/3 Output gain -6 dB, three times ...", flush=True)
|
||||||
|
rows = []
|
||||||
|
for _ in range(3):
|
||||||
|
await run.set(gain=run.start_gain)
|
||||||
|
a = await run.hold(5)
|
||||||
|
await run.set(gain=gain6)
|
||||||
|
b = await run.hold(5)
|
||||||
|
rows.append({"normal": a, "lowered": b, "change_db": round((b["mean_db"] - b["in_db"]) - (a["mean_db"] - a["in_db"]), 2)})
|
||||||
|
await run.set(gain=run.start_gain)
|
||||||
|
res["gain_test"] = {"rounds": rows, "meter_change_db": round(statistics.fmean(r["change_db"] for r in rows), 2)}
|
||||||
|
|
||||||
|
print("2/3 Lowering the limiter threshold until it acts, several rounds ...", flush=True)
|
||||||
|
rounds, start = [], run.start_thr
|
||||||
|
for gain in (run.start_gain, run.start_gain, run.start_gain, gain6, gain6):
|
||||||
|
r = await run.find_limit(start, gain)
|
||||||
|
rounds.append(r)
|
||||||
|
print(" ", {k: r.get(k) for k in ("gain_db", "hit", "threshold_db", "offset_p95_db")}, flush=True)
|
||||||
|
if r["hit"]: # no need to walk all the way down again
|
||||||
|
start = min(run.start_thr, int(r["threshold_db"] * 2 + 180) + 12)
|
||||||
|
res["limit_rounds"] = rounds
|
||||||
|
|
||||||
|
hits = [r for r in rounds if r["hit"] and r["gain_db"] == res["start"]["gain_db"]]
|
||||||
|
if hits:
|
||||||
|
print("3/3 Holding the limiter on for a moment ...", flush=True)
|
||||||
|
hit_db = statistics.fmean(r["threshold_db"] for r in hits)
|
||||||
|
raw = max(THRESHOLD_FLOOR, round((hit_db - 6) * 2 + 180))
|
||||||
|
free = await run.hold(6)
|
||||||
|
await run.set(thr=raw)
|
||||||
|
limiting = await run.hold(8)
|
||||||
|
await run.set(thr=run.start_thr)
|
||||||
|
res["limiting"] = {"threshold_db": P.threshold_to_db(raw), "free": free, "limiting": limiting}
|
||||||
|
res["conclusions"] = conclude(res)
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
async def main(args):
|
||||||
|
run: Run | None = None
|
||||||
|
dev = Device("m", "measure", args.host or "", args.port, args.model, autoconnect=False, transport="usb" if args.usb else "tcp",
|
||||||
|
on_event=lambda ev: run.on_event(ev))
|
||||||
|
run = Run(dev)
|
||||||
|
task = asyncio.current_task()
|
||||||
|
if sys.platform != "win32":
|
||||||
|
for sig in (signal.SIGTERM, signal.SIGHUP):
|
||||||
|
asyncio.get_running_loop().add_signal_handler(sig, task.cancel)
|
||||||
|
stamp = time.strftime("%Y%m%d-%H%M%S")
|
||||||
|
outdir = Path(args.dir)
|
||||||
|
res, error = {}, ""
|
||||||
|
dev.start()
|
||||||
|
try:
|
||||||
|
for _ in range(100):
|
||||||
|
if dev.status == "online" and dev.state:
|
||||||
|
break
|
||||||
|
await asyncio.sleep(0.2)
|
||||||
|
else:
|
||||||
|
raise RuntimeError(f"DSP not reached ({dev.status}: {dev.error}). Is other control software still open?")
|
||||||
|
doc = await dev.export_preset()
|
||||||
|
backup = outdir / f"dsp-measure-{stamp}-backup.json"
|
||||||
|
backup.write_text(json.dumps(doc), encoding="utf-8")
|
||||||
|
before = json.loads(json.dumps(dev.state))
|
||||||
|
print(f"Connected: {dev.info}. Backup: {backup}", flush=True)
|
||||||
|
try:
|
||||||
|
res = await measure(run, args)
|
||||||
|
except RuntimeError as e:
|
||||||
|
error = str(e)
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
error = "interrupted"
|
||||||
|
finally:
|
||||||
|
# always back to where it was, whatever happened above
|
||||||
|
if hasattr(run, "start_gain"):
|
||||||
|
await run.set(gain=run.start_gain, thr=run.start_thr)
|
||||||
|
await asyncio.sleep(0.5)
|
||||||
|
await dev.refresh()
|
||||||
|
diffs = preset.differences(before, dev.state)
|
||||||
|
res["restored"] = not diffs
|
||||||
|
if diffs:
|
||||||
|
res["not_restored"] = diffs[:20]
|
||||||
|
finally:
|
||||||
|
await dev.stop()
|
||||||
|
|
||||||
|
res["error"] = error
|
||||||
|
res["polls"] = [[round(p["t"] - run.polls[0]["t"], 2), round(db(p["out"][run.o] ** 2), 1), round(db(sum(p["in"][i] ** 2 for i in run.ins)), 1),
|
||||||
|
int(p["limit"][run.o]), None if p["gain"] is None else P.gain_to_db(p["gain"]),
|
||||||
|
None if p["thr"] is None else P.threshold_to_db(p["thr"])] for p in run.polls] if run.ins else []
|
||||||
|
out = outdir / f"dsp-measure-{stamp}.json"
|
||||||
|
out.write_text(json.dumps(res), encoding="utf-8")
|
||||||
|
print("\nResult:", out)
|
||||||
|
for line in res.get("conclusions", []):
|
||||||
|
print(" *", line)
|
||||||
|
if error:
|
||||||
|
print(" ! Stopped:", error)
|
||||||
|
print(" * Settings restored:", "yes" if res["restored"] else f"NO, import the backup: {res.get('not_restored')}")
|
||||||
|
return 0 if res["restored"] and not error else 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
|
ap.add_argument("--usb", action="store_true", help="connect over USB")
|
||||||
|
ap.add_argument("--host", help="IP address of the DSP")
|
||||||
|
ap.add_argument("--port", type=int, default=P.PORT)
|
||||||
|
ap.add_argument("--model", default="auto", help="auto, 204 or 408")
|
||||||
|
ap.add_argument("--output", type=int, help="output number to use, default: the loudest one")
|
||||||
|
ap.add_argument("--dir", default=".", help="where to write the files")
|
||||||
|
a = ap.parse_args()
|
||||||
|
if not a.usb and not a.host:
|
||||||
|
ap.error("say --usb or --host")
|
||||||
|
sys.exit(asyncio.run(main(a)))
|
||||||