MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / summarize_audio

Function summarize_audio

tests/ace_step/ace_step_python_warm_bench.py:52–73  ·  view source on GitHub ↗
(audio: np.ndarray, sample_rate: int)

Source from the content-addressed store, hash-verified

50
51
52def summarize_audio(audio: np.ndarray, sample_rate: int) -> dict[str, Any]:
53 if audio.ndim == 1:
54 channels = 1
55 frames = int(audio.shape[0])
56 flat = audio.astype(np.float32, copy=False)
57 else:
58 frames = int(audio.shape[0])
59 channels = int(audio.shape[1])
60 flat = audio.astype(np.float32, copy=False).reshape(-1)
61 if flat.size == 0:
62 raise RuntimeError("ACE-Step warmbench summary received empty audio")
63 return {
64 "sample_rate": int(sample_rate),
65 "channels": channels,
66 "samples": int(flat.size),
67 "frames": frames,
68 "sum": float(np.sum(flat, dtype=np.float64)),
69 "mean_abs": float(np.mean(np.abs(flat), dtype=np.float64)),
70 "rms": float(np.sqrt(np.mean(np.square(flat), dtype=np.float64))),
71 "min": float(np.min(flat)),
72 "max": float(np.max(flat)),
73 }
74
75
76def load_requests(args: argparse.Namespace) -> list[dict[str, Any]]:

Callers 1

run_requestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected