A voice-activated assistant module for MagicMirror² using Porcupine for wake word detection, OpenAI's Whisper for speech recognition, and GPT for natural language processing.
Before installing this module, make sure you have the following:
Navigate to your MagicMirror's modules
folder:
cd ~/MagicMirror/modules/
Clone this repository:
git clone https://github.com/LeonardSEO/MMM-VoiceCompanion.git
Change to the newly created module directory:
cd MMM-VoiceCompanion
Install the dependencies:
npm install
Add the module to your config/config.js
file in the MagicMirror directory:
{
module: "MMM-VoiceCompanion",
config: {
wakeWord: "HEY_GOOGLE",
porcupineAccessKey: "YOUR_PORCUPINE_ACCESS_KEY",
openAiKey: "YOUR_OPENAI_KEY",
voiceId: "echo",
conversationTimeout: 120000,
standbyTimeout: 30000,
audioDeviceIndex: 0, // Set this to the index of your preferred audio input device
silenceThreshold: 1.5, // Adjust this value to fine-tune silence detection
silenceDuration: 30, // Number of frames of silence to trigger stop recording
}
}
Replace "your-porcupine-access-key-here"
and "your-openai-api-key-here"
with your actual API keys.
Restart your MagicMirror:
pm2 restart MagicMirror
Option | Description |
---|---|
wakeWord | The wake word to activate the voice assistant (must be one of the BuiltinKeyword values) |
porcupineAccessKey | Your Porcupine access key |
openAiKey | Your OpenAI API key |
language | The language code for speech recognition (default: "en") |
voiceId | The voice ID for text-to-speech (default: "echo") |
conversationTimeout | Time in milliseconds before conversation mode ends (default: 120000) |
standbyTimeout | Time in milliseconds of inactivity before entering standby mode (default: 30000) |
The following wake words are available as built-in keywords for Porcupine:
Choose one of these values for the wakeWord
configuration option.
conversationTimeout
.standbyTimeout
, the module will enter standby mode.To update the MMM-VoiceCompanion module to the latest version, follow these steps:
Navigate to your MagicMirror's modules
folder:
cd ~/MagicMirror/modules/MMM-VoiceCompanion
Pull the latest changes from the repository:
git pull
Update the module's dependencies:
npm update
Restart your MagicMirror to apply the updates:
pm2 restart MagicMirror
This will ensure your module is up-to-date with the latest features and bug fixes.
This module uses ESLint to ensure code quality. To run the linter:
npm run lint
To automatically fix linting issues:
npm run lint:fix
If you encounter any issues:
Check the MagicMirror logs for any error messages:
pm2 logs MagicMirror
Ensure your microphone and speakers are properly connected and functioning.
Verify that your Porcupine and OpenAI API keys are correct and have the necessary permissions.
Make sure you have a stable internet connection, as this module requires online access for API calls.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.