Build your own personal voice AI assistant like Alexa with OpenAI GPT3, OpenAI Whisper, and Coqui TTS in 5 minutes

Stephen Lee (Sungsoo)
3 min readMar 26, 2023

This is the tutorial on putting AI tools (OpenAI GPT3, OpenAI Whisper, Coqui TTS) together to create a basic personal voice AI assistant.

Today ChatGPT is the hot new thing.

Introduction

I will walk you through how to build your own simple Alexa in 5 minutes. This is a very simple voice AI assistant that you can create from the scratch with Python script.

Step #0: Setup

pip install -U openai-whisper
pip install sounddevice
pip install scipy
pip install openai
pip install python-dotenv
pip install TTS

Step #1: Ask a question and record your voice.

import sounddevice as sd
from scipy.io.wavfile import write

# Sampling frequency
# Regardless of the sampling rate used in the original audio file,
# the audio signal gets resampled to 16kHz (via ffmpeg). Anything grater than 16kHz should work.
# see https://github.com/openai/whisper/discussions/870.
freq = 44100

# Recording duration in seconds
duration = int(input("select duration of the audio: "))

# Start recorder with the given values of
# duration and sample frequency.

recording = sd.rec(int(duration * freq),
samplerate=freq, channels=2)

#…

--

--