aisay means AI Say
This tool generates speech from text using OpenAI's speech API and plays it back.
git clone https://github.com/vaderyang/aisay
To install the required dependencies, run:
cd aisay
pip install -r requirements.txt
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)
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!
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
You may need proxy to connect to the OpenAI API server through export https_proxy environment variable.
BSD 2-Clause