Full functional voicebased low latency ai talk companion in few lines of code using Faster_Whisper, OpenAI's GPT-4 and the ElevenLabs input streaming API.
Responds to spoken words in realtime as a character (instead of an assistant).
Use voice_talk_vad.py to automatically detect speech (talk with hands free).
Use voice_talk.py to toggle recording with the spacebar.
-
API Keys:
- Replace
your_openai_key
andyour_elevenlabs_key
with your OpenAI and ElevenLabs API key values in the code.
- Replace
-
Dependencies:
- Install the required Python libraries:
pip install openai elevenlabs pyaudio wave keyboard faster_whisper numpy torch
- Install the required Python libraries:
-
Run the Script:
-
Execute the main script:
python voice_talk_vad.py
or
python voice_talk.py
-
Talk into your microphone.
Listen to the reply.
- Press the space bar to initiate talk.
- Speak your heart out.
- Hit the space bar again once you're done.
- Listen to reply.
Feel free to fork, improve, and submit pull requests. For major changes, please open an issue first.
Huge shoutout to:
- The developers behind faster_whisper.
- ElevenLabs for the fast, crystal-clear voice API.
- OpenAI for the GPT-4 model.