Repository

GPT-2-Speech

Allows speech input and output with a GPT-2 instance on any model you please. It's very much like an advanced Siri or Alexa... · ★ 4 · License MIT · Python · Updated 2023-05-22

Stars
4
License
MIT
Language
Python
Updated
2023-05-22

README

To get speech up and running:

Mac

brew install espeak
sudo pip3 install pyttsx pydub gTTS SpeechRecognition 

brew install ffmpeg 
brew install portaudio

From inside directory

cd src/pyaudio
sudo python setup.py install

Linux

sudo pip3 install pyttsx gTTS pydub SpeechRecognition 
sudo apt-get install espeak 
sudo apt-get install ffmpeg

From inside directory

cd src/pyaudio
sudo python setup.py install

sudo apt-get installl libportaudio-dev
sudo apt-get install python-dev
sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev

Voices & Linux Support

The code is set up to run out of the box on Mac, but with linux you will need to add in the reference to the voice model (I find they sound far more robotic than Apple's though) You can also use this script to find the other voices on Mac.

import pyttsx3
engine = pyttsx3.init()

voices = engine.getProperty('voices')
for voice in voices:
    print("Voice:")
    print(" - ID: %s" % voice.id)
    print(" - Name: %s" % voice.name)
    print(" - Languages: %s" % voice.languages)
    print(" - Gender: %s" % voice.gender)
    print(" - Age: %s" % voice.age)

It will print a long list like this one (done on Mac)

  Voice:
   - ID: com.apple.speech.synthesis.voice.Alex