Skip to main content

Censorship Audio is a Python library that allows you to censor specific words in an audio file based on a given list of words.

Project description

CENSORSHIP.PY

Static Badge Static Badge PyPI - Downloads

Censorship Audio is a Python library that allows you to censor specific words in an audio file based on a given list of words. The library outputs a censored version of the input audio, replacing the specified words with a beep sound.

Features

  • Audio Censorship: Automatically censors a list of provided words in an audio file.
  • Text-to-Speech Integration: Supports transcribing audio to text using Faster-Whisper.
  • Customizable Word List: You can easily add or modify the words you want to censor.

Installation

pip install censorship.py

Make sure you have installed ffmpeg for audio processing.

Use this command if you have Linux or a subsystem (recommended)

sudo apt update && sudo apt install ffmpeg

Or install it on Windows using Chocolatey

choco install ffmpeg

Usage

Here is an example of how to use the Censorship Audio library:

from censorship import Censorship_Audio

if __name__ == "__main__":
    censorship = Censorship_Audio()  # Create an instance of the Censorship class
    censorship.censure_audio('audio_to_censure.mp3', 'censored_audio.mp3', ['word1', 'word2'])

    # Optional: Transcribe the censored audio to text
    audio_to_text = censorship.return_audio_text('censored_audio.mp3')
    print(audio_to_text)

Changing Whisper Model Parameters

By default, Censorship Audio uses the large-v3 Whisper model with cpu as the device and int8 for the compute type. However, you can change these parameters based on your system's capabilities or model preferences.

You can check the differents types of models and parameter in the faster-whisper documentation.

Example

# Create an instance with custom Whisper model parameters
# Run on GPU with FP16
censorship = Censorship_Audio(model_size='large-v2', device='"cuda"', compute_type='"float16"')

Contributing

If you find a bug or have an idea for improvement, feel free to open an issue or submit a pull request. Contributions are always welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

censorship_py-0.16.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

censorship.py-0.16-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file censorship_py-0.16.tar.gz.

File metadata

  • Download URL: censorship_py-0.16.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for censorship_py-0.16.tar.gz
Algorithm Hash digest
SHA256 78314e7fed9b978dfcaaea09fa9cf829437e1f90a9a6edbda472c5bc65bc353c
MD5 9d4f1e9e670eda35263d086e17b8ca61
BLAKE2b-256 42433078eb95588ee22a2f8038a3e7c36856b5a029d21c4286cfbc588d2fd3a7

See more details on using hashes here.

File details

Details for the file censorship.py-0.16-py3-none-any.whl.

File metadata

File hashes

Hashes for censorship.py-0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 e986e310d5c58aa494f9d957ae2bc47cb39e55b82b442a41b1c9bb798619a288
MD5 673347f8672895b063d8234806e2c9dd
BLAKE2b-256 5f139e5ebefbbcf341e99058af68e7493a15c21148fd40d27358fed1b8351726

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page