Skip to content

remotebrowser/speak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPEAK

This is sample code for using TTS (text-to-speech), also known as a speech synthesizer. It is available in JavaScript and Python.

To use this tool with the OpenAI Text-to-Speech API, set the following environment variables:

export TTS_API_BASE_URL=https://api.openai.com/v1
export TTS_API_KEY="your_api_key_here"
export TTS_MODEL="tts-1"
export TTS_VOICE="alloy"

To use this tool with Kokoro-FastAPI, first run the container, then set the following environment variables (see the full list of voices):

export TTS_API_BASE_URL=http://127.0.0.1:8880/v1
export TTS_VOICE="af_bella"

Synthesizing Speech

To synthesize speech, run:

./speak.js "Jupiter is the largest planet in our solar system."
./speak.py "Jupiter is the largest planet in our solar system."

This will generate an MP3 audio file. If SoX is installed, it will automatically play the audio.

About

Sample code to call Kokoro TTS API

Resources

License

Stars

Watchers

Forks