Audio Watermarking and Detection Library
Low maintenance activity. Last release 18 months ago, commits in 1 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install resemble-perthPerth
Perth is a comprehensive Python library for audio watermarking and detection.
Overview
Perth enables you to embed imperceptible watermarks in audio files and later detect them, even after the audio has undergone various transformations or manipulations. The library implements multiple watermarking techniques including neural network-based approaches.
Features
- Multiple Watermarking Techniques: Including the Perth-Net Implicit neural network approach
- Robust Watermarks: Watermarks can survive common audio transformations like compression, resampling, and more
- Command-Line Interface: Easy to use CLI for quick watermarking tasks
- Python API: Comprehensive API for integration into your applications
- Quality Metrics: Tools to evaluate the perceptual quality of watermarked audio
Installation
From PyPI (Recommended)
pip install resemble-perth
From Source
git clone https://github.com/resemble-ai/Perth
cd Perth
pip install -e .
Quick Start
Command Line Usage
# Apply a watermark to an audio file
perth input.wav -o output.wav
# Extract a watermark from an audio file
perth input.wav --extract
Python API Usage
Applying a Watermark
import perth
import librosa
import soundfile as sf
# Load audio file
wav, sr = librosa.load("input.wav", sr=None)
# Initialize watermarker
watermarker = perth.PerthImplicitWatermarker()
# Apply watermark
watermarked_audio = watermarker.apply_watermark(wav, watermark=None, sample_rate=sr)
# Save watermarked audio
sf.write("output.wav", watermarked_audio, sr)
Extracting a Watermark
import perth
import librosa
# Load the watermarked audio
watermarked_audio, sr = librosa.load("output.wav", sr=None)
# Initialize watermarker (same as used for embedding)
watermarker = perth.PerthImplicitWatermarker()
# Extract watermark
watermark = watermarker.get_watermark(watermarked_audio, sample_rate=sr)
print(f"Extracted watermark: {watermark}")
Perth Implicit Watermarker
The Perth-Net Implicit watermarker uses a neural network-based approach for embedding and extracting watermarks. It's designed to be robust against various audio manipulations while maintaining high audio quality.