micforge 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- micforge/__init__.py +3 -0
- micforge/__main__.py +4 -0
- micforge/analysis/__init__.py +0 -0
- micforge/analysis/stats.py +133 -0
- micforge/audio/__init__.py +0 -0
- micforge/audio/backend.py +32 -0
- micforge/audio/cues.py +110 -0
- micforge/audio/device_watch.py +237 -0
- micforge/audio/devices.py +160 -0
- micforge/audio/engine.py +746 -0
- micforge/audio/fileio.py +45 -0
- micforge/audio/latency.py +169 -0
- micforge/audio/loopback.py +113 -0
- micforge/audio/metrics.py +134 -0
- micforge/audio/noise_profile.py +250 -0
- micforge/audio/recorder.py +100 -0
- micforge/audio/ring.py +89 -0
- micforge/cli.py +293 -0
- micforge/commands/__init__.py +0 -0
- micforge/commands/calibrate.py +47 -0
- micforge/commands/common.py +69 -0
- micforge/commands/devices_cmd.py +86 -0
- micforge/commands/diagnostics_cmd.py +68 -0
- micforge/commands/doctor.py +127 -0
- micforge/commands/files.py +48 -0
- micforge/commands/help_cmd.py +449 -0
- micforge/commands/latency_test.py +65 -0
- micforge/commands/live.py +321 -0
- micforge/commands/preset_cmd.py +142 -0
- micforge/commands/test_mic.py +98 -0
- micforge/commands/wizard.py +70 -0
- micforge/config.py +279 -0
- micforge/diagnostics.py +308 -0
- micforge/dsp/__init__.py +0 -0
- micforge/dsp/aec.py +388 -0
- micforge/dsp/base.py +30 -0
- micforge/dsp/biquad.py +144 -0
- micforge/dsp/chain.py +153 -0
- micforge/dsp/cofilite.py +427 -0
- micforge/dsp/compressor.py +109 -0
- micforge/dsp/deesser.py +64 -0
- micforge/dsp/denoise.py +181 -0
- micforge/dsp/deverb.py +227 -0
- micforge/dsp/export_cofilite.py +111 -0
- micforge/dsp/gate.py +76 -0
- micforge/dsp/leveler.py +74 -0
- micforge/dsp/proximity.py +164 -0
- micforge/dsp/util.py +80 -0
- micforge/errors.py +25 -0
- micforge/logging_setup.py +25 -0
- micforge/models/cofilite.onnx +0 -0
- micforge/presets.py +284 -0
- micforge/profile_store.py +41 -0
- micforge/ui/__init__.py +0 -0
- micforge/ui/dashboard.py +573 -0
- micforge/ui/hotkeys.py +169 -0
- micforge/ui/keys.py +64 -0
- micforge/ui/report.py +88 -0
- micforge/ui/settings_gui.py +899 -0
- micforge/ui/theme.py +42 -0
- micforge/ui/tray.py +276 -0
- micforge/ui/tuning.py +138 -0
- micforge/ui/widgets.py +109 -0
- micforge/util/autostart.py +56 -0
- micforge-1.3.0.dist-info/METADATA +334 -0
- micforge-1.3.0.dist-info/RECORD +70 -0
- micforge-1.3.0.dist-info/WHEEL +5 -0
- micforge-1.3.0.dist-info/entry_points.txt +2 -0
- micforge-1.3.0.dist-info/licenses/LICENSE +22 -0
- micforge-1.3.0.dist-info/top_level.txt +1 -0
micforge/ui/dashboard.py
ADDED
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
"""Live dashboard renderer: pure function of (snapshot, context, width)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import time
|
|
5
|
+
from dataclasses import dataclass, field
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
from rich import box
|
|
9
|
+
from rich.console import Group, RenderableType
|
|
10
|
+
from rich.panel import Panel
|
|
11
|
+
from rich.table import Table
|
|
12
|
+
from rich.text import Text
|
|
13
|
+
|
|
14
|
+
from .. import __version__
|
|
15
|
+
from ..audio.engine import EngineSnapshot
|
|
16
|
+
from .widgets import fmt_db, freq_axis, level_bar, load_bar, reduction_bar, spectrum_rows
|
|
17
|
+
|
|
18
|
+
BLOCKS = " ▁▂▃▄▅▆▇█"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_process_ram_mb() -> float:
|
|
22
|
+
"""Read process RAM working set safely via psutil."""
|
|
23
|
+
try:
|
|
24
|
+
import psutil
|
|
25
|
+
return psutil.Process().memory_info().rss / (1024.0 * 1024.0)
|
|
26
|
+
except Exception:
|
|
27
|
+
return 0.0
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def format_uptime(start_time: float, now: float) -> str:
|
|
31
|
+
"""Format elapsed session time into human readable string."""
|
|
32
|
+
elapsed = max(0, int(now - start_time))
|
|
33
|
+
hours, rem = divmod(elapsed, 3600)
|
|
34
|
+
mins, secs = divmod(rem, 60)
|
|
35
|
+
if hours > 0:
|
|
36
|
+
return f"{hours:02d}h {mins:02d}m {secs:02d}s"
|
|
37
|
+
return f"{mins:02d}m {secs:02d}s"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass
|
|
41
|
+
class LiveContext:
|
|
42
|
+
title: str = "MIC ENHANCER"
|
|
43
|
+
preset: str = "discord"
|
|
44
|
+
input_name: str = ""
|
|
45
|
+
cable_name: str | None = None
|
|
46
|
+
monitor_name: str | None = None
|
|
47
|
+
sample_rate: int = 48000
|
|
48
|
+
block_size: int = 480
|
|
49
|
+
message: str = ""
|
|
50
|
+
message_until: float = 0.0
|
|
51
|
+
centers: tuple[float, float] = (60.0, 16000.0)
|
|
52
|
+
n_bands: int = 32
|
|
53
|
+
has_profile: bool = False
|
|
54
|
+
keys: list[tuple[str, str]] = field(default_factory=list)
|
|
55
|
+
start_time: float = field(default_factory=time.monotonic)
|
|
56
|
+
hud_mode: bool = False # Toggle between Studio Inspector and Gamer HUD
|
|
57
|
+
show_help: bool = False # Toggle full hotkey cheatsheet overlay
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _status(snap: EngineSnapshot) -> Text:
|
|
61
|
+
t = Text()
|
|
62
|
+
if snap.muted:
|
|
63
|
+
t.append(" ■ MUTED ", style="bold white on red")
|
|
64
|
+
elif snap.bypass:
|
|
65
|
+
t.append(" ◌ BYPASS (raw mic) ", style="bold black on yellow")
|
|
66
|
+
else:
|
|
67
|
+
t.append(" ● PROCESSED ", style="bold black on green")
|
|
68
|
+
if snap.monitor_on:
|
|
69
|
+
t.append(" ")
|
|
70
|
+
t.append(" 🎧 MONITOR ", style="bold black on cyan")
|
|
71
|
+
return t
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _pipeline_ribbon(snap: EngineSnapshot) -> Text:
|
|
75
|
+
"""Render a sleek, single-line broadcast DSP rack ribbon that never wraps."""
|
|
76
|
+
tel = snap.telemetry
|
|
77
|
+
t = Text()
|
|
78
|
+
t.append("Rack: ", style="grey50")
|
|
79
|
+
|
|
80
|
+
stages = [
|
|
81
|
+
("HPF", True),
|
|
82
|
+
("AEC", "aec" in tel and tel["aec"].get("enabled", 1.0) > 0.5),
|
|
83
|
+
("AI", "denoise" in tel and tel["denoise"].get("enabled", 1.0) > 0.5),
|
|
84
|
+
("VERB", "deverb" in tel and tel["deverb"].get("enabled", 1.0) > 0.5),
|
|
85
|
+
("GATE", "gate" in tel and tel["gate"].get("enabled", 1.0) > 0.5),
|
|
86
|
+
("BODY", "proximity" in tel and tel["proximity"].get("enabled", 1.0) > 0.5),
|
|
87
|
+
("EQ", True),
|
|
88
|
+
("DEESS", "deesser" in tel and tel["deesser"].get("enabled", 1.0) > 0.5),
|
|
89
|
+
("LVL", "leveler" in tel and tel["leveler"].get("enabled", 1.0) > 0.5),
|
|
90
|
+
("COMP", "compressor" in tel and tel["compressor"].get("enabled", 1.0) > 0.5),
|
|
91
|
+
("LIM", "limiter" in tel and tel["limiter"].get("enabled", 1.0) > 0.5),
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
for i, (name, is_on) in enumerate(stages):
|
|
95
|
+
if not is_on:
|
|
96
|
+
t.append(f"{name}·", style="grey37")
|
|
97
|
+
elif name == "AI" and tel.get("denoise", {}).get("napping", 0) > 0.5:
|
|
98
|
+
t.append(f"{name}💤", style="dim cyan")
|
|
99
|
+
elif name == "GATE" and tel.get("gate", {}).get("open", 0) <= 0.5:
|
|
100
|
+
t.append(f"{name}·", style="grey50")
|
|
101
|
+
else:
|
|
102
|
+
t.append(f"{name}●", style="bold green" if name == "AI" else "cyan")
|
|
103
|
+
|
|
104
|
+
if i < len(stages) - 1:
|
|
105
|
+
t.append(" ", style="grey23")
|
|
106
|
+
return t
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _meters(snap: EngineSnapshot, width: int) -> Table:
|
|
110
|
+
"""Render IN, OUT, and AEC REF meters with target sweet-spot indications."""
|
|
111
|
+
bar_w = max(14, width - 36)
|
|
112
|
+
tbl = Table.grid(padding=(0, 1))
|
|
113
|
+
tbl.add_column(width=4, style="bold")
|
|
114
|
+
tbl.add_column(width=bar_w)
|
|
115
|
+
tbl.add_column(width=10, justify="right")
|
|
116
|
+
tbl.add_column(width=16)
|
|
117
|
+
|
|
118
|
+
# 1. Input Level
|
|
119
|
+
clip_in = Text("CLIP", style="bold white on red") if snap.in_level.clipping else Text("")
|
|
120
|
+
tbl.add_row(
|
|
121
|
+
"IN",
|
|
122
|
+
level_bar(snap.in_level.peak_db, snap.in_level.hold_db, bar_w),
|
|
123
|
+
Text(f"{fmt_db(snap.in_level.peak_db)} dB"),
|
|
124
|
+
clip_in,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
# 2. Output Level with Target Sweet-Spot Indicator
|
|
128
|
+
out_db = snap.out_level.peak_db
|
|
129
|
+
if snap.out_level.clipping:
|
|
130
|
+
target_badge = Text("CLIP", style="bold white on red")
|
|
131
|
+
elif -24.0 <= out_db <= -10.0:
|
|
132
|
+
target_badge = Text("[SWEET SPOT]", style="bold green")
|
|
133
|
+
elif out_db > -10.0:
|
|
134
|
+
target_badge = Text("[HOT / PEAK]", style="bold yellow")
|
|
135
|
+
else:
|
|
136
|
+
target_badge = Text("")
|
|
137
|
+
|
|
138
|
+
tbl.add_row(
|
|
139
|
+
"OUT",
|
|
140
|
+
level_bar(out_db, snap.out_level.hold_db, bar_w),
|
|
141
|
+
Text(f"{fmt_db(out_db)} dB"),
|
|
142
|
+
target_badge,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
# 3. Far-End Reference Stream Monitor (AEC speaker/game loopback)
|
|
146
|
+
aec_active = ("aec" in snap.telemetry and snap.telemetry["aec"].get("enabled", 1.0) > 0.5)
|
|
147
|
+
if aec_active and snap.ref_level is not None:
|
|
148
|
+
ref_db = snap.ref_level.peak_db
|
|
149
|
+
if ref_db <= -80.0:
|
|
150
|
+
ref_text = " silent"
|
|
151
|
+
ref_badge = Text("(Clean / Headphones)", style="dim green")
|
|
152
|
+
elif ref_db > -55.0:
|
|
153
|
+
ref_text = f"{fmt_db(ref_db)} dB"
|
|
154
|
+
ref_badge = Text("(Speaker Bleed Captured)", style="bold cyan")
|
|
155
|
+
else:
|
|
156
|
+
ref_text = f"{fmt_db(ref_db)} dB"
|
|
157
|
+
ref_badge = Text("(Speaker Active)", style="dim cyan")
|
|
158
|
+
|
|
159
|
+
tbl.add_row(
|
|
160
|
+
"REF",
|
|
161
|
+
level_bar(ref_db, snap.ref_level.hold_db, bar_w),
|
|
162
|
+
Text(ref_text, style="grey50" if ref_db <= -80.0 else "white"),
|
|
163
|
+
ref_badge,
|
|
164
|
+
)
|
|
165
|
+
return tbl
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _reductions(snap: EngineSnapshot, width: int) -> Table:
|
|
169
|
+
"""Render processing reductions cleanly, hiding idle stages to eliminate clutter."""
|
|
170
|
+
bar_w = max(10, min(26, (width - 36) // 2))
|
|
171
|
+
tel = snap.telemetry
|
|
172
|
+
tbl = Table.grid(padding=(0, 1))
|
|
173
|
+
tbl.add_column(width=8, style="grey70")
|
|
174
|
+
tbl.add_column(width=bar_w)
|
|
175
|
+
tbl.add_column(width=10, justify="right")
|
|
176
|
+
|
|
177
|
+
# 1. AI Noise Suppression (always shown)
|
|
178
|
+
if "denoise" in tel:
|
|
179
|
+
if tel["denoise"].get("napping", 0.0) > 0.5:
|
|
180
|
+
tbl.add_row("noise", Text("💤 IDLE NAP (0% CPU)".ljust(bar_w), style="dim cyan"), "-40 dB")
|
|
181
|
+
else:
|
|
182
|
+
v = abs(tel["denoise"].get("reduction_db", 0.0))
|
|
183
|
+
tbl.add_row("noise", reduction_bar(v, bar_w, 28.0, "magenta"), f"-{v:4.1f} dB")
|
|
184
|
+
|
|
185
|
+
# 2. Gate (always shown)
|
|
186
|
+
gate = tel.get("gate")
|
|
187
|
+
if gate is not None:
|
|
188
|
+
is_open = gate.get("open", 0.0) > 0.5
|
|
189
|
+
state = Text("OPEN ", style="bold green") if is_open else Text("closed", style="grey50")
|
|
190
|
+
g_gain = abs(gate.get("gain_db", 0.0))
|
|
191
|
+
tbl.add_row("gate", state, f"-{g_gain:4.1f} dB" if not is_open else " 0.0 dB")
|
|
192
|
+
|
|
193
|
+
# 3. Room De-Verb (only shown if actively reducing > 0.5 dB)
|
|
194
|
+
if "deverb" in tel:
|
|
195
|
+
v = abs(tel["deverb"].get("reverb_reduction_db", 0.0))
|
|
196
|
+
if v >= 0.5:
|
|
197
|
+
tbl.add_row("de-verb", reduction_bar(v, bar_w, 18.0, "green"), f"-{v:4.1f} dB")
|
|
198
|
+
|
|
199
|
+
# 4. Voice Proximity (only shown if boosting > 0.5 dB)
|
|
200
|
+
if "proximity" in tel:
|
|
201
|
+
v = abs(tel["proximity"].get("boost_db", 0.0))
|
|
202
|
+
if v >= 0.5:
|
|
203
|
+
tbl.add_row("body", reduction_bar(v, bar_w, 9.0, "yellow"), f"+{v:4.1f} dB")
|
|
204
|
+
|
|
205
|
+
# 5. AEC Echo (only shown if AEC is enabled and actively working)
|
|
206
|
+
if "aec" in tel and tel["aec"].get("enabled", 1.0) > 0.5:
|
|
207
|
+
v = abs(tel["aec"].get("erle_db", 0.0))
|
|
208
|
+
if tel["aec"].get("dtd_active", 0.0) > 0.5:
|
|
209
|
+
tbl.add_row("echo", Text("TALKING".ljust(bar_w), style="bold yellow"), f"{v:4.1f} dB")
|
|
210
|
+
elif v >= 1.0 or tel["aec"].get("echo_detected", 0.0) > 0.5:
|
|
211
|
+
tbl.add_row("echo", reduction_bar(v, bar_w, 30.0, "blue"), f"-{v:4.1f} dB")
|
|
212
|
+
|
|
213
|
+
# 6. Dynamics (Comp / Limit / De-Esser) - only light up when actively clamping > 0.5 dB
|
|
214
|
+
comp_v = abs(tel.get("compressor", {}).get("gain_reduction_db", 0.0))
|
|
215
|
+
if comp_v >= 0.5:
|
|
216
|
+
tbl.add_row("comp", reduction_bar(comp_v, bar_w, 12.0, "cyan"), f"-{comp_v:4.1f} dB")
|
|
217
|
+
|
|
218
|
+
lim_v = abs(tel.get("limiter", {}).get("gain_reduction_db", 0.0))
|
|
219
|
+
if lim_v >= 0.5:
|
|
220
|
+
tbl.add_row("limit", reduction_bar(lim_v, bar_w, 12.0, "red"), f"-{lim_v:4.1f} dB")
|
|
221
|
+
|
|
222
|
+
deess_v = abs(tel.get("deesser", {}).get("gain_reduction_db", 0.0))
|
|
223
|
+
if deess_v >= 0.5:
|
|
224
|
+
tbl.add_row("de-ess", reduction_bar(deess_v, bar_w, 12.0, "magenta"), f"-{deess_v:4.1f} dB")
|
|
225
|
+
|
|
226
|
+
return tbl
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def _spectrum(snap: EngineSnapshot, ctx: LiveContext, width: int) -> Table:
|
|
230
|
+
panel_w = max(20, (width - 10) // 2)
|
|
231
|
+
rep = max(1, min(2, panel_w // ctx.n_bands))
|
|
232
|
+
f_lo, f_hi = ctx.centers
|
|
233
|
+
height = 3
|
|
234
|
+
tbl = Table.grid(padding=(0, 2))
|
|
235
|
+
tbl.add_column()
|
|
236
|
+
tbl.add_column()
|
|
237
|
+
tbl.add_row(Text("raw mic", style="grey70"), Text("processed voice", style="bold green"))
|
|
238
|
+
left = spectrum_rows(snap.in_bands, height, rep, style="blue")
|
|
239
|
+
right = spectrum_rows(snap.out_bands, height, rep, style="green")
|
|
240
|
+
for a, b in zip(left, right):
|
|
241
|
+
tbl.add_row(a, b)
|
|
242
|
+
axis = freq_axis(ctx.n_bands, rep, f_lo, f_hi)
|
|
243
|
+
tbl.add_row(axis, axis)
|
|
244
|
+
return tbl
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def _stats(snap: EngineSnapshot, ctx: LiveContext, now: float) -> Table:
|
|
248
|
+
tbl = Table.grid(padding=(0, 2))
|
|
249
|
+
tbl.add_column(style="grey70")
|
|
250
|
+
tbl.add_column()
|
|
251
|
+
tbl.add_column(style="grey70")
|
|
252
|
+
tbl.add_column()
|
|
253
|
+
tbl.add_column(style="grey70")
|
|
254
|
+
tbl.add_column()
|
|
255
|
+
|
|
256
|
+
noise = snap.telemetry.get("denoise", {}).get("noise_floor_db")
|
|
257
|
+
xr = snap.input_overflows + snap.output_underruns
|
|
258
|
+
uptime_str = format_uptime(ctx.start_time, now)
|
|
259
|
+
ram_mb = get_process_ram_mb()
|
|
260
|
+
|
|
261
|
+
tbl.add_row(
|
|
262
|
+
"latency", f"~{snap.latency_ms:4.0f} ms",
|
|
263
|
+
"noise floor", f"{noise:5.1f} dBFS" if noise is not None else "-",
|
|
264
|
+
"uptime", Text(uptime_str, style="cyan"),
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
cpu = Text()
|
|
268
|
+
cpu.append_text(load_bar(snap.cpu_load, 8))
|
|
269
|
+
cpu.append(f" {snap.cpu_load * 100:3.0f}%")
|
|
270
|
+
|
|
271
|
+
ram_str = f"{ram_mb:.1f} MB" if ram_mb > 0 else "-"
|
|
272
|
+
tbl.add_row(
|
|
273
|
+
"dsp load", cpu,
|
|
274
|
+
"input gain", f"{snap.input_gain_db:+.1f} dB",
|
|
275
|
+
"memory", Text(ram_str, style="dim white"),
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
glitch_style = "green" if xr == 0 else "yellow" if xr < 5 else "bold red"
|
|
279
|
+
glitch_text = Text("PERFECT (0 drops)" if xr == 0 else f"{xr} (DROPPED)", style=glitch_style)
|
|
280
|
+
drift_text = Text("0 (STABLE)" if snap.drift_corrections == 0 else f"{snap.drift_corrections} fixes", style="green" if snap.drift_corrections == 0 else "yellow")
|
|
281
|
+
tbl.add_row(
|
|
282
|
+
"audio sync", glitch_text,
|
|
283
|
+
"clock drift", drift_text,
|
|
284
|
+
"profile", Text("Active" if ctx.has_profile else "None", style="green" if ctx.has_profile else "grey50"),
|
|
285
|
+
)
|
|
286
|
+
return tbl
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def _routing(ctx: LiveContext) -> Text:
|
|
290
|
+
t = Text()
|
|
291
|
+
t.append("mic ", style="grey70")
|
|
292
|
+
t.append(ctx.input_name[:32], style="white")
|
|
293
|
+
if ctx.cable_name:
|
|
294
|
+
t.append(" → ", style="cyan")
|
|
295
|
+
t.append(ctx.cable_name[:32], style="white")
|
|
296
|
+
if ctx.monitor_name:
|
|
297
|
+
t.append(" 🎧 ", style="grey70")
|
|
298
|
+
t.append(ctx.monitor_name[:24], style="white")
|
|
299
|
+
return t
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def _render_mini_presence_spectrum(out_bands: np.ndarray, width: int = 24) -> Text:
|
|
303
|
+
"""Render a single-line high-resolution vocal presence wave for Gamer HUD."""
|
|
304
|
+
t = Text()
|
|
305
|
+
t.append("Vocals: ", style="grey50")
|
|
306
|
+
if len(out_bands) == 0:
|
|
307
|
+
t.append("·" * width, style="grey37")
|
|
308
|
+
return t
|
|
309
|
+
|
|
310
|
+
# Subsample bands to target width
|
|
311
|
+
step = max(1, len(out_bands) // width)
|
|
312
|
+
sampled = out_bands[::step][:width]
|
|
313
|
+
norm = np.clip((sampled + 90.0) / 55.0, 0.0, 1.0)
|
|
314
|
+
for v in norm:
|
|
315
|
+
idx = int(round(v * 8.0))
|
|
316
|
+
ch = BLOCKS[min(8, max(0, idx))]
|
|
317
|
+
col = "green" if idx > 4 else "cyan" if idx > 2 else "grey37"
|
|
318
|
+
t.append(ch, style=col)
|
|
319
|
+
return t
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
# =============================================================================
|
|
323
|
+
# GAMER HUD MODE: ULTRA-STREAMLINED, HIGH-TECH ESPORTS OVERLAY (TAB TOGGLED)
|
|
324
|
+
# =============================================================================
|
|
325
|
+
def render_gamer_hud(snap: EngineSnapshot, ctx: LiveContext, width: int, now: float) -> RenderableType:
|
|
326
|
+
"""Render compact, esports-optimized high-tech Gamer HUD."""
|
|
327
|
+
uptime_str = format_uptime(ctx.start_time, now)
|
|
328
|
+
ram_mb = get_process_ram_mb()
|
|
329
|
+
tel = snap.telemetry
|
|
330
|
+
|
|
331
|
+
# Top Status Bar
|
|
332
|
+
header = Text()
|
|
333
|
+
if snap.muted:
|
|
334
|
+
header.append(" ■ MUTED ", style="bold white on red")
|
|
335
|
+
elif snap.bypass:
|
|
336
|
+
header.append(" ◌ BYPASS ", style="bold black on yellow")
|
|
337
|
+
else:
|
|
338
|
+
header.append(" ● LIVE HUD ", style="bold black on green")
|
|
339
|
+
|
|
340
|
+
# Voice Activity Detector Badge
|
|
341
|
+
gate = tel.get("gate", {})
|
|
342
|
+
if snap.muted:
|
|
343
|
+
vad = Text(" [🤐 SILENCED] ", style="bold red")
|
|
344
|
+
elif gate.get("open", 0.0) > 0.5:
|
|
345
|
+
vad = Text(" [🎙️ VOICED SPEECH] ", style="bold green")
|
|
346
|
+
elif tel.get("denoise", {}).get("napping", 0.0) > 0.5:
|
|
347
|
+
vad = Text(" [💤 IDLE NAP] ", style="dim cyan")
|
|
348
|
+
else:
|
|
349
|
+
vad = Text(" [👂 LISTENING] ", style="dim grey50")
|
|
350
|
+
|
|
351
|
+
header.append(" ")
|
|
352
|
+
header.append_text(vad)
|
|
353
|
+
header.append(" ")
|
|
354
|
+
header.append("Preset: ", style="grey70")
|
|
355
|
+
header.append(f"[{ctx.preset}]", style="bold cyan")
|
|
356
|
+
header.append(" ")
|
|
357
|
+
header.append(f"⏱ {uptime_str}", style="dim white")
|
|
358
|
+
if ram_mb > 0:
|
|
359
|
+
header.append(f" │ {ram_mb:.0f}MB", style="dim white")
|
|
360
|
+
|
|
361
|
+
# Muted Giant Alert Box
|
|
362
|
+
muted_alert = None
|
|
363
|
+
if snap.muted:
|
|
364
|
+
muted_alert = Panel(
|
|
365
|
+
Text("■ MICROPHONE IS CURRENTLY MUTED (TEAMMATES CANNOT HEAR YOU)\nPress 'x' or Global Hotkey to Unmute", style="bold white on red", justify="center"),
|
|
366
|
+
border_style="red",
|
|
367
|
+
box=box.DOUBLE,
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
# Audio Specs & Live Compact Meters
|
|
371
|
+
bar_w = max(10, min(24, (width - 44)))
|
|
372
|
+
meter_tbl = Table.grid(padding=(0, 1))
|
|
373
|
+
meter_tbl.add_column(width=4, style="bold")
|
|
374
|
+
meter_tbl.add_column(width=bar_w)
|
|
375
|
+
meter_tbl.add_column(width=10, justify="right")
|
|
376
|
+
meter_tbl.add_column(width=14)
|
|
377
|
+
meter_tbl.add_column(style="grey70")
|
|
378
|
+
meter_tbl.add_column()
|
|
379
|
+
|
|
380
|
+
# Line 1: IN
|
|
381
|
+
in_clip = Text("CLIP", style="bold white on red") if snap.in_level.clipping else Text("")
|
|
382
|
+
meter_tbl.add_row(
|
|
383
|
+
"IN",
|
|
384
|
+
level_bar(snap.in_level.peak_db, snap.in_level.hold_db, bar_w),
|
|
385
|
+
Text(f"{fmt_db(snap.in_level.peak_db)} dB"),
|
|
386
|
+
in_clip,
|
|
387
|
+
"│ Latency:", f"~{snap.latency_ms:.0f}ms",
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
# Line 2: OUT
|
|
391
|
+
out_db = snap.out_level.peak_db
|
|
392
|
+
out_badge = Text("[TARGET]", style="bold green") if -24.0 <= out_db <= -10.0 else Text("CLIP", style="bold red") if snap.out_level.clipping else Text("")
|
|
393
|
+
meter_tbl.add_row(
|
|
394
|
+
"OUT",
|
|
395
|
+
level_bar(out_db, snap.out_level.hold_db, bar_w),
|
|
396
|
+
Text(f"{fmt_db(out_db)} dB"),
|
|
397
|
+
out_badge,
|
|
398
|
+
"│ DSP Load:", f"{snap.cpu_load * 100:.1f}%",
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
# Line 3: REF (AEC speaker reference, only if AEC is enabled)
|
|
402
|
+
aec_active = ("aec" in tel and tel["aec"].get("enabled", 1.0) > 0.5)
|
|
403
|
+
if aec_active and snap.ref_level is not None:
|
|
404
|
+
ref_db = snap.ref_level.peak_db
|
|
405
|
+
if ref_db <= -80.0:
|
|
406
|
+
ref_text = " silent"
|
|
407
|
+
ref_badge = Text("(Clean/Headphones)", style="dim green")
|
|
408
|
+
elif ref_db > -55.0:
|
|
409
|
+
ref_text = f"{fmt_db(ref_db)} dB"
|
|
410
|
+
ref_badge = Text("(Speaker Active)", style="dim cyan")
|
|
411
|
+
else:
|
|
412
|
+
ref_text = f"{fmt_db(ref_db)} dB"
|
|
413
|
+
ref_badge = Text("(Speaker)", style="dim cyan")
|
|
414
|
+
|
|
415
|
+
aec_erle = tel.get("aec", {}).get("erle_db", 0.0)
|
|
416
|
+
meter_tbl.add_row(
|
|
417
|
+
"REF",
|
|
418
|
+
level_bar(ref_db, snap.ref_level.hold_db, bar_w),
|
|
419
|
+
Text(ref_text, style="grey50" if ref_db <= -80.0 else "white"),
|
|
420
|
+
ref_badge,
|
|
421
|
+
"│ AEC Echo:", f"-{aec_erle:.1f} dB" if aec_erle > 0.5 else "Clean",
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
# Mini vocal presence spectrum
|
|
425
|
+
presence_wave = _render_mini_presence_spectrum(snap.out_bands, width=min(32, width - 20))
|
|
426
|
+
|
|
427
|
+
# Glitch & Pipeline Quickline
|
|
428
|
+
xr = snap.input_overflows + snap.output_underruns
|
|
429
|
+
glitch_col = "green" if xr == 0 else "yellow" if xr < 5 else "red"
|
|
430
|
+
diag_line = Text()
|
|
431
|
+
diag_line.append("Audio Sync: ", style="grey50")
|
|
432
|
+
diag_line.append("PERFECT (0 drops)" if xr == 0 else f"{xr} GLITCHES", style=glitch_col)
|
|
433
|
+
diag_line.append(" │ Noise Floor: ", style="grey50")
|
|
434
|
+
nf = tel.get("denoise", {}).get("noise_floor_db")
|
|
435
|
+
diag_line.append(f"{nf:.1f} dBFS" if nf else "-", style="cyan")
|
|
436
|
+
diag_line.append(" │ De-Verb: ", style="grey50")
|
|
437
|
+
dv = tel.get("deverb", {}).get("reverb_reduction_db", 0.0)
|
|
438
|
+
diag_line.append(f"-{dv:.1f}dB", style="green")
|
|
439
|
+
diag_line.append(" │ Body: ", style="grey50")
|
|
440
|
+
bod = tel.get("proximity", {}).get("boost_db", 0.0)
|
|
441
|
+
diag_line.append(f"+{bod:.1f}dB", style="yellow")
|
|
442
|
+
|
|
443
|
+
parts: list[RenderableType] = [header, Text("")]
|
|
444
|
+
if muted_alert:
|
|
445
|
+
parts.append(muted_alert)
|
|
446
|
+
parts.append(meter_tbl)
|
|
447
|
+
parts.append(Text(""))
|
|
448
|
+
parts.append(presence_wave)
|
|
449
|
+
parts.append(diag_line)
|
|
450
|
+
|
|
451
|
+
if ctx.message and now < ctx.message_until:
|
|
452
|
+
parts.append(Text(f"\n⚡ {ctx.message}", style="bold cyan"))
|
|
453
|
+
|
|
454
|
+
# Quick Gamer Controls Bar
|
|
455
|
+
keys_bar = Text()
|
|
456
|
+
is_narrow = width < 85
|
|
457
|
+
controls = [
|
|
458
|
+
("Tab", "Studio"), ("1-6", "Preset"), ("x", "Mute"),
|
|
459
|
+
("b", "Bypass"), ("s", "GUI"), ("?", "Help"), ("q", "Quit"),
|
|
460
|
+
]
|
|
461
|
+
for i, (k, label) in enumerate(controls):
|
|
462
|
+
keys_bar.append(f" {k} ", style="bold black on cyan")
|
|
463
|
+
keys_bar.append(f" {label}", style="grey70")
|
|
464
|
+
if i < len(controls) - 1:
|
|
465
|
+
keys_bar.append(" │ ", style="grey37")
|
|
466
|
+
|
|
467
|
+
parts.append(Text(""))
|
|
468
|
+
parts.append(keys_bar)
|
|
469
|
+
|
|
470
|
+
return Panel(
|
|
471
|
+
Group(*parts),
|
|
472
|
+
title=f"[bold cyan]⚡ micforge GAMER HUD[/] [dim]v{__version__}[/]",
|
|
473
|
+
border_style="cyan",
|
|
474
|
+
box=box.ROUNDED,
|
|
475
|
+
)
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
# =============================================================================
|
|
479
|
+
# STUDIO INSPECTOR MODE: FULL MODULAR BROADCAST RACK
|
|
480
|
+
# =============================================================================
|
|
481
|
+
def render_dashboard(snap: EngineSnapshot, ctx: LiveContext, width: int, now: float) -> RenderableType:
|
|
482
|
+
"""Render full Studio Inspector or Gamer HUD depending on mode."""
|
|
483
|
+
if ctx.hud_mode:
|
|
484
|
+
return render_gamer_hud(snap, ctx, width, now)
|
|
485
|
+
|
|
486
|
+
header = Text.assemble(
|
|
487
|
+
(f" {ctx.title} ", "bold white on blue"), " ",
|
|
488
|
+
_status(snap), " ",
|
|
489
|
+
("preset ", "grey70"), (f"[{ctx.preset}]", "bold cyan"),
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
parts: list[RenderableType] = [
|
|
493
|
+
header,
|
|
494
|
+
_routing(ctx),
|
|
495
|
+
_pipeline_ribbon(snap),
|
|
496
|
+
Text(""),
|
|
497
|
+
_meters(snap, width),
|
|
498
|
+
Text(""),
|
|
499
|
+
Panel(
|
|
500
|
+
_reductions(snap, width),
|
|
501
|
+
title="processing & dsp reductions",
|
|
502
|
+
title_align="left",
|
|
503
|
+
box=box.ROUNDED,
|
|
504
|
+
border_style="grey37",
|
|
505
|
+
padding=(0, 1),
|
|
506
|
+
),
|
|
507
|
+
]
|
|
508
|
+
|
|
509
|
+
# Responsive layout: only show dual spectrum if width >= 65 columns
|
|
510
|
+
if width >= 65:
|
|
511
|
+
parts.append(Panel(
|
|
512
|
+
_spectrum(snap, ctx, width),
|
|
513
|
+
title="real-time time-frequency spectrum",
|
|
514
|
+
title_align="left",
|
|
515
|
+
box=box.ROUNDED,
|
|
516
|
+
border_style="grey37",
|
|
517
|
+
padding=(0, 1),
|
|
518
|
+
))
|
|
519
|
+
|
|
520
|
+
parts.append(_stats(snap, ctx, now))
|
|
521
|
+
|
|
522
|
+
if snap.calibrating is not None:
|
|
523
|
+
pct = int(snap.calibrating * 100)
|
|
524
|
+
parts.append(Text(f"\n ◉ Calibrating room noise… stay quiet ({pct}%)", style="bold yellow"))
|
|
525
|
+
elif ctx.message and now < ctx.message_until:
|
|
526
|
+
parts.append(Text(f"\n ⚡ {ctx.message}", style="bold cyan"))
|
|
527
|
+
else:
|
|
528
|
+
parts.append(Text(""))
|
|
529
|
+
|
|
530
|
+
# Controls Cheatsheet Footer
|
|
531
|
+
foot = Text()
|
|
532
|
+
is_narrow = width < 85
|
|
533
|
+
controls = [
|
|
534
|
+
("Tab", "HUD" if is_narrow else "Gamer HUD"),
|
|
535
|
+
("1-6", "Preset"),
|
|
536
|
+
("x", "Mute"),
|
|
537
|
+
("b", "Bypass"),
|
|
538
|
+
("s", "GUI"),
|
|
539
|
+
("?", "Help"),
|
|
540
|
+
("q", "Quit"),
|
|
541
|
+
]
|
|
542
|
+
for i, (k, label) in enumerate(controls):
|
|
543
|
+
foot.append(f" {k} ", style="bold black on cyan")
|
|
544
|
+
foot.append(f" {label}", style="grey70")
|
|
545
|
+
if i < len(controls) - 1:
|
|
546
|
+
foot.append(" │ ", style="grey37")
|
|
547
|
+
parts.append(foot)
|
|
548
|
+
|
|
549
|
+
# Optional Help Overlay
|
|
550
|
+
if ctx.show_help:
|
|
551
|
+
help_text = Text()
|
|
552
|
+
help_text.append("\n[INTERACTIVE HOTKEY CHEATSHEET]\n", style="bold cyan")
|
|
553
|
+
help_text.append(" [Tab] Toggle Gamer HUD (compact view) vs Studio Inspector\n", style="white")
|
|
554
|
+
help_text.append(" [1-6] Instant preset jump (1:discord 2:gaming 3:broadcast 4:studio 5:noisy 6:demuffle)\n", style="white")
|
|
555
|
+
help_text.append(" [b] Toggle A/B bypass (hear raw mic vs processed voice)\n", style="white")
|
|
556
|
+
help_text.append(" [x] Mute/unmute microphone\n", style="white")
|
|
557
|
+
help_text.append(" [e] Toggle Acoustic Echo Cancellation (AEC)\n", style="white")
|
|
558
|
+
help_text.append(" [w] Cycle Voice Proximity Body/Warmth (Off -> 35% -> 55% -> 75%)\n", style="white")
|
|
559
|
+
help_text.append(" [v] Cycle Room De-Verb (Off -> 30% -> 50% -> 70%)\n", style="white")
|
|
560
|
+
help_text.append(" [g] Nudge Noise Gate threshold (+2 dB tighter)\n", style="white")
|
|
561
|
+
help_text.append(" [+/-] AI Denoiser strength up/down (10% steps)\n", style="white")
|
|
562
|
+
help_text.append(" [[ / ]] Input preamp gain up/down (+/- 1 dB)\n", style="white")
|
|
563
|
+
help_text.append(" [s] Open Native Multi-Tab Control Center GUI\n", style="white")
|
|
564
|
+
help_text.append(" [c] Calibrate room ambient noise profile (3s silence)\n", style="white")
|
|
565
|
+
help_text.append(" [q] Quit cleanly\n", style="white")
|
|
566
|
+
parts.append(Panel(help_text, border_style="cyan", box=box.ROUNDED))
|
|
567
|
+
|
|
568
|
+
return Panel(
|
|
569
|
+
Group(*parts),
|
|
570
|
+
title=f"[bold cyan]micforge[/] [dim]v{__version__}[/]",
|
|
571
|
+
border_style="cyan",
|
|
572
|
+
box=box.ROUNDED,
|
|
573
|
+
)
|