Make Move score gestures ensemble-aware
This commit is contained in:
parent
5838b57f06
commit
ca94ba1c6c
5 changed files with 234 additions and 65 deletions
|
|
@ -167,6 +167,10 @@ if (-not $SkipMoves) {
|
|||
"--out-dir", (Join-Path $runDir "move-sync"),
|
||||
"--device", "Realtek",
|
||||
"--asio-music-channels", "0,1,2,3",
|
||||
"--asio-music-source-name", "0=shotgun-mic",
|
||||
"--asio-music-source-name", "1=cardioid-mic",
|
||||
"--asio-music-source-name", "2=starfire-loopback-l",
|
||||
"--asio-music-source-name", "3=starfire-loopback-r-or-synth",
|
||||
"--asio-drain-blocks", "1024",
|
||||
"--fps", "$MoveFps",
|
||||
"--fft-size", "$MoveFftSize",
|
||||
|
|
@ -178,16 +182,19 @@ if (-not $SkipMoves) {
|
|||
"--loudness-floor", "0.006",
|
||||
"--loudness-exponent", "2.6",
|
||||
"--quiet-brightness", "0.0",
|
||||
"--max-brightness", "0.16",
|
||||
"--brightness-exponent", "1.2",
|
||||
"--max-brightness", "0.34",
|
||||
"--brightness-exponent", "0.88",
|
||||
"--score-subdivisions", "8",
|
||||
"--score-instrument-spacing", "3",
|
||||
"--score-release", "0.50",
|
||||
"--score-loudness-threshold", "0.97",
|
||||
"--score-min-loudness-gate", "0.18",
|
||||
"--score-loudness-exponent", "3.0",
|
||||
"--score-min-accent", "0.04",
|
||||
"--score-max-envelope", "0.40",
|
||||
"--score-instrument-spacing", "2",
|
||||
"--score-release", "0.68",
|
||||
"--score-loudness-threshold", "0.90",
|
||||
"--score-min-loudness-gate", "0.08",
|
||||
"--score-loudness-exponent", "1.8",
|
||||
"--score-min-accent", "0.025",
|
||||
"--score-max-envelope", "0.78",
|
||||
"--score-ensemble-loudness-threshold", "0.96",
|
||||
"--score-ensemble-min-loudness-gate", "0.25",
|
||||
"--score-ensemble-min-accent", "0.30",
|
||||
"--score-min-tempo-confidence", "0.0",
|
||||
"--debruijn-polyrhythm",
|
||||
"--harmonic-base", "1.5",
|
||||
|
|
|
|||
|
|
@ -1425,7 +1425,17 @@ internal sealed class MimirLiveStatsSnapshot
|
|||
|
||||
var envelopes = ArrayItems(TryGetAny(root, "score_gesture_envelopes")).Select(JsonNumber).DefaultIfEmpty(0.0).ToArray();
|
||||
var sources = ArrayItems(TryGetAny(root, "music_sources"))
|
||||
.Select(static source => $"{JsonStringAny(source, "source") ?? "source"} {JsonNumberAny(source, "bpm"):0.0}/{JsonNumberAny(source, "bpm_confidence"):0.00}")
|
||||
.Select(static source =>
|
||||
{
|
||||
var name = JsonStringAny(source, "source") ?? "source";
|
||||
var strength = JsonNumberAny(source, "score_strength", "onset", "hit", "loudness_gate");
|
||||
var key = JsonStringAny(source, "key_name") ?? "";
|
||||
var mode = JsonStringAny(source, "key_mode") ?? "";
|
||||
var harmonic = string.IsNullOrWhiteSpace(key)
|
||||
? $"f0 {JsonNumberAny(source, "fundamental_hz"):0}"
|
||||
: $"{key} {mode}".Trim();
|
||||
return $"{name} {JsonNumberAny(source, "bpm"):0.0}/{JsonNumberAny(source, "bpm_confidence"):0.00} s={strength:0.00} {harmonic}";
|
||||
})
|
||||
.ToArray();
|
||||
return new MimirMoveMusicStat(
|
||||
trace.FullName,
|
||||
|
|
|
|||
|
|
@ -339,3 +339,4 @@
|
|||
{"ts": "2026-06-01T21:27:15+01:00", "type": "implementation", "status": "partial", "note": "Added Mimir.Well as the long-running Starfire Well daemon and broad config/mimir-runtime.well.local.json. Live run online-verse-daemons-20260601-212502 started relay, recorder, Mimir.Well, music-synced de-Bruijn/microtonal Move gestures, and Nightwing witness PID 1116285. Recorder C:\\Users\\Meta\\Videos\\Mimir\\VerseCaptures\\20260601-212509 reached 292 records and included mimir.well_snapshot.v1, Nightwing builtin camera/mic witness records, and ps3-eye-0/1 Move observations. Well snapshots showed live Scarlett ASIO, Leap stereo IR, Kiyo Pro RGB, and Kiyo Basic RGB buffers; Raven and Eve lanes were configured but empty because their producers were not feeding. Sync frame remains degraded because ASIO device timestamps and camera driver timestamps are not yet mapped into one canonical timeline."}
|
||||
{"ts": "2026-06-01T21:41:07+01:00", "type": "decision", "status": "ok", "note": "2026-06-01 online Move music sync demoted spectral flux from brightness authority: Realtek loopback remains primary, optional Scarlett ASIO channels add auxiliary onset/tempo evidence, chroma estimates key/chord, and recent loudness percentile gates all Move brightness so quiet/steady-state music stays dark."}
|
||||
{"ts": "2026-06-01T22:09:13+01:00", "type": "implementation", "status": "ok", "note": "2026-06-01: online Move music sync now places visual gestures through a score scheduler instead of continuous envelope brightness; raw level/hit/flux/color are inputs, not RGB owners. Live score worker move-music-score-20260601-220807 showed max_env=0.4, max_rgb=4, and 9 lit frames in an 824-frame poll. Eve Live Stats now reads typed Well snapshots and latest Move score traces, exposing Well buffers/sync/probe, Leap/Eyes/Moves evidence, and Move music key/tempo/loudness/envelopes. AquaSynth Syrinx is identified as the correct Realtek voice target but is not yet wired into the live emitter."}
|
||||
{"ts": "2026-06-01T22:23:03+01:00", "type": "implementation", "status": "ok", "note": "2026-06-01: Move music worker now supports ensemble score accents so strong musical frames open every connected Move together while preserving per-controller hue/phase identity. Live per-source worker move-music-ensemble-20260601-222102 reported 134 lit frames and 88 all-Move-lit frames in a 1168-frame poll, max_env=0.78 max_rgb=86. ASIO music evidence is now split into per-channel OnlineAnalyzer score witnesses named shotgun-mic, cardioid-mic, starfire-loopback-l, and starfire-loopback-r-or-synth, alongside Realtek loopback; each source publishes tempo, strength, f0, chroma/key/chord evidence in music_sources. MIDI/AquaSynth is still observed as audio unless/until a typed MIDI score source is added."}
|
||||
|
|
|
|||
|
|
@ -237,10 +237,24 @@ invariants:
|
|||
`artifacts/runtime/move-music-score-20260601-220807/online-sync.jsonl`
|
||||
showed `max_env=0.4`, `max_rgb=4`, and only 9 lit frames in an 824-frame
|
||||
short-window poll, which is the intended conservative instrument behavior.
|
||||
AquaSynth Syrinx voices are the correct Realtek audio-signal target, but
|
||||
the live emitter is still the Mimir bioacoustic/Move script until the
|
||||
Realtek path is explicitly routed through AquaSynth.Faust/Syrinx patch
|
||||
compilation.
|
||||
The live 2026-06-01 follow-up made this less timid: strong score accents
|
||||
now open an ensemble gesture across every connected Move while preserving
|
||||
per-controller hue/phase identity, and the brightness cap/exponent/release
|
||||
are tuned for visible dance instead of near-black diagnostics. The current
|
||||
worker `artifacts/runtime/move-music-ensemble-20260601-222102/online-sync.jsonl`
|
||||
showed 134 lit frames and 88 all-Move-lit frames in a 1168-frame poll, with
|
||||
`max_env=0.78` and `max_rgb=86`.
|
||||
Score estimation now treats each configured audio stream as its own
|
||||
musical witness. Realtek loopback remains the primary program analyzer,
|
||||
while one native ASIO handle feeds per-channel `OnlineAnalyzer` instances
|
||||
named by the launcher (`shotgun-mic`, `cardioid-mic`,
|
||||
`starfire-loopback-l`, `starfire-loopback-r-or-synth`). Each source emits
|
||||
tempo confidence, onset/level/loudness strength, f0, chroma, key, and chord
|
||||
evidence into `music_sources`; the fused score chooses shared BPM/f0
|
||||
without erasing source-level evidence. AquaSynth Syrinx voices are the
|
||||
correct Realtek audio-signal target, and MIDI keyboard notes should later
|
||||
enter as an explicit typed score source, but today AquaSynth is observed
|
||||
through whatever audio channel carries its rendered voice.
|
||||
`tools/move_latency_probe.py` is the diagnostic PS Move latency receipt:
|
||||
PS3 Eyes are the default fast visual witnesses, Scarlett cardioid is the
|
||||
default chirp timing witness, and the event train uses an order-3 de Bruijn
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from __future__ import annotations
|
|||
import argparse
|
||||
import base64
|
||||
import colorsys
|
||||
import ctypes
|
||||
import json
|
||||
import math
|
||||
import errno
|
||||
|
|
@ -106,6 +107,16 @@ def parse_move(value: str) -> Move:
|
|||
return Move(name=name, hidraw=hidraw, base_rgb=rgb)
|
||||
|
||||
|
||||
def parse_channel_names(values: list[str] | None) -> dict[int, str]:
|
||||
names: dict[int, str] = {}
|
||||
for value in values or []:
|
||||
if not value:
|
||||
continue
|
||||
channel_text, name = value.split("=", 1)
|
||||
names[int(channel_text.strip())] = name.strip()
|
||||
return names
|
||||
|
||||
|
||||
def rgb_to_hsv01(rgb: tuple[int, int, int]) -> tuple[float, float, float]:
|
||||
return colorsys.rgb_to_hsv(rgb[0] / 255.0, rgb[1] / 255.0, rgb[2] / 255.0)
|
||||
|
||||
|
|
@ -365,9 +376,11 @@ class AuxiliaryOnsetStream:
|
|||
self.last_estimate_t = 0.0
|
||||
self.last_state: dict[str, object] = {
|
||||
"source": name,
|
||||
"role": "aux-audio",
|
||||
"hit": 0.0,
|
||||
"body": 0.0,
|
||||
"percentile": 0.0,
|
||||
"score_strength": 0.0,
|
||||
"fundamental_hz": 0.0,
|
||||
"bpm": self.bpm,
|
||||
"bpm_confidence": self.confidence,
|
||||
|
|
@ -390,10 +403,12 @@ class AuxiliaryOnsetStream:
|
|||
self.last_estimate_t = now
|
||||
self.last_state = {
|
||||
"source": self.name,
|
||||
"role": "aux-audio",
|
||||
"hit": float(hit),
|
||||
"body": float(body),
|
||||
"percentile": float(percentile),
|
||||
"onset": float(onset),
|
||||
"score_strength": max(float(hit), float(onset), float(body)),
|
||||
"fundamental_hz": float(fundamental_hz),
|
||||
"color_balance": tuple(float(value) for value in color_balance),
|
||||
"bpm": self.bpm,
|
||||
|
|
@ -423,9 +438,137 @@ class AuxiliaryOnsetStream:
|
|||
self.confidence = max(0.0, min(1.0, best_score))
|
||||
|
||||
|
||||
class MultiAsioScoreReader:
|
||||
def __init__(self, dll_path: str, clsid: str, sample_rate: int, channels: list[int], fps: float, fft_size: int, args: argparse.Namespace) -> None:
|
||||
self.channels = sorted(set(channels))
|
||||
self.args = args
|
||||
self.pending = {channel: [] for channel in self.channels}
|
||||
self.analyzers: dict[int, OnlineAnalyzer] = {}
|
||||
self.dll = ctypes.WinDLL(dll_path)
|
||||
self.dll.mimir_asio_create.argtypes = [
|
||||
ctypes.c_char_p,
|
||||
ctypes.c_double,
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
]
|
||||
self.dll.mimir_asio_create.restype = ctypes.c_void_p
|
||||
self.dll.mimir_asio_start.argtypes = [ctypes.c_void_p]
|
||||
self.dll.mimir_asio_start.restype = ctypes.c_int
|
||||
self.dll.mimir_asio_read.argtypes = [
|
||||
ctypes.c_void_p,
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
ctypes.POINTER(ctypes.c_longlong),
|
||||
ctypes.POINTER(ctypes.c_ulonglong),
|
||||
ctypes.POINTER(ctypes.c_int),
|
||||
ctypes.POINTER(ctypes.c_float),
|
||||
ctypes.c_int,
|
||||
]
|
||||
self.dll.mimir_asio_read.restype = ctypes.c_int
|
||||
self.dll.mimir_asio_destroy.argtypes = [ctypes.c_void_p]
|
||||
self.dll.mimir_asio_destroy.restype = None
|
||||
|
||||
actual_rate = ctypes.c_int()
|
||||
input_count = ctypes.c_int()
|
||||
max_frames = ctypes.c_int()
|
||||
self.handle = self.dll.mimir_asio_create(
|
||||
clsid.encode("utf-8"),
|
||||
float(sample_rate),
|
||||
ctypes.byref(actual_rate),
|
||||
ctypes.byref(input_count),
|
||||
ctypes.byref(max_frames),
|
||||
)
|
||||
if not self.handle:
|
||||
raise RuntimeError("Could not create Mimir ASIO capture source")
|
||||
self.sample_rate = int(actual_rate.value)
|
||||
self.input_count = int(input_count.value)
|
||||
self.max_frames = max(1, int(max_frames.value))
|
||||
self.buffer = (ctypes.c_float * self.max_frames)()
|
||||
if not self.dll.mimir_asio_start(self.handle):
|
||||
self.close()
|
||||
raise RuntimeError("Could not start Mimir ASIO capture source")
|
||||
self.analyzers = {channel: OnlineAnalyzer(self.sample_rate, fps, fft_size, args) for channel in self.channels}
|
||||
|
||||
def read_scores(self, deadline: float, drain_blocks: int, source_names: dict[int, str]) -> list[dict[str, object]]:
|
||||
channel = ctypes.c_int()
|
||||
timestamp_ns = ctypes.c_longlong()
|
||||
sequence = ctypes.c_ulonglong()
|
||||
frame_count = ctypes.c_int()
|
||||
reads = 0
|
||||
while reads < max(1, drain_blocks) and time.monotonic() < deadline:
|
||||
ok = self.dll.mimir_asio_read(
|
||||
self.handle,
|
||||
ctypes.byref(channel),
|
||||
ctypes.byref(timestamp_ns),
|
||||
ctypes.byref(sequence),
|
||||
ctypes.byref(frame_count),
|
||||
self.buffer,
|
||||
self.max_frames,
|
||||
)
|
||||
if not ok:
|
||||
time.sleep(0.001)
|
||||
continue
|
||||
reads += 1
|
||||
source_channel = int(channel.value)
|
||||
if source_channel not in self.pending:
|
||||
continue
|
||||
frames = max(0, min(int(frame_count.value), self.max_frames))
|
||||
if frames == 0:
|
||||
continue
|
||||
pending = self.pending[source_channel]
|
||||
pending.extend(float(self.buffer[index]) for index in range(frames))
|
||||
keep = self.args.fft_size * 8
|
||||
if len(pending) > keep:
|
||||
del pending[: len(pending) - keep]
|
||||
|
||||
now = time.monotonic()
|
||||
states: list[dict[str, object]] = []
|
||||
for source_channel in self.channels:
|
||||
pending = self.pending[source_channel]
|
||||
if len(pending) < self.args.fft_size:
|
||||
continue
|
||||
frame = np.asarray(pending[-self.args.fft_size :], dtype=np.float32)
|
||||
pending.clear()
|
||||
state = self.analyzers[source_channel].analyze(frame, now)
|
||||
strength = max(float(state["hit"]), float(state["loudness_gate"]), float(state["level"]))
|
||||
state.update(
|
||||
{
|
||||
"source": source_names.get(source_channel, f"scarlett-asio-ch{source_channel}"),
|
||||
"role": "audio-score-stream",
|
||||
"channel": source_channel,
|
||||
"score_strength": strength,
|
||||
}
|
||||
)
|
||||
states.append(state)
|
||||
return states
|
||||
|
||||
def close(self) -> None:
|
||||
if getattr(self, "handle", None):
|
||||
self.dll.mimir_asio_destroy(self.handle)
|
||||
self.handle = None
|
||||
|
||||
|
||||
def fuse_music_sources(primary: dict[str, object], source_states: list[dict[str, object]]) -> dict[str, object]:
|
||||
primary_source = {
|
||||
"source": "realtek-loopback",
|
||||
"role": "program-loopback",
|
||||
"bpm": primary["bpm"],
|
||||
"bpm_confidence": primary["bpm_confidence"],
|
||||
"hit": primary["hit"],
|
||||
"body": primary["body"],
|
||||
"loudness_gate": primary["loudness_gate"],
|
||||
"loudness_percentile": primary["loudness_percentile"],
|
||||
"fundamental_hz": primary["fundamental_hz"],
|
||||
"key_name": primary["key_name"],
|
||||
"key_mode": primary["key_mode"],
|
||||
"key_confidence": primary["key_confidence"],
|
||||
"chord_name": primary["chord_name"],
|
||||
"chord_confidence": primary["chord_confidence"],
|
||||
"score_strength": max(float(primary["hit"]), float(primary["loudness_gate"])),
|
||||
}
|
||||
if not source_states:
|
||||
primary["music_sources"] = [{"source": "realtek-loopback", "bpm": primary["bpm"], "bpm_confidence": primary["bpm_confidence"]}]
|
||||
primary["music_sources"] = [primary_source]
|
||||
primary["score_source_count"] = 1
|
||||
return primary
|
||||
weighted_bpm = float(primary["bpm"]) * (0.25 + float(primary["bpm_confidence"]))
|
||||
weight_sum = 0.25 + float(primary["bpm_confidence"])
|
||||
|
|
@ -443,10 +586,10 @@ def fuse_music_sources(primary: dict[str, object], source_states: list[dict[str,
|
|||
fundamental_weight = sum(weight for _, weight in fundamentals)
|
||||
if fundamental_weight > 1e-6:
|
||||
primary["fundamental_hz"] = sum(freq * weight for freq, weight in fundamentals) / fundamental_weight
|
||||
primary["music_sources"] = [
|
||||
{"source": "realtek-loopback", "bpm": primary["bpm"], "bpm_confidence": primary["bpm_confidence"]},
|
||||
*source_states,
|
||||
]
|
||||
primary_source["bpm"] = primary["bpm"]
|
||||
primary_source["bpm_confidence"] = primary["bpm_confidence"]
|
||||
primary["music_sources"] = [primary_source, *source_states]
|
||||
primary["score_source_count"] = len(primary["music_sources"])
|
||||
return primary
|
||||
|
||||
|
||||
|
|
@ -473,6 +616,11 @@ class ScoreGestureScheduler:
|
|||
loud_accent = max(0.0, min(1.0, (loudness_rank - self.args.score_loudness_threshold) / loud_span))
|
||||
rise_accent = max(loud_accent, loudness_gate)
|
||||
onset_accent = 0.5 + 0.5 * min(1.0, hit + loudness_gate * self.args.score_loudness_weight)
|
||||
ensemble_accent = (
|
||||
can_play
|
||||
and loudness_rank >= self.args.score_ensemble_loudness_threshold
|
||||
and loudness_gate >= self.args.score_ensemble_min_loudness_gate
|
||||
)
|
||||
for index in range(len(self.envelopes)):
|
||||
self.envelopes[index] *= self.args.score_release
|
||||
if slot == self.last_slots[index]:
|
||||
|
|
@ -480,12 +628,15 @@ class ScoreGestureScheduler:
|
|||
self.last_slots[index] = slot
|
||||
if not can_play:
|
||||
continue
|
||||
if not self._slot_belongs_to_instrument(slot, index):
|
||||
if not ensemble_accent and not self._slot_belongs_to_instrument(slot, index):
|
||||
continue
|
||||
accent = (rise_accent ** self.args.score_loudness_exponent) * onset_accent
|
||||
if ensemble_accent:
|
||||
accent = max(accent, self.args.score_ensemble_min_accent)
|
||||
if accent < self.args.score_min_accent:
|
||||
continue
|
||||
self.envelopes[index] = max(self.envelopes[index], min(self.args.score_max_envelope, accent))
|
||||
lane_scale = 1.0 if ensemble_accent else (0.72 + 0.28 * debruijn_accent(beat, index, self.args))
|
||||
self.envelopes[index] = max(self.envelopes[index], min(self.args.score_max_envelope, accent * lane_scale))
|
||||
return tuple(float(value) for value in self.envelopes)
|
||||
|
||||
def _slot_belongs_to_instrument(self, slot: int, move_index: int) -> bool:
|
||||
|
|
@ -527,7 +678,7 @@ def move_rgb(move: Move, move_index: int, move_count: int, state: dict[str, obje
|
|||
phase = (beat * harmonic * micro + move_index / max(1, move_count)) % 1.0
|
||||
poly = debruijn_accent(beat, move_index, args)
|
||||
gesture = poly * (0.42 + 0.58 * (0.5 + 0.5 * math.sin(2.0 * math.pi * phase)) ** 2.1)
|
||||
accent = min(1.0, score_envelope * loudness_gate * (level * gesture + hit * (0.22 + 0.08 * poly)))
|
||||
accent = min(1.0, score_envelope * max(0.35, loudness_gate) * (0.32 + level * gesture + hit * (0.22 + 0.08 * poly)))
|
||||
hue = (base_h + args.hue_bend * math.sin(2.0 * math.pi * phase) + math.log2(harmonic * micro) * 0.0833) % 1.0
|
||||
chord_confidence = float(state.get("chord_confidence", 0.0))
|
||||
chord_root = int(state.get("chord_root", 0))
|
||||
|
|
@ -572,6 +723,7 @@ def main() -> int:
|
|||
parser.add_argument("--asio-dll", default=str(Path(__file__).resolve().parents[1] / "native" / "asio_capture" / "build" / "Release" / "mimir_asio_capture.dll"))
|
||||
parser.add_argument("--asio-clsid", default="{AC4D0455-50D7-4498-B3CD-9A41D130B759}")
|
||||
parser.add_argument("--asio-music-channels", default="", help="Optional comma-separated Scarlett ASIO channels to fold into music evidence.")
|
||||
parser.add_argument("--asio-music-source-name", action="append", default=[], help="Optional ASIO channel source label, as channel=name.")
|
||||
parser.add_argument("--asio-drain-blocks", type=int, default=1024)
|
||||
parser.add_argument("--fps", type=float, default=60.0)
|
||||
parser.add_argument("--fft-size", type=int, default=512)
|
||||
|
|
@ -586,17 +738,20 @@ def main() -> int:
|
|||
parser.add_argument("--loudness-floor", type=float, default=0.006)
|
||||
parser.add_argument("--loudness-exponent", type=float, default=2.4)
|
||||
parser.add_argument("--quiet-brightness", type=float, default=0.0)
|
||||
parser.add_argument("--max-brightness", type=float, default=0.18)
|
||||
parser.add_argument("--brightness-exponent", type=float, default=1.15)
|
||||
parser.add_argument("--max-brightness", type=float, default=0.34)
|
||||
parser.add_argument("--brightness-exponent", type=float, default=0.88)
|
||||
parser.add_argument("--score-subdivisions", type=int, default=8)
|
||||
parser.add_argument("--score-instrument-spacing", type=int, default=3)
|
||||
parser.add_argument("--score-release", type=float, default=0.54)
|
||||
parser.add_argument("--score-loudness-threshold", type=float, default=0.965)
|
||||
parser.add_argument("--score-min-loudness-gate", type=float, default=0.16)
|
||||
parser.add_argument("--score-loudness-exponent", type=float, default=2.8)
|
||||
parser.add_argument("--score-instrument-spacing", type=int, default=2)
|
||||
parser.add_argument("--score-release", type=float, default=0.68)
|
||||
parser.add_argument("--score-loudness-threshold", type=float, default=0.90)
|
||||
parser.add_argument("--score-min-loudness-gate", type=float, default=0.08)
|
||||
parser.add_argument("--score-loudness-exponent", type=float, default=1.8)
|
||||
parser.add_argument("--score-loudness-weight", type=float, default=0.28)
|
||||
parser.add_argument("--score-min-accent", type=float, default=0.035)
|
||||
parser.add_argument("--score-max-envelope", type=float, default=0.45)
|
||||
parser.add_argument("--score-min-accent", type=float, default=0.025)
|
||||
parser.add_argument("--score-max-envelope", type=float, default=0.78)
|
||||
parser.add_argument("--score-ensemble-loudness-threshold", type=float, default=0.96)
|
||||
parser.add_argument("--score-ensemble-min-loudness-gate", type=float, default=0.25)
|
||||
parser.add_argument("--score-ensemble-min-accent", type=float, default=0.30)
|
||||
parser.add_argument("--score-min-tempo-confidence", type=float, default=0.0)
|
||||
parser.add_argument("--onset-decay", type=float, default=0.18)
|
||||
parser.add_argument("--onset-threshold", type=float, default=0.62)
|
||||
|
|
@ -664,20 +819,19 @@ def main() -> int:
|
|||
analyzer = OnlineAnalyzer(args.sample_rate, args.fps, args.fft_size, args)
|
||||
score_scheduler = ScoreGestureScheduler(len(moves), args)
|
||||
asio_reader = None
|
||||
asio_tracker = None
|
||||
asio_source_names = parse_channel_names(args.asio_music_source_name)
|
||||
if args.asio_music_channels.strip():
|
||||
if AsioOnsetReader is None:
|
||||
print("asio-music disabled: nightwing_psmove_music_pulse.AsioOnsetReader is unavailable", file=sys.stderr, flush=True)
|
||||
else:
|
||||
try:
|
||||
asio_channels = {int(part.strip()) for part in args.asio_music_channels.split(",") if part.strip()}
|
||||
asio_reader = AsioOnsetReader(args.asio_dll, args.asio_clsid, args.sample_rate, asio_channels, args.fft_size)
|
||||
asio_tracker = AuxiliaryOnsetStream("scarlett-asio", args.fps, args)
|
||||
print(f"asio-music enabled channels={sorted(asio_channels)}", file=sys.stderr, flush=True)
|
||||
except Exception as ex:
|
||||
print(f"asio-music disabled: {ex}", file=sys.stderr, flush=True)
|
||||
asio_reader = None
|
||||
asio_tracker = None
|
||||
try:
|
||||
asio_channels = [int(part.strip()) for part in args.asio_music_channels.split(",") if part.strip()]
|
||||
asio_reader = MultiAsioScoreReader(args.asio_dll, args.asio_clsid, args.sample_rate, asio_channels, args.fps, args.fft_size, args)
|
||||
print(
|
||||
f"asio-music enabled channels={asio_reader.channels} sampleRate={asio_reader.sample_rate} inputs={asio_reader.input_count}",
|
||||
file=sys.stderr,
|
||||
flush=True,
|
||||
)
|
||||
except Exception as ex:
|
||||
print(f"asio-music disabled: {ex}", file=sys.stderr, flush=True)
|
||||
asio_reader = None
|
||||
frame_samples = max(args.fft_size, int(args.sample_rate / args.fps))
|
||||
frame_bytes = frame_samples * args.channels * 4
|
||||
trace_path = out_dir / "online-sync.jsonl"
|
||||
|
|
@ -694,29 +848,13 @@ def main() -> int:
|
|||
now = time.monotonic()
|
||||
state = analyzer.analyze(mono, now)
|
||||
auxiliary_states: list[dict[str, object]] = []
|
||||
if asio_reader is not None and asio_tracker is not None:
|
||||
if asio_reader is not None:
|
||||
try:
|
||||
asio_result = asio_reader.read_onset(
|
||||
floor=args.loudness_floor,
|
||||
gain=1.0,
|
||||
auxiliary_states.extend(asio_reader.read_scores(
|
||||
deadline=time.monotonic() + (0.35 / args.fps),
|
||||
whiten_fast=args.whiten_fast,
|
||||
whiten_slow=args.whiten_slow,
|
||||
whiten_delta_fast=args.whiten_delta_fast,
|
||||
whiten_delta_slow=args.whiten_delta_slow,
|
||||
whiten_decay=args.whiten_decay,
|
||||
whiten_contrast=args.whiten_contrast,
|
||||
fundamental_min=args.fundamental_min,
|
||||
fundamental_max=args.fundamental_max,
|
||||
onset_percentile_threshold=0.0,
|
||||
onset_exponent=args.onset_exponent,
|
||||
onset_history_ms=args.onset_history_seconds * 1000.0,
|
||||
onset_cooldown_ms=args.onset_cooldown_seconds * 1000.0,
|
||||
warmup_ms=args.warmup_seconds * 1000.0,
|
||||
drain_blocks=args.asio_drain_blocks,
|
||||
)
|
||||
if asio_result is not None:
|
||||
auxiliary_states.append(asio_tracker.update(now, *asio_result))
|
||||
source_names=asio_source_names,
|
||||
))
|
||||
except Exception as ex:
|
||||
print(f"asio-music disabled during read: {ex}", file=sys.stderr, flush=True)
|
||||
try:
|
||||
|
|
@ -724,7 +862,6 @@ def main() -> int:
|
|||
except Exception:
|
||||
pass
|
||||
asio_reader = None
|
||||
asio_tracker = None
|
||||
state = fuse_music_sources(state, auxiliary_states)
|
||||
state["score_gesture_envelopes"] = score_scheduler.update(state)
|
||||
rgbs = {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue