fix: audioop-DeprecationWarning beim Resampling unterdrücken
audioop ist seit 3.11 deprecated und ab 3.13 entfernt. Es bleibt der schnelle Default (stdlib, kein numpy nötig — wichtig fürs schlanke Test-/CI-venv); der Import wird nur in catch_warnings gekapselt. Ab 3.13 greift weiterhin der bestehende ImportError->numpy-Fallback. Suite-Warnungen damit von 2 auf 1 (verbleibend: Starlette-TestClient, bibliotheksintern). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a6866a6e7f
commit
284228b5fa
1 changed files with 7 additions and 1 deletions
|
|
@ -51,7 +51,13 @@ def _load_voice(model_path: str):
|
|||
def _resample(pcm: bytes, src_rate: int, dst_rate: int) -> bytes:
|
||||
"""Resampelt s16le-Mono in-process. audioop (stdlib) bevorzugt, sonst numpy."""
|
||||
try:
|
||||
import audioop # in Python 3.13 entfernt -> Fallback unten
|
||||
# audioop ist seit 3.11 deprecated und ab 3.13 entfernt. Solange vorhanden,
|
||||
# bleibt es der schnelle Default (stdlib, kein numpy nötig) -> Warnung still
|
||||
# unterdrücken. Ab 3.13 wirft der Import ImportError -> numpy-Fallback unten.
|
||||
import warnings
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
import audioop
|
||||
|
||||
converted, _ = audioop.ratecv(pcm, 2, 1, src_rate, dst_rate, None)
|
||||
return converted
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue