SafeSound is a tool that processes audio files and exports a version with the profanity muted.
SafeSound uses OpenAI's Whisper model to transcribe audio files. Then, it uses Gentle: Forced Aligner to precisely sync the transcription with the audio. Finally, a custom Python script mutes profanity based on the aligned transcription and exports a cleaned audio file.
- Python 3.10
- Docker (for running Gentle, the forced aligner)
- ffmpeg (for audio processing)
⚠️ Note: SafeSound has only been tested on macOS. Windows and Linux may work but are not guaranteed.
⭐️ For easy installation, download the macOS installer on the releases page and then skip to the usage instructions.
- Install Python 3.10 (I recommend using pyenv):
pyenv install 3.10 pyenv local 3.10 $(pyenv which python3) -m venv venv source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Ensure
ffmpegis installed and available in your PATH. - Copy the contents of
.env.templateto.envto setup the environment variables (.env) - Install and open Docker.
⚠️ IMPORTANT: Before running the program, make sure Docker is running. If you're using Docker desktop, this is as easy as opening the app. You can close out of it as long as it's still running in the background.
Navigate to the SafeSound directory and activate venv:
cd /Users/<your_user>/Downloads/SafeSound
source venv/bin/activate
To run SafeSound, use the following command (You must be in the SafeSound directory):
python3 safe_sound.py <path_of_file_to_edit>You can also process multiple files by typing:
python3 safe_sound.py <file1> <file2> etc...
Or, you can do a whole directory:
python3 safe_sound.py <directory_name>/*
⚠️ Note: By default, SafeSound will use Whisper'sbasemodel. You can change this in the.envfile. I recommend usingTurbobecause it's the best balance of speed and accuracy. Of course, the model you run will depend on your available hardware. Here are the available models:
You can modify the profanity.txt file to customize the word list to your preference. It allows for individual words or entire phrases.
⚠️ Warning:profanity.txtis NSFW as all the words are in plain text.
- You can easily uninstall any or all of the dependencies originally downloaded by the installer by running:
./uninstall.sh
If it says "Permission Denied", you may need to first run:
sudo chmod +x uninstall.sh
- Entry point:
safe_sound.py - Key modules:
loading.py: Handles progress bar.mute_profanity.py: Mutes profanities in audio.gentle.py: Integrates with Gentle for forced alignment.transcriber.py: Handles transcription tasks.
- Executables:
- Currently, there is an installer that will download the necessary components and clone the repo. You can find its script files in the executables folder.
See CONTRIBUTING.md for guidelines.
The GitHub preview and installer icons were created by combining Flaticon.com images into new designs using AI.
