Skip to content

bvanrijn/wtts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

wtts

Watson Text-to-Speech in Python.

API

watsontts.synthesize(text: str) -> requests.Response

Perform text-to-speech on the given text.

Usage

python-telegram-bot

Here's a function you can build upon to bring wtts to your bot.
(Imports and handlers omitted for brevity)

def tts(bot, update):
    text = update.message.text
    
    tmp_f = open('tmp.ogg', 'wb+')
    tmp_f.write(watsontts.synthesize(text).content)

    bot.sendAudio(update.message.chat_id, audio=open('tmp.ogg', 'rb'))

    tmp_f.close()
    os.remove('tmp.ogg')

Try it

Try it online or run python3 watsontts.py

License

MIT. See LICENSE.

About

Watson Text-to-Speech in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages