Realtime Censor is a Python application that captures live audio from your microphone, transcribes it in real time using state-of-the-art speech-to-text models, and censors (mutes) any detected swear words before the audio is played through your speakers. The application also displays a live transcription with censored words highlighted, providing both audio and visual feedback.
-
Python 3.10+
The main programming language for the application. -
sounddevice
For real-time audio capture from the microphone and playback to the speakers. -
NumPy
For efficient audio data manipulation. -
RealtimeSTT
Handles real-time speech-to-text transcription, supporting models like Whisper and faster-whisper. -
CTranslate2
Backend for running Whisper and faster-whisper models efficiently. -
better_profanity
For fast and accurate detection of swear words in transcribed text. -
Rich
For beautiful, colorized live transcription display in the terminal. -
colorama
For cross-platform colored terminal output.
-
Captures Audio:
Continuously records audio from your microphone in small chunks. -
Transcribes Speech:
Uses a real-time local speech-to-text engine (like Whisper or faster-whisper) to transcribe each chunk of audio as you speak. -
Detects Swear Words:
Checks each transcribed chunk for the presence of swear words using a customizable profanity filter. -
Censors Audio:
If a swear word is detected, after a short delay, the corresponding audio chunk is muted before being played through your speakers, ensuring that offensive language is not broadcast.
-
Install dependencies:
pip install -r requirements.txt -
Run the application:
python main.py -
Speak into your microphone:
- Your speech will be transcribed and displayed in real time.
- If you say a swear word, it will be muted in the audio output and highlighted in the transcription.
-
Swear Words List:
You can expand or modify the list of censored words in theSWEAR_WORDSset inmain.py. -
Model Selection:
You can choose different Whisper or faster-whisper models for speed/accuracy trade-offs using command-line arguments. -
Audio Devices:
Specify input/output devices using--input-deviceand--output-devicearguments.
- OpenAI Whisper, faster-whisper, and CTranslate2 teams for speech-to-text technology.
- The authors of sounddevice, better_profanity, and Rich