Skip to content

rachleona/noize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Noize CLI

An easy-to-use CLI tool that uses adversarial perturbation to protect audio clips from being used in unauthorised voice cloning. Created as part of my final year project at the University of Cambridge.

Inspired by AntiFake and Glaze.

part_ii_badge python_badge pytorch_badge black_badge

⚡️ Quick start

Important

Noize works best with GPUs as it requires a lot of computational power. Please ensure you have the necessary hardware before proceeding! Otherwise please follow the guidance in the next section to run on runpod instead

First, make sure you have Git Large File Storage installed as this repository includes some large model weights stored via Git LFS. If you don't have it, please download the package here and install via

git lfs install --skip-repo

Then, install Noize using the following command

pip install git+https://github.com/rachleona/noize.git

And check using

noize --help

That's it! You are now ready to start using Noize :)

⚡️ Using runpod template

Note

Guidance to be added soon!

📖 Reference

Command line

Usage:

$ noize [OPTIONS] COMMAND [ARGS]...

Options:

  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

Commands:

  • protect: Apply adversarial perturbation to produce...
  • web: Starts Flask server for web interface
  • voices: Manage saved target voices to be used in...

noize protect

Apply adversarial perturbation to produce protected audio file

Tip

For best results, make sure to provide a voice that sounds different from the one you want to protect via the target option

Usage:

$ noize protect [OPTIONS] [FILEPATH] [OUTPUT_DIR]

Arguments:

  • [FILEPATH]: path to the audio file to apply protection on
  • [OUTPUT_DIR]: name of output directory, will be created if not already exists

Options:

  • --perturbation-level INTEGER: values between 1-10, controls how strong the noise applied is [default: 5]
  • --target TEXT: id of a saved voice for target-based optimisation
  • --config-file PATH: path to the config file, use official repo one by default
  • --output-filename TEXT: name of protected file, uses protected_<filpath> by default
  • --avc / --no-avc: whether to use adaptVC encoder in perturbation calculation [default: avc]
  • --freevc / --no-freevc: whether to use FreeVC encoder in perturbation calculation [default: freevc]
  • --xtts / --no-xtts: whether to use XTTS encoder in perturbation calculation [default: xtts]
  • --logs / --no-logs: whether to log intermediate loss values [default: no-logs]
  • --log-file TEXT: name of log file is logs are requested [default: log.csv]
  • --resource-log PATH: name of resource log file if logs are requested
  • --learning-rate FLOAT: learning rate to use for optimisation process [default: 0.02]
  • --iterations INTEGER: optimisation iterations (per audio segment) [default: 300]
  • --distance-weight FLOAT: weight used in loss functions [default: 2]
  • --snr-weight FLOAT: weight used in loss functions [default: 0.025]
  • --perturbation-norm-weight FLOAT: weight used in loss functions [default: 0.25]
  • --frequency-weight FLOAT: weight used in loss functions [default: 1.5]
  • --avc-weight FLOAT: weight used in loss functions [default: 25]
  • --freevc-weight FLOAT: weight used in loss functions [default: 25]
  • --xtts-weight FLOAT: weight used in loss functions [default: 25]
  • --help: Show this message and exit.

noize web

Starts Flask server for web interface

Usage:

$ noize web [OPTIONS]

Options:

  • --port INTEGER: port for server to listen [default: 5000]
  • --debug / --no-debug: whether to start server in debug mode [default: no-debug]
  • --help: Show this message and exit.

noize voices

Manage saved target voices to be used in protection application

Usage:

$ noize voices [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • list: Lists the ids of all saved voices that can...
  • play: Plays 10s of the reference clip given for...
  • add: Add a new saved voice for use as...
  • reset: Recalculates embeddings for a saved voice
  • resetall: Recalculates embeddings for all saved voices
  • delete: Deletes a saved voice from voice library

Python

Example usage in python:

from rachleona_noize.cli.main import protect as noize
noize("/path/to/audio.wav", "outputs/dir", output_filename="protected/audio.wav", perturbation_level=10)

All options available for the CLI are also accessible on Python!

Caution

Perturbation level below 5 is not recommended and are only provided for research purposes

🫡 Acknowledgement

This project was created with several key project as reference and includes many components pulled from existing TTS/voice cloning projects. Here I would like to credit those behind the works and contributed heavily to this project:

  • Shan et al. for creating Glaze and inspiring this project
  • Yu et al. who were behind the AntiFake project which Noize is heavily based on
  • Qin et al. who created the OpenVoice framework, which is a core part of Noize
  • Chou et al. for their work on adaptVC
  • and contributors to the Coqui TTS library, which was a great resource during the development of this project

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors