Ziggy
Awaaz: consumer voice coaching — session-scoped history, config-aware analyzer filters, softened narratives, Awaaz design identity
2a762ba | """Benchmark latency and memory usage.""" | |
| import time | |
| import tracemalloc | |
| import numpy as np | |
| from app.core.pipeline import AnalysisPipeline | |
| def benchmark(duration_seconds: float = 10.0): | |
| sr = 16000 | |
| t = np.linspace(0, duration_seconds, int(sr * duration_seconds)) | |
| audio = 0.3 * np.sin(2 * np.pi * 440 * t).astype(np.float32) | |
| pipeline = AnalysisPipeline() | |
| # Warmup | |
| pipeline.process_audio(audio[: sr * 3], sr) | |
| # Benchmark | |
| tracemalloc.start() | |
| start = time.time() | |
| result = pipeline.process_audio(audio, sr) | |
| elapsed = time.time() - start | |
| current, peak = tracemalloc.get_traced_memory() | |
| tracemalloc.stop() | |
| print(f"Duration: {duration_seconds:.1f}s") | |
| print(f"Elapsed: {elapsed:.2f}s ({elapsed / duration_seconds:.2f}x RT)") | |
| print(f"Peak memory: {peak / 1024 / 1024:.1f} MB") | |
| print(f"Success: {result['success']}") | |
| if result["success"]: | |
| print(f"Overall score: {result['overall_score']:.1f}") | |
| if __name__ == "__main__": | |
| benchmark(10.0) | |