DJ Brake: use the offset measured on a real DSP 204
Measured: limiter threshold minus output meter is about 26 dB when the limiter starts (25.1 to 27.7, one DSP 204, one output, one piece of music), and the meter is after the output gain. So the distance is right before the first hit. The limiter flag also stayed on after raising a threshold, which would have taught a false value: only limiters starting by themselves teach now. The measuring tool no longer draws conclusions the data doesn't carry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4cd771eb5c
commit
63b3c17fb7
5 files changed
+106
-24
No files matched your search
@@ -261,6 +261,50 @@ def test_dj_brake_one_hit_counts_for_the_whole_dsp():
|
||||
assert abs(app.dj_rooms["x"] - 6) < 0.01
|
||||
|
||||
|
||||
def test_dj_brake_measured_offset():
|
||||
import server, tempfile
|
||||
from types import SimpleNamespace
|
||||
lv = lambda db: 10 ** (db / 20)
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
app = server.App(Path(d) / "c.json")
|
||||
app.save = lambda: None
|
||||
out = {"mute": False, "limit": {"threshold": 220}} # +20 dB
|
||||
dev = SimpleNamespace(id="x", demo=False, model_name="204", info="DSP204 V0104P", state={"outputs": [out]}, status="online")
|
||||
app.devices["x"] = dev
|
||||
note = lambda db, t, limit=False: app.dj_note({"device": "x", "out": [lv(db)], "limit": [limit]}, now=t)
|
||||
# measured: at +20 dB and a meter of -25 the limiter is about 19 dB away, before any hit
|
||||
note(-25, 100.0)
|
||||
assert app.dj_cal == {} and abs(app.dj_rooms["x"] - 19) < 0.01
|
||||
# the flag right after raising the threshold teaches nothing: seen on real hardware
|
||||
out["limit"]["threshold"] = 184
|
||||
note(-25, 110.0)
|
||||
out["limit"]["threshold"] = 220
|
||||
note(-25, 111.0, True)
|
||||
assert app.dj_cal == {}
|
||||
note(-25, 111.2)
|
||||
# a real hit moves the offset, it doesn't replace it
|
||||
out["limit"]["threshold"] = 180
|
||||
note(-20, 130.0)
|
||||
note(-20, 130.2, True)
|
||||
assert app.dj_cal == {} # that threshold has only just jumped
|
||||
note(-20, 140.0)
|
||||
note(-20, 140.2, True)
|
||||
assert abs(app.dj_cal["x"] - 24.5) < 0.01
|
||||
# it flickers: nothing new. And a jump of the threshold down teaches nothing either
|
||||
note(-30, 140.4)
|
||||
note(-30, 140.6, True)
|
||||
assert abs(app.dj_cal["x"] - 24.5) < 0.01
|
||||
out["limit"]["threshold"] = 160
|
||||
note(-30, 150.0)
|
||||
note(-30, 150.2, True)
|
||||
assert abs(app.dj_cal["x"] - 24.5) < 0.01
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
app = server.App(Path(d) / "c.json")
|
||||
for dev in (SimpleNamespace(id="s", demo=False, model_name="204", info="DSP204 V010 SIM"), SimpleNamespace(id="d", demo=True, model_name="204", info=""),
|
||||
SimpleNamespace(id="o", demo=False, model_name="408", info="DSP408 V0104P")):
|
||||
assert app.dj_offset(dev) == 0.0
|
||||
|
||||
|
||||
def test_reset_config():
|
||||
import asyncio, json, server, tempfile
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
|
||||
Reference in new issue
Block a user