09a1c98514
- pocket_server.py (Produktions-TTS mit Stimmen-Waechter), text_norm, Bench-/Diag-Skripte - lucy-f5: f5_server/f5_test/bench_dml (DirectML-Experiment, Phase C/D offen) - .gitignore: venvs/Modelle/Audio/Logs der beiden Ordner + box_recon/gemma_swap-Scratch Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
1.5 KiB
Python
33 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Debug: warum greift der Onset-Crop auf dem 1s-Kopf des Streams nicht? + Roh-RMS für Gain-Kalibrierung."""
|
|
import os, numpy as np, librosa, soundfile as sf
|
|
from pocket_tts import TTSModel
|
|
|
|
BASE = r"F:\Coding Stuff\mission-control-2\client\lucy-tts"
|
|
src,_ = librosa.load(os.path.join(BASE,"ref.mp3"), sr=24000, mono=True)
|
|
srt,_ = librosa.effects.trim(src, top_db=30); ref=os.path.join(BASE,"ref.wav")
|
|
sf.write(ref, srt[:int(18*24000)], 24000)
|
|
|
|
m = TTSModel.load_model(language="german_24l", lsd_decode_steps=6, temp=0.9)
|
|
vs = m.get_state_for_audio_prompt(ref); sr = m.sample_rate
|
|
LEAD = "Tja. "
|
|
text = LEAD + "Natürlich kümmere ich mich darum, Commander. Ich starte den Dienst neu."
|
|
|
|
chunks = []
|
|
for c in m.generate_audio_stream(vs, text, frames_after_eos=4):
|
|
c = c.numpy() if hasattr(c,"numpy") else np.asarray(c)
|
|
chunks.append(np.asarray(c,dtype=np.float32).reshape(-1))
|
|
print(f"#chunks={len(chunks)} chunk_sizes_ms={[round(x.size/sr*1000) for x in chunks[:8]]}")
|
|
full = np.concatenate(chunks)
|
|
print(f"full dur={full.size/sr:.2f}s peak={np.abs(full).max():.3f} rms={np.sqrt(np.mean(full**2)):.3f}")
|
|
|
|
head = full[:int(1.0*sr)]
|
|
for td in (45, 35, 25, 20):
|
|
iv = librosa.effects.split(head, top_db=td)
|
|
segs = [(round(s/sr,2), round(e/sr,2)) for s,e in iv]
|
|
print(f"HEAD top_db={td}: {len(iv)} segs {segs}")
|
|
# voller Onset-Crop (wie nicht-stream) zum Vergleich
|
|
ivf = librosa.effects.split(full, top_db=35)
|
|
print(f"FULL top_db=35: {len(ivf)} segs erste3={[(round(s/sr,2),round(e/sr,2)) for s,e in ivf[:3]]}")
|
|
print("DBG_DONE")
|