Watch the full demo here.
This is the initial version of Drunk-AI. As a non-technical individual, I acknowledge that the code and scripts may not be perfect. If you find areas for improvement, feel free to submit a PR. While the setup process may seem lengthy and a bit messy, the final result is worth it!
Download the shortcuts linked below and configure them with the API key from MMM-RemoteControl.
- More info about MMM-RemoteControl: GitHub Repository
- iOS Shortcuts Link: Download Shortcut
Edit the downloaded shortcut with:
- Your MagicMirror's IP address.
- Replace
apikey
in the text with your API key from MMM-RemoteControl.
- Run the shortcut each time you want to interact with ChatGPT.
- Alternatively, use the default Telegram commands (without voice input).
- Future updates will include hotword detection.
- When you run the shortcut, the mirror will display a Jarvis animation and the text: "Say something".
- Speak into the microphone after seeing the prompt.
- If the audio is captured successfully, the spoken text will appear on the mirror.
- Listening duration is set to 4 seconds by default. Adjust this in
transcript.py
in the MMM-Chat module.
-
Add the following to your
config.js
:{ module: 'MMM-NotificationTrigger', config: { triggers: [ { trigger: 'SHOW_ALERT', fires: [ { fire: 'MY_COMMAND', exec: (payload) => `python3 /home/pi/MagicMirror/modules/MMM-11-TTS/main.py "${payload.message}"` } ] } ] } }
-
Add the following to your
config.js
:{ module: "MMM-OpenAI", position: 'top_right', config: { defaultChatInstruction: "Your name is Marvin and you are a paranoid android that reluctantly answers questions with sarcastic responses.", stealth: true, postProcessing: function (handler, responseObj) { if (responseObj.error) return; let method = responseObj.options.method; let alertPayload = { title: responseObj.request.prompt, imageUrl: (method === 'IMAGE') ? responseObj.response.data[0].url : null, message: (method === 'TEXT') ? responseObj.response.choices[0].text : ((method === 'CHAT') ? responseObj.response.choices[0].message.content : null), timer: 2 * 1000 }; handler.sendNotification('SHOW_ALERT', alertPayload); } } }
-
Clone the following repository: MMM-11-TTS.
- Follow the installation instructions.
- Edit
main.py
to add your API key and voice ID. A default voice ID is included. - Refer to the ElevenLabs API documentation for voice ID details.
While ElevenLabs TTS offers superior voice quality compared to Google TTS, its free account character limit is only 10,000 characters per month. Paid accounts offer 30,000 characters and voice cloning features. To enable cloning, update the voice ID in main.py
.
The current implementation involves downloading audio from API requests, converting it using ffmpeg
, and playing it as output. This may not be the most efficient approach. Install ffmpeg
using apt
if it is not already installed.
A streamlined, single-module implementation would simplify this process. Contributions are welcome!