Skip to content

command line utility to convert text to speech using OpenAI tts

License

Notifications You must be signed in to change notification settings

vaderyang/aisay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

aisay

aisay means AI Say

Description

This tool generates speech from text using OpenAI's speech API and plays it back.

Installation

git clone https://github.com/vaderyang/aisay

To install the required dependencies, run:

cd aisay
pip install -r requirements.txt

Usage

Run the script with the following command: Setup your openai key

export OPENAI_API_KEY=sk-***********  

You may alternatively modify aisay.py direclty to put your openai key in client = OpenAI(api_key="sk-****") in a safe machine environment.

python3 aisay.py [arguments]

Arguments:

  • string: Text to say
  • -v/--voice: Voice model to use (default: onyx)
  • -f/--file: Text file to read input from
  • -o/--output: Output file path for the generated speech
  • -r/--rate: Playback speed of the generated speech (0.25 to 4.0)

Example

python3 aisay.py Hello World

Check the volume settings to make sure you hear the speech.

python3 aisay.py -v echo -o helloworld.mp3 Hello Again!

Extra Installation Options

If you want to make it as a system command for easier access, run:

sudo cp aisay.py /usr/local/bin/aisay
sudo chmod +x /usr/local/bin/aisay
aisay Hello World

if this doesn't work, find out the right path to save your aisay file by

echo $PATH

NOTICE

You may need proxy to connect to the OpenAI API server through export https_proxy environment variable.

License

BSD 2-Clause

About

command line utility to convert text to speech using OpenAI tts

Topics

Resources

License

Stars

Watchers

Forks

Languages