DJ Brake: learn the limiter from its onset, for the whole DSP

Replaying real tracks through a limiter model showed the level during limiting
teaches little. One hit now counts for all outputs of a DSP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 21:24:32 +01:00
1 parent bbe8a73775
commit 6d467d4f2d
2 files changed
+32 -8

No files matched your search

+22 -2
View File
@@ -224,7 +224,7 @@ def test_dj_brake_follows_music():
assert 10 < app.dj_rooms["x"] < 14
# the limiter acts at -12 on the meter although the threshold says 0: learned, and the distance is true afterwards
note(-12, 110.0, True)
assert abs(app.dj_cal["x:0"] - 12) < 3 and app.dj_rooms["x"] == 0
assert abs(app.dj_cal["x"] - 12) < 3 and app.dj_rooms["x"] == 0
assert app.dj_hit == 110.0
for i in range(30):
note(-30, 120.0 + i)
@@ -238,7 +238,27 @@ def test_dj_brake_follows_music():
app.save()
again = server.App(Path(d) / "c.json")
again.load()
assert abs(again.dj_cal["x:0"] - app.dj_cal["x:0"]) < 0.01
assert abs(again.dj_cal["x"] - app.dj_cal["x"]) < 0.01
def test_dj_brake_one_hit_counts_for_the_whole_dsp():
import server, tempfile
from types import SimpleNamespace
with tempfile.TemporaryDirectory() as d:
app = server.App(Path(d) / "c.json")
out = {"mute": False, "limit": {"threshold": 180}}
app.devices["x"] = SimpleNamespace(id="x", demo=True, state={"outputs": [dict(out), dict(out)]}, status="online")
lv = lambda db: 10 ** (db / 20)
app.dj_ignore = {"x": [1]}
app.dj_note({"device": "x", "out": [lv(-12), lv(-40)], "limit": [True, False]}, now=100.0)
assert app.dj_cal == {"x": 12.0}
# the level the limiter leaves over while it keeps acting teaches nothing
app.dj_note({"device": "x", "out": [lv(-20), lv(-40)], "limit": [True, False]}, now=100.2)
assert app.dj_cal == {"x": 12.0}
# another output of this DSP has never limited, its distance is true anyway
app.dj_ignore = {"x": [0]}
app.dj_note({"device": "x", "out": [lv(-40), lv(-18)], "limit": [False, False]}, now=101.0)
assert abs(app.dj_rooms["x"] - 6) < 0.01
def test_reset_config():