diff --git a/make_voice_refs.py b/make_voice_refs.py index 24642b0..5a3649b 100644 --- a/make_voice_refs.py +++ b/make_voice_refs.py @@ -5,7 +5,8 @@ Kokoro has clearly female / male English voices; a ~12 s calm sample of each is enough for Chatterbox to take over the timbre in every language. .venv-tts\\Scripts\\python.exe make_voice_refs.py -writes voice_refs/female.wav and voice_refs/male.wav +writes voice_refs/female.wav, voice_refs/male.wav and voice_refs/warrior.wav +(warrior: very deep, rough battle voice – Kokoro bm_lewis, −3 semitones, soft saturation) """ import _bootstrap # Projektordner (config.py, Listen) vor allen anderen Modulen import config @@ -25,6 +26,21 @@ TEXT = ("Once upon a time, in a quiet little town by the sea, a child was born. VOICES = {"female": "af_heart", "male": "am_michael"} +WARRIOR_TEXT = ("Hear me, sons of Rome! I have bled in this sand for years. I have broken chains and broken men. " + "Tonight I fight, and tomorrow I will be free!") + + +def warrior(): + import librosa + audio = np.concatenate([a.numpy() if hasattr(a, "numpy") else a + for _, _, a in KPipeline(lang_code="b")(WARRIOR_TEXT, voice="bm_lewis", speed=0.88)]) + deep = librosa.effects.pitch_shift(audio.astype(np.float32), sr=24000, n_steps=-3) + deep = deep / (np.abs(deep).max() + 1e-6) + rough = np.tanh(deep * 2.6) / np.tanh(2.6) * 0.6 + deep * 0.4 + path = os.path.join(OUT, "warrior.wav") + sf.write(path, rough * 0.9, 24000) + print(f"warrior: bm_lewis deep/rough, {len(audio) / 24000:.1f} s -> {path}") + def main(): os.makedirs(OUT, exist_ok=True) @@ -35,6 +51,7 @@ def main(): path = os.path.join(OUT, f"{name}.wav") sf.write(path, audio, 24000) print(f"{name}: {voice}, {len(audio) / 24000:.1f} s -> {path}") + warrior() if __name__ == "__main__": diff --git a/voice_refs/warrior.wav b/voice_refs/warrior.wav new file mode 100644 index 0000000..f8b4517 Binary files /dev/null and b/voice_refs/warrior.wav differ