Skip to content

a python based voice assistant that uses voice recognition, speech synthesis, and natural language processing (NLP) to provide a service through a particular application. This project provides an effective way to help someone with daily talks. It looks for entities to understand natural language and can help to do a variety of tasks hands-free

License

Notifications You must be signed in to change notification settings

madhuragandhe/Voice-Assistant

 
 

Repository files navigation

Voice-Assistant

This is a simple virtual assistant written in Python 3.

Watch the video

Voice-Assistant Architecture

Virtual assistants are built from the following components:

  • Voice Activity Detection (VAD) - this determines when the user starts and stops speaking. Voice-Assistant uses the python SpeechRecognition module for VAD.
  • Speech to Text (STT) - This converts the audio that was recorded between when the VAD recognized that the user started speaking and when the user ended speaking. Voice-Assistant uses the default STT provider for the python SpeechRecognition module, which is currently a free online service from Google called "Google Speech Recognition". The SpeechRecognition module can also use Pocketsphinx for offline recognition.
  • Text to Intent - This takes the recognized text from the STT engine and figures out what action you want the assistant to perform. Usually the full recognized text is passed to the action to search for keywords. This is the bulk of what the digital_assistant method in the main.py script does.
  • Action - this performs some action based on the intent. It usually responds with a text message.
  • Text to Speech (TTS) - this converts text, usually returned by an action, to speech which is then played by the computer as a response.

Installation

Windows

Voice-Assistant runs well on Windows. For the easiest setup, you should probably download and install Anaconda and then use the conda command with the environment.yml file from the Anaconda prompt to create a virtual environment for yourself.

(base) C:\Projects\Voice-Assistant>conda env create -f environment.yml

To run voice assistant, activate the virtual environment from the Anaconda prompt and use python to run main.py:

(base) C:\Projects\Voice-Assistant>conda activate Voice-Assistant
(Voice-Assistant) C:\Projects\Voice-Assistant>python main.py

Linux

Voice-Assistant works well with Linux. It should run on a Raspberry Pi or other SBC or within Linux installed on a virtual machine like on VirtualBox.

Most Linux distros already have Python 3 installed.

You should always use Voice Assistant within a virtual environment, especially on Linux where system utilities are likely to be written in your system Python. Getting your system environment messed up when a required library gets changed is never fun.

On Debian derivatives like Ubuntu, Mint, Raspbian, etc. you can install a virtual environment using VirtualEnvWrapper:

~/Voice-Assistant $ sudo apt install virtualenvwrapper
~/Voice-Assistant $ echo ". /usr/share/virtualenvwrapper/virtualenvwrapper.sh" >> ~/.bashrc
~/Voice-Assistant $ . /usr/share/virtualenvwrapper/virtualenvwrapper.sh
~/Voice-Assistant $ mkvirtualenv -p /usr/bin/python3 Voice-Assistant
(Voice-Assistant) ~/Voice-Assistant $

You will probably need to install eSpeak and PortAudio. On Debian derivatives, these can be installed with:

~/Voice-Assistant $ sudo apt install portaudio19-dev libespeak-dev

then activate your virtual environment and use the requirements.txt file to load the required modules:

~/Voice-Assistant $ workon Voice-Assistant
(Voice-Assistant) ~/Voice-Assistant $ pip install -r requirements.txt

To run Voice-Assistant, you should activate the virtual environment, then use python to run the main.py script:

~/Voice-Assistant $ workon Voice-Assistant
(Voice-Assistant) ~/Voice-Assistant $ python main.py

About

a python based voice assistant that uses voice recognition, speech synthesis, and natural language processing (NLP) to provide a service through a particular application. This project provides an effective way to help someone with daily talks. It looks for entities to understand natural language and can help to do a variety of tasks hands-free

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%