Control your Discord microphone mute, deafen, and camera hands‑free using voice commands and OpenAI Whisper (offline).
Includes a live mic level meter, fuzzy command matching, and a transcription log.
-
Windows: Download from python.org
✅ Check “Add Python to PATH” during installation. -
macOS:
brew install python@3.14.2
or download from python.org.
-
Linux (Ubuntu/Debian):
sudo apt update sudo apt install python3 python3-pip python3-venv
Verify installation by opening a terminal (Command Prompt / PowerShell / bash) and typing:
python --versionShould show Python 3.8+.
Pip comes installed with Python 3.4+. To verify pip is installed:
python -m pip --versionIf pip is not installed (very rare), install it manually:
Windows:
python -m ensurepip --upgrademacOS / Linux:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.pyUpgrade pip to the latest version (recommended):
python -m pip install --upgrade pipCreate and activate one:
-
Windows:
py -3.14.2 -m venv discord_env discord_env\Scripts\activate
-
macOS / Linux:
python3 -m venv discord_env source discord_env/bin/activateYou’ll see (discord_env) at the start of your terminal line.
With the virtual environment activated, run:
python -m pip install sounddevice numpy keyboard faster-whisperOn Linux you may need system audio libraries first:
sudo apt install portaudio19-dev python3-pyaudioOn macOS with Homebrew:
brew install portaudioGet a free token at huggingface.co/settings/tokens (read permission). Set it as environment variable:
-
Windows Command Prompt:
cmd
set HF_TOKEN=hf_xxxxxxxxxxxx
Windows PowerShell:
powershell
$env:HF_TOKEN = "hf_xxxxxxxxxxxx"
-
macOS / Linux:
export HF_TOKEN="hf_xxxxxxxxxxxx"
If you skip this, the script still works – you’ll just see a warning.
The script simulates keyboard shortcuts. Camera toggling needs a custom keybind:
-
Open Discord → User Settings (gear icon)
-
Go to Keybinds → Add a Keybind
-
Action:
Toggle Video -
Keybind: press
Ctrl+Shift+V(or any – but update the script if you change it)
Save.
Default shortcuts (work out of the box):
-
Ctrl+Shift+M→ Mute microphone -
Ctrl+Shift+D→ Deafen -
Ctrl+Shift+V→ Toggle video (needs above setup)
-
Save the script as discord_voice_controller.py in a folder.
-
Open a terminal in that folder.
-
Activate the virtual environment (if you created one).
-
Run:
python discord_voice_control.py-
The script lists your input devices – type the number of your microphone.
-
It downloads the Whisper model (tiny ~75MB) – this happens once.
-
You’ll see a live level meter: [████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0.35
-
"mute"/"unmute"– toggle mic mute -
"deafen"– toggle deafen -
"camera on"– toggle video (requires Discord keybind)
The console will show what Whisper heard and play a confirmation beep.
Press Ctrl+C to stop.
| Problem | Fix |
|---|---|
python not recognized |
Python not in PATH – reinstall with "Add to PATH" or use py instead of python on Windows. |
pip install fails on Linux |
Run sudo apt install portaudio19-dev python3-dev then try again. |
| Microphone not working | Check OS sound settings, then restart script and choose a different device number. |
| Commands ignored | Look at whisper_log.txt – it shows exactly what was transcribed. Increase BUFFER_DURATION or change WHISPER_MODEL_SIZE = "base" in the script. |
| Camera command does nothing | You must set the Toggle Video keybind in Discord manually (see instructions). |
| Keyboard shortcuts don't affect Discord | Run terminal as administrator/root – some systems block global hotkeys otherwise. |
NumPy DLL error (DLL load failed while importing _multiarray_umath) |
This is a Windows system library issue. Fix: Install/repair the Microsoft Visual C++ Redistributable (run the x64 version), then restart your computer. If that doesn't work, try: pip uninstall numpy then pip install numpy in a clean virtual environment. |
MIT – see LICENSE file.
You already have it from the previous answer – keep it as the third file in your repo.
Now your GitHub repository will have three files:
LICENSEREADME.mddiscord_voice_controller.py
All ready for users to clone and run.