"""
pip install kokoro-onnx soundfile

wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx
wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/voices-v1.0.bin
python examples/with_voice.py
"""

import numpy as np
import soundfile as sf
from kokoro_onnx import Kokoro
from kokoro_onnx.config import SAMPLE_RATE

kokoro = Kokoro("kokoro-v1.0.onnx", "voices-v1.0.bin")
created = []

for voice in kokoro.get_voices():
    samples, sample_rate = kokoro.create(
        f"Hello! This audio generated by {voice}!", voice=voice, speed=1.0
    )
    created.append(samples)
    print(f"Generated audio for {voice}")

audio = np.concatenate(created)

sf.write("voices.wav", audio, SAMPLE_RATE)
print("Created voices.wav")
