You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
570 B

import requests
from urllib.parse import quote
import subprocess
import os
speaker_id="p230"
with open('./annual-letters/bpl-1958.txt') as f:
lines = f.readlines()
all_text = ''.join(lines)
sentences = all_text.split('.')
count = len(sentences)
for (i, sentence) in enumerate(sentences):
text_prompt = quote(sentence)
query_string = f"http://localhost:5002/api/tts?text={text_prompt}&speaker_id={speaker_id}&style_wav=&language_id="
subprocess.run(['curl', query_string, '-o', f"./outputs/output-{str(i).zfill(3)}.wav"])