fix: _jack_is_operational() now creates throwaway JACK client instead of jack_lsp; standard profile period=512
CI / test (push) Has been cancelled

_jack_is_operational(): jack_lsp is unreliable on JACK 1.9.22 (returns 0
exit even when dead, and socket path varies). Instead, try creating a
real JACK.Client('_healthcheck') which is the definitive test — exactly
what jack_client.start() does. If the client connects, JACK is truly
operational.

Standard profile: period changed from 256 to 512. The NAM engine takes
2-5ms per inference at 256/48k (5.33ms window = 93% CPU). Any jitter
causes xruns (audible pops at ~1Hz). At 512/48k (10.67ms window), the
same inference takes 40-50% CPU with 5ms headroom — far more stable.
This commit is contained in:
2026-06-18 18:32:55 -04:00
parent 0cb044fb5e
commit bb9c835f98
+13 -13
View File
@@ -79,7 +79,7 @@ FOCUSRITE_PROFILES: dict[str, tuple[str, int, int]] = {
# 48 kHz / 64 frames = 1.33 ms buffer → aggressive, may xrun on RPi 4B # 48 kHz / 64 frames = 1.33 ms buffer → aggressive, may xrun on RPi 4B
LATENCY_PROFILES: dict[str, dict] = { LATENCY_PROFILES: dict[str, dict] = {
"standard": { "standard": {
"period": 256, "period": 512,
"nperiods": 2, "nperiods": 2,
"rate": 48000, "rate": 48000,
"rt_priority": 70, "rt_priority": 70,
@@ -873,20 +873,20 @@ def _jack_is_running() -> bool:
def _jack_is_operational() -> bool: def _jack_is_operational() -> bool:
"""Check if JACK is actually accepting client connections. """Check if JACK is actually accepting client connections.
Uses ``jack_lsp`` and checks stdout is non-empty (port names). Creates a temporary JACK client — this is the definitive test
``jack_lsp`` always exits 0 on JACK 1.9.22 even when dead — since it's exactly what ``jack_client.start()`` does. ``jack_lsp``
only stdout content distinguishes 'JACK running' from is unreliable on JACK 1.9.22 (returns 0 even when dead, and the
'JACK inaccessible'. server socket path may differ between versions).
The client is immediately deactivated and closed — it's throwaway.
""" """
try: try:
result = subprocess.run( import jack
["jack_lsp"], client = jack.Client("_healthcheck")
capture_output=True, timeout=3, client.deactivate()
) client.close()
# jack_lsp exits 0 even when dead on JACK 1.9.22 — return True
# only non-empty stdout means ports were actually listed except Exception:
return bool(result.stdout.strip())
except (FileNotFoundError, subprocess.TimeoutExpired):
return False return False