File size: 893 Bytes
48c2af7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import sys
import os
# Ensure project root is on sys.path so direct execution can import local modules
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if ROOT not in sys.path:
sys.path.insert(0, ROOT)
from tts_provider import generate_tts
text = "Joe: Hi\nJane: Hello"
svc = [
{'speaker': 'Joe', 'voice_config': {'prebuilt_voice_config': {'voice_name': 'Kore'}}},
{'speaker': 'Jane', 'voice_config': {'prebuilt_voice_config': {'voice_name': 'Puck'}}},
]
if __name__ == '__main__':
audio, err, prov = generate_tts(text, svc, model='models/gemini-2.5-flash-preview-tts')
print('err:', err, 'prov:', prov, 'audio bytes:', len(audio) if audio else None)
if audio:
os.makedirs('logs', exist_ok=True)
out = os.path.join('logs', 'test_out.wav')
with open(out, 'wb') as f:
f.write(audio)
print('Wrote', out)
|