Add phase view, channel overlays and PEQ/GEQ master bypass
- EQ curve computed as complex response: PEQ biquads (now incl. all-pass), crossover filters from Butterworth/Bessel/Linkwitz-Riley prototypes - Mag/Phase switch; phase wraps at +-180 degrees like the original software - overlay any other channel of the device in the curve (e.g. sub/top crossover) - EQ Bypass (0x3C) for all PEQ bands, GEQ Bypass (0x49) for the inputs, read from the bit masks at the end of the memory image; preset import aware Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
66f988cf08
commit
ae9a20fdf8
9 files changed
+213
-48
No files matched your search
@@ -25,6 +25,12 @@ 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
|
* **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),
|
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
|
lowers every output to −50 dB, flushes the queue and only then starts the generator (`0x39`); leaving switches the
|
||||||
@@ -91,6 +97,7 @@ Not verified yet – ask for a log (`python server.py -v`) from real hardware be
|
|||||||
* 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; where the number
|
* Where the PEQ bypass flag lives in the memory image; format of the set-command acknowledgement; where the number
|
||||||
of preset slots comes from (20 is assumed when the `0x2C` answer carries the lock state)
|
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
|
* 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)
|
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
|
* Device lock (`0x2C` byte 5, `0x2D`, `0x2F`, `0x11`) – implemented from the control software's behaviour and
|
||||||
|
|||||||
+5
-1
@@ -87,6 +87,8 @@ 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) |
|
| `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) |
|
||||||
|
|
||||||
@@ -170,7 +172,9 @@ Chunk `n` carries bytes `n·50 … n·50+49` of the device memory image.
|
|||||||
u16 input mute bit mask, u16 output mute bit mask
|
u16 input mute bit mask, u16 output mute bit mask
|
||||||
u16[nIn + nOut] unknown
|
u16[nIn + nOut] unknown
|
||||||
u16 test signal source, u16 test signal frequency index (see command 39)
|
u16 test signal source, u16 test signal frequency index (see command 39)
|
||||||
8 bytes unknown
|
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).
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ Control both devices at the same time from your phone, tablet or computer – ov
|
|||||||
* **Several devices at once** – switch with the tabs at the top; the model is detected automatically
|
* **Several devices at once** – switch with the tabs at the top; the model is detected automatically
|
||||||
* **Mixer** – faders, mute and live meters for all inputs and outputs, limiter LED on every output (status read
|
* **Mixer** – faders, mute and live meters for all inputs and outputs, limiter LED on every output (status read
|
||||||
from the DSP)
|
from the DSP)
|
||||||
* **Channel** – name, gain, delay, polarity, high/low pass, 8/9-band PEQ with a draggable curve
|
* **Channel** – name, gain, delay, polarity, high/low pass, 8/9-band PEQ with a draggable curve; the curve shows
|
||||||
* **Inputs** – noise gate, 31-band GEQ · **Outputs** – compressor, limiter, input routing with mix levels
|
magnitude or phase (crossover filters, all-pass filters) and can overlay any other channel, e.g. to line up a
|
||||||
|
sub/top crossover; **EQ Bypass** switches all PEQ bands off at once
|
||||||
|
* **Inputs** – noise gate, 31-band GEQ with **GEQ Bypass** · **Outputs** – compressor, limiter, input routing with mix levels
|
||||||
* **Routing matrix**, recall and store presets
|
* **Routing matrix**, recall and store presets
|
||||||
* **Channel links** – link channels into groups; the DSP mirrors changes within the group, the app shows them live
|
* **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
|
* **Preset files** – export the current DSP state to a file and import it again. An import only changes the active
|
||||||
|
|||||||
+4
-3
@@ -58,7 +58,7 @@ def _common(s: dict, c: dict) -> dict:
|
|||||||
"hp": _filter(s.get("hp"), c["hp"]), "lp": _filter(s.get("lp"), c["lp"]),
|
"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)))}
|
||||||
|
|
||||||
|
|
||||||
def clean_state(model: P.Model, src: dict, base: dict) -> dict:
|
def clean_state(model: P.Model, src: dict, base: dict) -> dict:
|
||||||
@@ -70,6 +70,7 @@ def clean_state(model: P.Model, src: dict, base: dict) -> dict:
|
|||||||
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),
|
||||||
|
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 {}
|
||||||
@@ -131,9 +132,9 @@ 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", "hp", "lp", "peq_bypass"] + [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 += [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 += ["comp", "limit", "matrix"] + [f"mix.{k}" for k in range(len(ch["mix"]))]
|
||||||
for p in params + ["mute"]:
|
for p in params + ["mute"]:
|
||||||
|
|||||||
+21
-4
@@ -25,6 +25,8 @@ CMD_PRESET_NAME = 0x29
|
|||||||
CMD_PRESET_COUNT = 0x2C # answer: [time lock][4 bytes time lock data][device lock] (see device_locked)
|
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_UNLOCK = 0x2D # [0][code 4] -> answer [0][1 = unlocked, 0 = wrong code]
|
||||||
CMD_SET_LOCK_CODE = 0x2F # [code 4]
|
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_TEST_SIGNAL = 0x39 # [source][freq index]: 0 = analog input, 1 = pink noise, 2 = white noise, 3 = sine
|
||||||
CMD_METER = 0x40
|
CMD_METER = 0x40
|
||||||
|
|
||||||
@@ -322,8 +324,12 @@ 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),
|
||||||
})
|
})
|
||||||
source, freq = struct.unpack_from("<HH", buf, model.test_base)
|
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}
|
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}
|
return {"preset_name": _name(buf[2:16]), "inputs": inputs, "outputs": outputs, "test": test}
|
||||||
|
|
||||||
|
|
||||||
@@ -369,7 +375,10 @@ def build_state_buffer(model: Model, state: dict) -> bytearray:
|
|||||||
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 {}
|
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("<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
|
||||||
|
|
||||||
|
|
||||||
@@ -382,14 +391,14 @@ 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},
|
"test": {"source": 0, "freq": 17},
|
||||||
}
|
}
|
||||||
@@ -474,6 +483,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])
|
||||||
@@ -522,7 +535,11 @@ 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 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])
|
||||||
|
|||||||
+137
-38
@@ -768,7 +768,14 @@ function viewMixer(d) {
|
|||||||
// ------------------------------------------------------------------ filter response (for the PEQ curve)
|
// ------------------------------------------------------------------ filter response (for the PEQ curve)
|
||||||
|
|
||||||
const FS = 96000;
|
const FS = 96000;
|
||||||
function biquadMag(type, f0, dbGain, q, f) {
|
// complex numbers as [re, im]
|
||||||
|
const cmul = (a, b) => [a[0] * b[0] - a[1] * b[1], a[0] * b[1] + a[1] * b[0]];
|
||||||
|
const cdiv = (a, b) => { const n = b[0] * b[0] + b[1] * b[1]; return [(a[0] * b[0] + a[1] * b[1]) / n, (a[1] * b[0] - a[0] * b[1]) / n]; };
|
||||||
|
const cdb = h => 10 * Math.log10(h[0] * h[0] + h[1] * h[1] || 1e-30);
|
||||||
|
const cdeg = h => Math.atan2(h[1], h[0]) * 180 / Math.PI;
|
||||||
|
|
||||||
|
// PEQ band as a digital biquad (RBJ cookbook), complex response at f
|
||||||
|
function biquadH(type, f0, dbGain, q, f) {
|
||||||
const A = Math.pow(10, dbGain / 40), w0 = 2 * Math.PI * f0 / FS, cs = Math.cos(w0), sn = Math.sin(w0);
|
const A = Math.pow(10, dbGain / 40), w0 = 2 * Math.PI * f0 / FS, cs = Math.cos(w0), sn = Math.sin(w0);
|
||||||
const alpha = sn / (2 * q);
|
const alpha = sn / (2 * q);
|
||||||
let b0, b1, b2, a0, a1, a2;
|
let b0, b1, b2, a0, a1, a2;
|
||||||
@@ -783,75 +790,155 @@ function biquadMag(type, f0, dbGain, q, f) {
|
|||||||
case 4: b0 = (1 + cs) / 2; b1 = -(1 + cs); b2 = (1 + cs) / 2; a0 = 1 + alpha; a1 = -2 * cs; a2 = 1 - alpha; break;
|
case 4: b0 = (1 + cs) / 2; b1 = -(1 + cs); b2 = (1 + cs) / 2; a0 = 1 + alpha; a1 = -2 * cs; a2 = 1 - alpha; break;
|
||||||
case 5: { const k = Math.tan(w0 / 2); b0 = k; b1 = k; b2 = 0; a0 = 1 + k; a1 = k - 1; a2 = 0; break; }
|
case 5: { const k = Math.tan(w0 / 2); b0 = k; b1 = k; b2 = 0; a0 = 1 + k; a1 = k - 1; a2 = 0; break; }
|
||||||
case 6: b0 = (1 - cs) / 2; b1 = 1 - cs; b2 = (1 - cs) / 2; a0 = 1 + alpha; a1 = -2 * cs; a2 = 1 - alpha; break;
|
case 6: b0 = (1 - cs) / 2; b1 = 1 - cs; b2 = (1 - cs) / 2; a0 = 1 + alpha; a1 = -2 * cs; a2 = 1 - alpha; break;
|
||||||
default: return 0;
|
case 7: { const k = Math.tan(w0 / 2), a = (k - 1) / (k + 1); b0 = a; b1 = 1; b2 = 0; a0 = 1; a1 = a; a2 = 0; break; } // allpass 1st order
|
||||||
|
case 8: b0 = 1 - alpha; b1 = -2 * cs; b2 = 1 + alpha; a0 = 1 + alpha; a1 = -2 * cs; a2 = 1 - alpha; break; // allpass 2nd order
|
||||||
|
default: return [1, 0];
|
||||||
}
|
}
|
||||||
const w = 2 * Math.PI * f / FS, c1 = Math.cos(w), s1 = Math.sin(w), c2 = Math.cos(2 * w), s2 = Math.sin(2 * w);
|
const w = 2 * Math.PI * f / FS, c1 = Math.cos(w), s1 = Math.sin(w), c2 = Math.cos(2 * w), s2 = Math.sin(2 * w);
|
||||||
const nr = b0 + b1 * c1 + b2 * c2, ni = -(b1 * s1 + b2 * s2), dr = a0 + a1 * c1 + a2 * c2, di = -(a1 * s1 + a2 * s2);
|
return cdiv([b0 + b1 * c1 + b2 * c2, -(b1 * s1 + b2 * s2)], [a0 + a1 * c1 + a2 * c2, -(a1 * s1 + a2 * s2)]);
|
||||||
return 10 * Math.log10((nr * nr + ni * ni) / (dr * dr + di * di));
|
|
||||||
}
|
}
|
||||||
function xoverMag(filter, f, high) {
|
|
||||||
if (!filter.slope) return 0;
|
// crossover filters from their analog prototypes (Butterworth, Bessel, Linkwitz-Riley = Butterworth squared)
|
||||||
const name = SLOPES[filter.slope], order = parseInt(name.split("-")[1], 10) / 6, fc = freqHz(filter.freq);
|
function butterworth(n, s) {
|
||||||
const r = high ? fc / f : f / fc;
|
let hh = [1, 0];
|
||||||
if (name.startsWith("LK")) return -20 * Math.log10(1 + Math.pow(r, order));
|
for (let k = 1; k <= n; k++) {
|
||||||
return -10 * Math.log10(1 + Math.pow(r, 2 * order));
|
const a = (2 * k - 1) * Math.PI / (2 * n), p = [-Math.sin(a), Math.cos(a)];
|
||||||
|
hh = cmul(hh, cdiv([-p[0], -p[1]], [s[0] - p[0], s[1] - p[1]]));
|
||||||
|
}
|
||||||
|
return hh;
|
||||||
|
}
|
||||||
|
const besselCache = {};
|
||||||
|
function bessel(n, s) {
|
||||||
|
let b = besselCache[n];
|
||||||
|
if (!b) { // reverse Bessel polynomial, frequency scaled to −3 dB at 1
|
||||||
|
const fact = k => k < 2 ? 1 : k * fact(k - 1);
|
||||||
|
const a = Array.from({ length: n + 1 }, (_, k) => fact(2 * n - k) / (2 ** (n - k) * fact(k) * fact(n - k)));
|
||||||
|
const at = (sc, x) => { let den = [0, 0], pw = [1, 0]; const z = cmul(x, [sc, 0]); for (const c of a) { den = [den[0] + c * pw[0], den[1] + c * pw[1]]; pw = cmul(pw, z); } return cdiv([a[0], 0], den); };
|
||||||
|
let lo = 0.1, hi = 10;
|
||||||
|
for (let i = 0; i < 60; i++) { const m = (lo + hi) / 2; cdb(at(m, [0, 1])) > -3.0103 ? (lo = m) : (hi = m); }
|
||||||
|
b = besselCache[n] = x => at((lo + hi) / 2, x);
|
||||||
|
}
|
||||||
|
return b(s);
|
||||||
|
}
|
||||||
|
function xoverH(filter, f, high) {
|
||||||
|
if (!filter.slope) return [1, 0];
|
||||||
|
const [kind, db] = SLOPES[filter.slope].split(" -"), n = +db / 6, x = f / freqHz(filter.freq);
|
||||||
|
const s = high ? [0, -1 / x] : [0, x]; // high pass: s -> 1/s
|
||||||
|
if (kind === "LK") { const b = butterworth(n / 2, s); return cmul(b, b); }
|
||||||
|
return kind === "BL" ? bessel(n, s) : butterworth(n, s);
|
||||||
|
}
|
||||||
|
const bandH = (b, f) => biquadH(b.type, freqHz(b.freq), eqDb(b.gain), Q_TABLE[b.q], f);
|
||||||
|
function channelH(ch, f) {
|
||||||
|
let hh = cmul(xoverH(ch.hp, f, true), xoverH(ch.lp, f, false));
|
||||||
|
if (!ch.peq_bypass) for (const b of ch.peq) if (!b.bypass) hh = cmul(hh, bandH(b, f));
|
||||||
|
return hh;
|
||||||
}
|
}
|
||||||
const hasGain = type => type <= 2;
|
const hasGain = type => type <= 2;
|
||||||
const hasQ = type => [0, 4, 6, 7, 8].includes(type);
|
const hasQ = type => [0, 4, 6, 7, 8].includes(type);
|
||||||
|
const OUT_COLORS = ["#f97316", "#facc15", "#4ade80", "#e879f9", "#60a5fa", "#fb7185", "#2dd4bf", "#c084fc"];
|
||||||
|
const chColor = (kind, i) => kind === "in" ? IN_COLORS[i] : OUT_COLORS[i];
|
||||||
|
|
||||||
function drawCurve(canvas, ch, selBand) {
|
// opts: { mode: "mag" | "phase", overlays: [{ ch, color }] }
|
||||||
|
function drawCurve(canvas, ch, selBand, opts = canvas.curveOpts ? canvas.curveOpts() : {}) {
|
||||||
const dpr = window.devicePixelRatio || 1, W = canvas.clientWidth, H = canvas.clientHeight;
|
const dpr = window.devicePixelRatio || 1, W = canvas.clientWidth, H = canvas.clientHeight;
|
||||||
if (!W || !H) return null;
|
if (!W || !H) return null;
|
||||||
canvas.width = W * dpr; canvas.height = H * dpr;
|
canvas.width = W * dpr; canvas.height = H * dpr;
|
||||||
const g = canvas.getContext("2d");
|
const g = canvas.getContext("2d");
|
||||||
g.scale(dpr, dpr);
|
g.scale(dpr, dpr);
|
||||||
|
const phase = opts.mode === "phase";
|
||||||
const fx = f => Math.log(f / 20) / Math.log(1000) * W;
|
const fx = f => Math.log(f / 20) / Math.log(1000) * W;
|
||||||
const dy = db => H / 2 - db / 15 * (H / 2 - 10);
|
const dy = db => H / 2 - db / 15 * (H / 2 - 10);
|
||||||
|
const py = deg => H / 2 - deg / 180 * (H / 2 - 10);
|
||||||
g.font = "10px system-ui"; g.fillStyle = "#5b6673"; g.lineWidth = 1;
|
g.font = "10px system-ui"; g.fillStyle = "#5b6673"; g.lineWidth = 1;
|
||||||
for (const f of [30, 50, 100, 200, 500, 1000, 2000, 5000, 10000]) {
|
for (const f of [30, 50, 100, 200, 500, 1000, 2000, 5000, 10000]) {
|
||||||
g.strokeStyle = [100, 1000, 10000].includes(f) ? "#252d37" : "#1a2028";
|
g.strokeStyle = [100, 1000, 10000].includes(f) ? "#252d37" : "#1a2028";
|
||||||
g.beginPath(); g.moveTo(fx(f), 0); g.lineTo(fx(f), H); g.stroke();
|
g.beginPath(); g.moveTo(fx(f), 0); g.lineTo(fx(f), H); g.stroke();
|
||||||
g.fillText(f >= 1000 ? f / 1000 + "k" : f, fx(f) + 3, H - 4);
|
g.fillText(f >= 1000 ? f / 1000 + "k" : f, fx(f) + 3, H - 4);
|
||||||
}
|
}
|
||||||
for (const db of [-12, -6, 0, 6, 12]) {
|
for (const v of phase ? [-180, -90, 0, 90, 180] : [-12, -6, 0, 6, 12]) {
|
||||||
g.strokeStyle = db === 0 ? "#3a4552" : "#1a2028";
|
const y = phase ? py(v) : dy(v);
|
||||||
g.beginPath(); g.moveTo(0, dy(db)); g.lineTo(W, dy(db)); g.stroke();
|
g.strokeStyle = v === 0 ? "#3a4552" : "#1a2028";
|
||||||
g.fillText((db > 0 ? "+" : "") + db, 3, dy(db) - 3);
|
g.beginPath(); g.moveTo(0, y); g.lineTo(W, y); g.stroke();
|
||||||
|
g.fillText((v > 0 ? "+" : "") + v + (phase ? "°" : ""), 3, y + (v === 180 ? 11 : -3));
|
||||||
}
|
}
|
||||||
const resp = f => {
|
const fAt = x => 20 * Math.pow(1000, x / W);
|
||||||
let s = xoverMag(ch.hp, f, true) + xoverMag(ch.lp, f, false);
|
// a curve as polyline segments; the phase wraps at ±180°, so it is broken there instead of drawing a jump
|
||||||
for (const b of ch.peq) if (!b.bypass) s += biquadMag(b.type, freqHz(b.freq), eqDb(b.gain), Q_TABLE[b.q], f);
|
const trace = hf => {
|
||||||
return s;
|
const segs = [[]];
|
||||||
|
let last = null;
|
||||||
|
for (let x = 0; x <= W; x += 2) {
|
||||||
|
const hh = hf(fAt(x));
|
||||||
|
if (phase) {
|
||||||
|
const deg = cdeg(hh);
|
||||||
|
if (last !== null && Math.abs(deg - last) > 180) segs.push([]);
|
||||||
|
last = deg;
|
||||||
|
segs[segs.length - 1].push([x, py(deg)]);
|
||||||
|
} else segs[0].push([x, clamp(dy(cdb(hh)), 0, H)]);
|
||||||
|
}
|
||||||
|
return segs;
|
||||||
};
|
};
|
||||||
// selected band's own contribution, filled
|
const stroke = (segs, color, width) => {
|
||||||
|
g.strokeStyle = color; g.lineWidth = width; g.lineJoin = "round";
|
||||||
|
for (const sg of segs) { g.beginPath(); sg.forEach(([x, y], i) => i ? g.lineTo(x, y) : g.moveTo(x, y)); g.stroke(); }
|
||||||
|
};
|
||||||
|
for (const o of opts.overlays || []) stroke(trace(f => channelH(o.ch, f)), o.color + "cc", 1.5);
|
||||||
const sb = ch.peq[selBand];
|
const sb = ch.peq[selBand];
|
||||||
if (sb && !sb.bypass) {
|
if (!phase && sb && !sb.bypass && !ch.peq_bypass) { // selected band's own contribution, filled
|
||||||
g.beginPath(); g.moveTo(0, dy(0));
|
g.beginPath(); g.moveTo(0, dy(0));
|
||||||
for (let x = 0; x <= W; x += 3) g.lineTo(x, clamp(dy(biquadMag(sb.type, freqHz(sb.freq), eqDb(sb.gain), Q_TABLE[sb.q], 20 * Math.pow(1000, x / W))), 0, H));
|
for (let x = 0; x <= W; x += 3) g.lineTo(x, clamp(dy(cdb(bandH(sb, fAt(x)))), 0, H));
|
||||||
g.lineTo(W, dy(0)); g.closePath(); g.fillStyle = "#f59e0b22"; g.fill();
|
g.lineTo(W, dy(0)); g.closePath(); g.fillStyle = "#f59e0b22"; g.fill();
|
||||||
}
|
}
|
||||||
const pts = [];
|
const segs = trace(f => channelH(ch, f));
|
||||||
for (let x = 0; x <= W; x += 2) pts.push([x, clamp(dy(resp(20 * Math.pow(1000, x / W))), 0, H)]);
|
if (!phase) {
|
||||||
g.beginPath(); g.moveTo(0, H); pts.forEach(([x, y]) => g.lineTo(x, y)); g.lineTo(W, H); g.closePath();
|
g.beginPath(); g.moveTo(0, H); segs[0].forEach(([x, y]) => g.lineTo(x, y)); g.lineTo(W, H); g.closePath();
|
||||||
const grad = g.createLinearGradient(0, 0, 0, H); grad.addColorStop(0, "#38bdf833"); grad.addColorStop(1, "#38bdf800");
|
const grad = g.createLinearGradient(0, 0, 0, H); grad.addColorStop(0, "#38bdf833"); grad.addColorStop(1, "#38bdf800");
|
||||||
g.fillStyle = grad; g.fill();
|
g.fillStyle = grad; g.fill();
|
||||||
g.strokeStyle = "#38bdf8"; g.lineWidth = 2; g.beginPath();
|
}
|
||||||
pts.forEach(([x, y], i) => i ? g.lineTo(x, y) : g.moveTo(x, y));
|
stroke(segs, "#38bdf8", 2);
|
||||||
g.stroke();
|
const off = !!ch.peq_bypass;
|
||||||
ch.peq.forEach((b, i) => {
|
ch.peq.forEach((b, i) => {
|
||||||
const x = fx(freqHz(b.freq)), y = dy(hasGain(b.type) ? eqDb(b.gain) : 0);
|
const x = fx(freqHz(b.freq)), y = phase || !hasGain(b.type) ? dy(0) : dy(eqDb(b.gain));
|
||||||
g.beginPath(); g.arc(x, y, i === selBand ? 10 : 7, 0, 2 * Math.PI);
|
g.beginPath(); g.arc(x, y, i === selBand ? 10 : 7, 0, 2 * Math.PI);
|
||||||
g.fillStyle = b.bypass ? "#2a333d" : i === selBand ? "#f59e0b" : "#38bdf8cc"; g.fill();
|
g.fillStyle = b.bypass || off ? "#2a333d" : i === selBand ? "#f59e0b" : "#38bdf8cc"; g.fill();
|
||||||
g.fillStyle = b.bypass ? "#6b7682" : "#0b0c0f"; g.font = "bold 10px system-ui"; g.textAlign = "center"; g.textBaseline = "middle";
|
g.fillStyle = b.bypass || off ? "#6b7682" : "#0b0c0f"; g.font = "bold 10px system-ui"; g.textAlign = "center"; g.textBaseline = "middle";
|
||||||
g.fillText(i + 1, x, y + 0.5); g.textAlign = "start"; g.textBaseline = "alphabetic";
|
g.fillText(i + 1, x, y + 0.5); g.textAlign = "start"; g.textBaseline = "alphabetic";
|
||||||
});
|
});
|
||||||
return { fx, dy, W, H };
|
if (off) { // master bypass: written across the curve
|
||||||
|
g.font = "bold 34px system-ui"; g.textAlign = "center"; g.textBaseline = "middle"; g.fillStyle = "#ef444499";
|
||||||
|
g.fillText("BYPASS", W / 2, H / 3); g.textAlign = "start"; g.textBaseline = "alphabetic";
|
||||||
|
}
|
||||||
|
return { fx, dy, W, H, phase };
|
||||||
|
}
|
||||||
|
|
||||||
|
// other channels drawn into the curve (per device, remembered in the browser)
|
||||||
|
const overlayKey = d => "dsp.overlay." + d.id;
|
||||||
|
const overlaySet = d => new Set((store.get(overlayKey(d)) || "").split(",").filter(Boolean));
|
||||||
|
function overlayChips(d, kind, idx, onChange) {
|
||||||
|
const sel = overlaySet(d);
|
||||||
|
const all = [...chans(d, "in").map((_, i) => ["in", i]), ...chans(d, "out").map((_, i) => ["out", i])]
|
||||||
|
.filter(([k, i]) => !(k === kind && i === idx));
|
||||||
|
return h("div", { class: "chips overlay" }, h("span", { class: "sub" }, t("Overlay")),
|
||||||
|
all.map(([k, i]) => {
|
||||||
|
const key = `${k}${i}`, on = sel.has(key);
|
||||||
|
return h("button", { class: "chip ov" + (on ? " on" : ""), style: `--oc:${chColor(k, i)}`, "aria-pressed": String(on),
|
||||||
|
title: chTitle(d, k, i),
|
||||||
|
onclick: () => { on ? sel.delete(key) : sel.add(key); store.set(overlayKey(d), [...sel].join(",")); onChange(); } },
|
||||||
|
h("i", {}), chLabel(k, i));
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
function overlaysFor(d, kind, idx) {
|
||||||
|
return [...overlaySet(d)].map(key => {
|
||||||
|
const k = key.startsWith("in") ? "in" : "out", i = +key.replace(/\D/g, "");
|
||||||
|
const list = chans(d, k);
|
||||||
|
return i < list.length && !(k === kind && i === idx) ? { ch: list[i], color: chColor(k, i) } : null;
|
||||||
|
}).filter(Boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
function peqCard(d, kind, idx) {
|
function peqCard(d, kind, idx) {
|
||||||
const ch = chans(d, kind)[idx];
|
const ch = chans(d, kind)[idx];
|
||||||
S.band = Math.min(S.band, ch.peq.length - 1);
|
S.band = Math.min(S.band, ch.peq.length - 1);
|
||||||
const canvas = h("canvas", { class: "curve", "aria-label": t("EQ curve – drag the points") });
|
const canvas = h("canvas", { class: "curve", "aria-label": t("EQ curve – drag the points") });
|
||||||
|
canvas.curveOpts = () => ({ mode: store.get("dsp.curve") === "phase" ? "phase" : "mag", overlays: overlaysFor(dev(), kind, idx) });
|
||||||
const redraw = () => drawCurve(canvas, chans(dev(), kind)[idx], S.band);
|
const redraw = () => drawCurve(canvas, chans(dev(), kind)[idx], S.band);
|
||||||
const body = h("div", { class: "bandparams" });
|
const body = h("div", { class: "bandparams" });
|
||||||
const bandBtns = h("div", { class: "bands", role: "tablist" });
|
const bandBtns = h("div", { class: "bands", role: "tablist" });
|
||||||
@@ -882,7 +969,7 @@ function peqCard(d, kind, idx) {
|
|||||||
let best = -1, bd = 1600;
|
let best = -1, bd = 1600;
|
||||||
c.peq.forEach((b, i) => {
|
c.peq.forEach((b, i) => {
|
||||||
const dx = geo.fx(freqHz(b.freq)) - (e.clientX - r.left);
|
const dx = geo.fx(freqHz(b.freq)) - (e.clientX - r.left);
|
||||||
const dyy = geo.dy(hasGain(b.type) ? eqDb(b.gain) : 0) - (e.clientY - r.top);
|
const dyy = geo.dy(hasGain(b.type) && !geo.phase ? eqDb(b.gain) : 0) - (e.clientY - r.top);
|
||||||
if (dx * dx + dyy * dyy < bd) { bd = dx * dx + dyy * dyy; best = i; }
|
if (dx * dx + dyy * dyy < bd) { bd = dx * dx + dyy * dyy; best = i; }
|
||||||
});
|
});
|
||||||
if (best < 0) return;
|
if (best < 0) return;
|
||||||
@@ -896,7 +983,7 @@ function peqCard(d, kind, idx) {
|
|||||||
const x = clamp(e.clientX - r.left, 0, geo.W);
|
const x = clamp(e.clientX - r.left, 0, geo.W);
|
||||||
const f = hzFreq(20 * Math.pow(1000, x / geo.W));
|
const f = hzFreq(20 * Math.pow(1000, x / geo.W));
|
||||||
if (f !== b.freq) setParam(kind, idx, `peq.${S.band}.freq`, f);
|
if (f !== b.freq) setParam(kind, idx, `peq.${S.band}.freq`, f);
|
||||||
if (hasGain(b.type)) {
|
if (hasGain(b.type) && !geo.phase) { // the phase view only moves the frequency
|
||||||
const db = (geo.H / 2 - (e.clientY - r.top)) / (geo.H / 2 - 10) * 15;
|
const db = (geo.H / 2 - (e.clientY - r.top)) / (geo.H / 2 - 10) * 15;
|
||||||
let g = clamp(Math.round(db * 10 + 120), 0, 240);
|
let g = clamp(Math.round(db * 10 + 120), 0, 240);
|
||||||
g = detent(g, 120, 300, geo.H - 20, 8);
|
g = detent(g, 120, 300, geo.H - 20, 8);
|
||||||
@@ -910,8 +997,16 @@ function peqCard(d, kind, idx) {
|
|||||||
renderBand();
|
renderBand();
|
||||||
requestAnimationFrame(redraw);
|
requestAnimationFrame(redraw);
|
||||||
new ResizeObserver(redraw).observe(canvas);
|
new ResizeObserver(redraw).observe(canvas);
|
||||||
return h("div", { class: "card wide" },
|
const modeSeg = h("div", { class: "seg small" });
|
||||||
h("h3", {}, h("span", { class: "grow" }, t("Parametric EQ")),
|
const setMode = m => {
|
||||||
|
store.set("dsp.curve", m);
|
||||||
|
modeSeg.replaceChildren(...[["mag", "Mag"], ["phase", t("Phase")]].map(([k, label]) =>
|
||||||
|
h("button", { class: (store.get("dsp.curve") || "mag") === k ? "on" : "", "data-view-ok": "", onclick: () => { setMode(k); redraw(); } }, label)));
|
||||||
|
};
|
||||||
|
setMode(store.get("dsp.curve") || "mag");
|
||||||
|
const card = h("div", { class: "card wide" + (ch.peq_bypass ? " eq-off" : "") },
|
||||||
|
h("h3", {}, h("span", { class: "grow" }, t("Parametric EQ")), modeSeg,
|
||||||
|
toggleBtn("EQ Bypass", kind, idx, "peq_bypass", "small bypass", v => { card.classList.toggle("eq-off", v); renderBand(); redraw(); }),
|
||||||
h("button", { class: "small", onclick: async () => {
|
h("button", { class: "small", onclick: async () => {
|
||||||
if (!await askConfirm(t("Reset EQ"), t("Set all PEQ bands of this channel to 0 dB and clear bypass?"), t("All flat"))) return;
|
if (!await askConfirm(t("Reset EQ"), t("Set all PEQ bands of this channel to 0 dB and clear bypass?"), t("All flat"))) return;
|
||||||
chans(dev(), kind)[idx].peq.forEach((bb, i) => {
|
chans(dev(), kind)[idx].peq.forEach((bb, i) => {
|
||||||
@@ -920,7 +1015,9 @@ function peqCard(d, kind, idx) {
|
|||||||
});
|
});
|
||||||
renderBand(); redraw(); toast(t("All bands flat"));
|
renderBand(); redraw(); toast(t("All bands flat"));
|
||||||
} }, t("All flat"))),
|
} }, t("All flat"))),
|
||||||
canvas, h("p", { class: "info" }, t("Drag the points in the curve · gain snaps at 0 dB")), bandBtns, body);
|
canvas, overlayChips(d, kind, idx, redraw),
|
||||||
|
h("p", { class: "info" }, t("Drag the points in the curve · gain snaps at 0 dB")), bandBtns, body);
|
||||||
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
function geqCard(d, idx) {
|
function geqCard(d, idx) {
|
||||||
@@ -934,14 +1031,16 @@ function geqCard(d, idx) {
|
|||||||
faders.push([f, lbl]);
|
faders.push([f, lbl]);
|
||||||
return h("div", { class: "gb" }, lbl, f, h("span", { class: "gf" }, GEQ_FREQS[b]));
|
return h("div", { class: "gb" }, lbl, f, h("span", { class: "gf" }, GEQ_FREQS[b]));
|
||||||
});
|
});
|
||||||
|
const geqBox = h("div", { class: "geq" + (ch.geq_bypass ? " bypassed" : "") }, bands);
|
||||||
return h("div", { class: "card wide" },
|
return h("div", { class: "card wide" },
|
||||||
h("h3", {}, h("span", { class: "grow" }, t("Graphic EQ · 31 bands")),
|
h("h3", {}, h("span", { class: "grow" }, t("Graphic EQ · 31 bands")),
|
||||||
|
toggleBtn("GEQ Bypass", "in", idx, "geq_bypass", "small bypass", v => geqBox.classList.toggle("bypassed", v)),
|
||||||
h("button", { class: "small", onclick: async () => {
|
h("button", { class: "small", onclick: async () => {
|
||||||
if (!await askConfirm(t("Reset GEQ"), t("Set all 31 bands to 0 dB?"), t("Reset"))) return;
|
if (!await askConfirm(t("Reset GEQ"), t("Set all 31 bands to 0 dB?"), t("Reset"))) return;
|
||||||
chans(dev(), "in")[idx].geq.forEach((g, b) => { if (g !== 120) setParam("in", idx, `geq.${b}`, 120); });
|
chans(dev(), "in")[idx].geq.forEach((g, b) => { if (g !== 120) setParam("in", idx, `geq.${b}`, 120); });
|
||||||
faders.forEach(([f, l]) => { f.setValue(120); l.textContent = "0.0"; l.classList.remove("nz"); });
|
faders.forEach(([f, l]) => { f.setValue(120); l.textContent = "0.0"; l.classList.remove("nz"); });
|
||||||
} }, t("All flat"))),
|
} }, t("All flat"))),
|
||||||
h("div", { class: "geq" }, bands),
|
geqBox,
|
||||||
h("p", { class: "info" }, t("Snaps at 0 dB · double-tap the knob = 0 dB")));
|
h("p", { class: "info" }, t("Snaps at 0 dB · double-tap the knob = 0 dB")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -340,6 +340,9 @@ const DE = {
|
|||||||
"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.",
|
"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 on – switch it off first": "Der Audiotest läuft – bitte zuerst beenden",
|
||||||
"Audio test is off": "Der Audiotest ist aus",
|
"Audio test is off": "Der Audiotest ist aus",
|
||||||
|
// curve
|
||||||
|
"Overlay": "Einblenden",
|
||||||
|
"Phase": "Phase",
|
||||||
};
|
};
|
||||||
|
|
||||||
const DE_PATTERNS = [
|
const DE_PATTERNS = [
|
||||||
|
|||||||
@@ -490,3 +490,19 @@ input.code { width: 7.5em; text-align: center; font-family: ui-monospace, Menlo,
|
|||||||
button.wide { width: 100%; margin-top: 14px; }
|
button.wide { width: 100%; margin-top: 14px; }
|
||||||
.tmeter button.mute { padding: 6px 8px; font-size: 11px; min-width: 52px; }
|
.tmeter button.mute { padding: 6px 8px; font-size: 11px; min-width: 52px; }
|
||||||
.tmeter.muted .led { opacity: .35; }
|
.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; }
|
||||||
@@ -149,6 +149,22 @@ def test_test_signal():
|
|||||||
assert st["test"] == {"source": 1, "freq": 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
|
||||||
|
|
||||||
|
|
||||||
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_"):
|
||||||
|
|||||||
Reference in new issue
Block a user