JunTingLin / magic-voice-switch

0 stars 2 forks source link

Magic Voice Switch

Overview

Magic Voice Switch is a project inspired by a popular Instagram video where magic words like "開damn" and "關damn" are used to control lights. Although the video was proven to involve manual control, this project aims to bring the idea to life by using voice commands to control lights.

The project supports two modes:

  1. Machine Learning Mode: Uses a model trained with Teachable Machine to recognize specific magic words.
  2. Speech-to-Text (STT) Mode: Recognizes similar sounding words to classify them into categories.

Categories

Future Plans

Dependencies

Audio Processing

Speech Recognition

Machine Learning and AI

Environment Management

Setup Instructions

Build venv for MacOS

Mac should brew install portaudio at first to install PyAudio.

$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ deactivate
$ rm -rf venv     # remove the venv

Build venv for Windows

$ pip install virtualenv
$ virtualenv venv
$ venv\Scripts\activate
$ pip install -r requirements.txt
$ deactivate
$ rmdir /s venv     # remove the venv

Running the Project

Run the following command to start the voice recognition loop:

python main.py

You will be prompted to choose the mode:

  1. If you choose Model, the system will use the trained model for recognition.
  2. If you choose STT, you will be prompted to choose between Google or OpenAI for speech-to-text processing.

Demo

https://github.com/JunTingLin/magic-voice-switch/assets/92431095/4d53c5d8-d348-4c3a-93af-00953b51a449

https://github.com/JunTingLin/magic-voice-switch/assets/92431095/ed71c425-f4d8-4fec-9f05-4d28adad432d