Skip to content

SafeSound: Audio Profanity Filter is a tool that processes audio files and exports a version with the profanity muted.

License

Notifications You must be signed in to change notification settings

janksmap/SafeSound

Repository files navigation

SafeSound: Audio Profanity Filter

SafeSound is a tool that processes audio files and exports a version with the profanity muted.

How it works

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.

Requirements

  • 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.

Installation

⭐️ For easy installation, download the macOS installer on the releases page and then skip to the usage instructions.

  1. 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
  2. Install dependencies:
    pip install -r requirements.txt
  3. Ensure ffmpeg is installed and available in your PATH.
  4. Copy the contents of .env.template to .env to setup the environment variables (.env)
  5. Install and open Docker.

Usage

⚠️ 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's base model. You can change this in the .env file. I recommend using Turbo because 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:

Whisper 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.txt is NSFW as all the words are in plain text.

Uninstall

  • 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

Development

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT LICENSE

Image Credits

The GitHub preview and installer icons were created by combining Flaticon.com images into new designs using AI.

About

SafeSound: Audio Profanity Filter is a tool that processes audio files and exports a version with the profanity muted.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages