Registry / ai-ml / resemble-perth

resemble-perth

JSON →
library1.0.1pypypiunverified

resemble-perth is an audio watermarking and detection library developed by Resemble AI. It allows embedding and detecting imperceptible watermarks in audio signals, primarily designed for identifying AI-generated content. The current stable version is 1.0.1, with new releases typically occurring as features are added or bug fixes are made.

pip install resemble-perth
INSTALL
IMPORT
SIG · RESEMBLE-PERTH
R
resemble-perth
ai-mlpythonv1.0.1
Install
2.1s avg
Import
Disk
52MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 53.7MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.1s · import 0.000s · 54MB
52MB installed
● package 52MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Watermarker
from perth import Watermarker
from perth import Watermarker

This quickstart demonstrates how to initialize the Watermarker and Detector, embed a watermark into a dummy audio signal, and then detect its presence. It also shows a detection attempt on an unwatermarked signal.

import librosa import numpy as np from resemble_perth import Watermarker, Detector # Create a dummy audio signal (replace with your actual audio file) sr = 44100 # Sample rate in Hz duration = 3 # seconds # A simple sine wave for demonstration y = np.sin(2 * np.pi * 440 * np.linspace(0, duration, int(sr * duration))).astype(np.float32) # Initialize Watermarker and watermark the audio watermarker = Watermarker() watermarked_audio = watermarker.watermark(y, sr) print(f"Original audio shape: {y.shape}, sample rate: {sr}") print(f"Watermarked audio shape: {watermarked_audio.shape}") # Initialize Detector and detect watermark detector = Detector() is_watermarked = detector.detect(watermarked_audio, sr) print(f"Is audio watermarked? {is_watermarked}") # Example with a non-watermarked audio non_watermarked_audio = np.random.randn(int(sr * duration)).astype(np.float32) is_watermarked_false = detector.detect(non_watermarked_audio, sr) print(f"Is non-watermarked audio detected as watermarked? {is_watermarked_false}")
Debug
Known issues
gotchaOptimal Performance with Specific Sample Rates
fix
For best results and accuracy, ensure input audio is resampled to 44.1 kHz or 24 kHz. Other sample rates might impact watermarking and detection performance. Use a library like `librosa.resample` for this.
affects: 1.0.x
gotchaInput Audio Must Be a NumPy Array
fix
The `watermark` and `detect` methods strictly expect audio data as a 1D `numpy.ndarray` (float32 or float64). Ensure your audio files are loaded and converted into this format. `librosa.load` is a recommended tool.
affects: 1.0.x
gotchaCPU-bound Processing for Large Audio
fix
The library primarily uses CPU for processing. For very long audio files or large datasets, consider segmenting audio into smaller chunks for processing or optimizing your processing pipeline externally, as direct GPU acceleration is not currently offered.
affects: 1.0.x
Upgrade
Version history
1.0.1latest on PyPI · released May 23, 2025
Audit
Dependencies
numpyrequiredFundamental numerical operations and array handling for audio data.
scipyrequiredScientific computing library, used for signal processing tasks.
soundfilerequiredReading and writing audio files in various formats.
audioreadrequiredBackend for reading diverse audio formats.
librosarequiredAudio analysis library, commonly used for loading and preprocessing audio data (recommended in examples).
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
resemble-perth — pip install resemble-perth · libregistry