opentts icon indicating copy to clipboard operation
opentts copied to clipboard

Python Basics Example/Demo

Open HarrisonSteel opened this issue 1 year ago • 1 comments

Hi Team, I ended up here from browsing HackerNews where many people were looking for open-source TTS software packages: https://news.ycombinator.com/item?id=34211457 I started having a go with OpenTTS but was significantly slowed down since I could not quickly find a nice basic python implementation showing exactly how to get it up and running (i.e. in python read aloud "hello world" in one of the many voices). Is there any possibility of such a thing being put on the repo for people to build upon, rather than the html interface focus at present?

HarrisonSteel avatar May 01 '23 18:05 HarrisonSteel

I used the docker container in Windows WSL and query it from the host like this:

import requests

resp = requests.get(
    "http://localhost:5500/api/tts",
    params={
        "voice": "coqui-tts:en_vctk",
        "text": "I started having a go with OpenTTS but was significantly slowed down since I could not quickly find a nice basic python implementation.",
        "speakerId": "p228",
        "lang": "en"
    }
)

# Write it on disk or something
with open("file.wav", "wb") as f:
    f.write(resp.content)

KMouratidis avatar May 11 '23 19:05 KMouratidis