monkeyplug is a little script to mute profanity in audio files.
Project description
monkeyplug
monkeyplug is a little script to mute profanity in audio files (intended for podcasts, but YMMV) in a few simple steps:
- The user provides a local audio file (or a URL pointing to an audio file which is downloaded)
- The Vosk-API is used to recognize speech in the audio file
- Each recognized word is checked against a list of profanity or other words you'd like muted
ffmpeg
is used to create a cleaned audio file, muting the objectional words
You can then use your favorite media player to play the cleaned audio file.
monkeyplug is part of a family of projects with similar goals:
- 📼 cleanvid for video files
- 🎤 monkeyplug for audio files
- 📕 montag for ebooks
Installation
Using pip
, to install the latest release from PyPI:
python3 -m pip install -U monkeyplug
Or to install directly from GitHub:
python3 -m pip install -U 'git+https://github.com/mmguero/monkeyplug'
Prerequisites
monkeyplug requires:
- FFmpeg
- Python 3
- delegator.py
- vosk-api Python bindings
- A Vosk-API compatible model in a subdirectory named
model
in the same directory asmonkeyplug.py
, or in a custom directory location indicated with the--model
runtime option or theVOSK_MODEL
environment variable
To install FFmpeg, use your operating system's package manager or install binaries from ffmpeg.org. The Python dependencies will be installed automatically if you are using pip
to install monkeyplug.
usage
usage: monkeyplug.py <arguments>
monkeyplug.py
options:
-v [true|false], --verbose [true|false]
Verbose/debug output
-i <string>, --input <string>
Input audio file (or URL)
-o <string>, --output <string>
Output audio file
-w <profanity file>, --swears <profanity file>
text file containing profanity (default: "swears.txt")
-a APARAMS, --audio-params APARAMS
Audio parameters for ffmpeg (default: "-c:a libmp3lame -ab 96k -ar 44100 -ac 2")
-x <string>, --extension <string>
Output audio file extension (default: "mp3")
-m <string>, --model <string>
Vosk model path (default: "model")
-f <int>, --frames <int>
WAV frame chunk (default: 16000)
Docker
Alternately, a Dockerfile is provided to allow you to run monkeyplug in Docker. You can pull either the ghcr.io/mmguero/monkeyplug:small
or ghcr.io/mmguero/monkeyplug:large
Docker images, or build with build_docker.sh
, then run monkeyplug-docker.sh
inside the directory where your audio files are located.
Contributing
If you'd like to help improve monkeyplug, pull requests will be welcomed!
Authors
- Seth Grover - Initial work - mmguero
License
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Acknowledgments
Thanks to:
- the developers of FFmpeg
- Mattias Wadman for his ffmpeg image
- delegator.py developer Kenneth Reitz and contributors
- Vosk and vosk-api developers and contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file monkeyplug-1.0.1.tar.gz
.
File metadata
- Download URL: monkeyplug-1.0.1.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee61b649c833dc3a21c863c87713e8bd87ca22140f8e3fbc029afebc8ce49290 |
|
MD5 | a84e03af97a6dec87406603a2d233fb0 |
|
BLAKE2b-256 | 7c9be38fe13354e4a6c19fa60c1ba24b3c80432666f1086a45f36de6c120f92b |
File details
Details for the file monkeyplug-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: monkeyplug-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ea8dc033e3d68e78656c9ad9d34b5e1b3ee155b5a5e969747cdc2dbdf2cd2bb |
|
MD5 | 452763c8dbe55fac4f36fd9e526e4627 |
|
BLAKE2b-256 | eb1aabaaeb48419e528830745a368f1d91abbf5fc0f8c96d632723670e4c0e1c |