Learn how to use AudioSeal through interactive Jupyter notebooks and code examples. All examples are available in the GitHub repository.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/facebookresearch/audioseal/llms.txt
Use this file to discover all available pages before exploring further.
Getting Started
Getting Started Notebook
Getting_started.ipynb
A comprehensive introduction to AudioSeal’s core functionality. This notebook covers:
- Loading and preparing audio files with torchaudio
- Watermark generation with the AudioSeal generator
- Adding watermarks to audio signals
- Embedding optional 16-bit messages
- Watermark detection at high and low levels
- Streaming support for real-time applications (AudioSeal 0.2+)
- Visualizing waveforms and spectrograms
The Getting Started notebook includes detailed explanations and visualizations to help you understand how watermarking works at each step.
Google Colab Notebook
colab.ipynb
A Colab-optimized notebook for watermarking custom audio, such as your own recorded voice.
- Designed to run entirely in Google Colab
- Record audio directly in the browser
- Install all dependencies automatically
- Process and watermark custom audio files
- Play and download watermarked audio
Advanced Examples
Attack Benchmarking
attack_benchmarking_example.ipynb
Comprehensive guide to benchmarking AudioSeal’s robustness against audio perturbations.This notebook demonstrates:
- Loading audio datasets (RAVDESS Emotional Speech Audio)
- Watermarking multiple audio files in batch
- Applying various attacks/perturbations:
- Compression (MP3, AAC)
- Re-encoding
- Noise addition
- Re-sampling
- Speed changes
- Detecting watermarks in attacked audio
- Measuring detection confidence and accuracy
- Generating performance metrics and plots
The benchmarking notebook includes both manual and automatic dataset download options. You can use Kaggle API credentials for automated download or manually download the RAVDESS dataset.
Training Custom Models
BuildingCustomRecipe_ExampleNotebook.ipynb
Step-by-step guide to training your own AudioSeal watermarking model using AudioCraft and Dora.Topics covered:
- Installing dependencies (AudioCraft, Dora, Hydra)
- Preparing training datasets (LibriSpeech example)
- Configuring model architecture and hyperparameters
- Setting up training jobs with Dora grid search
- Running training experiments
- Evaluating trained models
- Exporting and using custom checkpoints
Supporting Files
The examples directory also includes helper scripts:notebook.py
Utility functions used across notebooks:play_audio(): Play audio in Jupyter/Colabplot_waveform_and_specgram(): Visualize audio signals- Audio format conversion helpers
attacks.py
Implementations of various audio perturbations for benchmarking:- Compression attacks (MP3, AAC, Opus)
- Additive noise (Gaussian, uniform)
- Re-sampling and bit depth reduction
- Speed and pitch modifications
- Filtering and equalization
Running the Examples
Local Setup
To run examples locally:Google Colab
Click the Colab badge in any notebook to open it directly in Google Colab:- Open the colab.ipynb
- Enable GPU acceleration: Runtime > Change runtime type > GPU
- Run cells sequentially
Some notebooks may require additional setup steps like downloading datasets or configuring API credentials. Follow the instructions in each notebook.
Code Snippets
Quick reference for common operations:Basic Watermarking
Streaming Watermarking
Batch Processing
Additional Resources
- GitHub Repository: facebookresearch/audioseal
- Training Documentation: TRAINING.md
- Example Attacks: attacks.py
- Model Cards: src/audioseal/cards/
All examples are maintained and updated with each AudioSeal release. Check the repository for the latest versions and any new examples.
