TTS-Slots (Piper CPU, Qwen3-TTS auf Ada), M4000 außer Betrieb, Engine-Grenzen im Placement (ADR-0006)
ci / test (push) Successful in 24s
ci / test (push) Successful in 24s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""Hilfen für Audio (WAV-Dauer, Real-Time-Factor)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import wave
|
||||
|
||||
|
||||
def wav_duration(data: bytes) -> float:
|
||||
"""Dauer einer WAV-Datei in Sekunden; 0.0 wenn keine gültige WAV."""
|
||||
try:
|
||||
with wave.open(io.BytesIO(data)) as w:
|
||||
rate = w.getframerate()
|
||||
return w.getnframes() / rate if rate else 0.0
|
||||
except (wave.Error, EOFError):
|
||||
return 0.0
|
||||
|
||||
|
||||
def rtf(seconds_compute: float, seconds_audio: float) -> float | None:
|
||||
"""Real-Time-Factor: Rechenzeit ÷ Audiolänge (< 1 = schneller als Echtzeit)."""
|
||||
return seconds_compute / seconds_audio if seconds_audio > 0 else None
|
||||
Reference in New Issue
Block a user