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.
Overview
TheAudioSealWM class generates watermarks that can be embedded into audio signals. It supports both 0-bit watermarking (presence detection only) and n-bit watermarking (with secret messages).
Initialization
Typically, you’ll load a generator using
AudioSeal.load_generator() rather than instantiating directly.Methods
get_watermark
Generate a watermark signal for the given audio without applying it.Parameters
Input audio tensor of shape
(batch, channels, samples) or (batch, samples). The audio should be at the model’s expected sample rate (typically 16kHz).Sample rate of the input audio. This parameter is deprecated and will be ignored in AudioSeal 0.2+. Ensure your audio is at the correct sample rate before calling this method.
Binary message tensor of shape
(batch, nbits) or (nbits,). If None, a random message will be generated. Values should be 0 or 1.Returns
The generated watermark signal with the same shape as the input audio.
Example
forward
Generate and apply a watermark to the audio signal in one step.Parameters
Input audio tensor of shape
(batch, channels, samples) or (batch, samples).Sample rate of the input audio. This parameter is deprecated and will be ignored.
Binary message tensor of shape
(batch, nbits) or (nbits,). If None, uses a random message.Watermark strength multiplier. Values between 0.0 and 1.0. Lower values make the watermark more subtle but potentially less robust.
Returns
The watermarked audio with the same shape as the input.
Example
streaming
Context manager for streaming mode processing.Parameters
Number of parallel streams to process simultaneously.
Returns
A context manager that enables streaming mode for the encoder.
Example
random_message
Generate a random binary message for watermarking.Parameters
Batch size for the generated messages.
Returns
Random binary tensor of shape
(bsz, nbits) with values 0 or 1.Attributes
The SEANet encoder that processes input audio into hidden representations.
The SEANet decoder that generates the watermark signal from hidden representations.
The message processor that embeds the secret message into the hidden representation. None for 0-bit watermarking.
Optional normalizer that fits the watermark within the audio envelope for improved imperceptibility.
Complete Example
See Also
- AudioSeal - Model loader
- AudioSealDetector - Watermark detector
- MsgProcessor - Message embedding component
- Streaming Guide - Streaming audio processing
