AI-Based Audio Watermarking Tool
Project description
WavMark
AI-based Audio Watermarking Tool
- ⚡ Leading Stability: The watermark resist to 10 types of common attacks like Gaussian noise, MP3 compression, high-pass filter, and speed variation; achieving over 29 times in robustness compared with the traditional method.
- 🙉 High Imperceptibility: The watermarked audio has over 38dB SNR and 4.3 PESQ, which means it is inaudible to humans. Listen to our demo: https://wavmark.github.io/.
- 😉 Easy for Extending: This project is entirely python based. You can easily leverage our underlying PyTorch model to implement a custom watermarking system with higher capacity and robustness.
Basic Usage
The following code adds 16-bit watermark into the input file example.wav and subsequently performs decoding:
import numpy as np
import soundfile
import torch
import wavmark
# 1.load model
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
model = wavmark.load_model().to(device)
# 2.create 16-bit payload
payload = np.random.choice([0, 1], size=16)
print("Payload:", payload)
# 3.encode watermark
signal, sample_rate = soundfile.read("example.wav")
watermarked_signal, _ = wavmark.encode_watermark(model, signal, payload, show_progress=True)
# You can save it as a new wav:
soundfile.write("output.wav", watermarked_signal, 16000)
# 4.decode watermark
payload_decoded, _ = wavmark.decode_watermark(model, watermarked_signal, show_progress=True)
BER = 100 * (1 - (payload == payload_decoded).mean())
print("Decode BER:%.1f" % BER)
How it works?
In paper WavMark: Watermarking for Audio Generation we proposed the WavMark model,
which enables encoding 32 bits of information into 1-second audio.
In this tool, we take the first 16 bits as a fixed pattern for watermark identification and the remaining 16 bits as a custom payload.
The watermark is added iteratively into the host to ensure full-time region protection:
Since the pattern length is 16, the probability of "mistakenly identifying an unwatermarked audio as watermarked" is only 1/(2^16)=0.000015.
Thanks
The audio watermarking tool "Audiowmark" developed by Stefan Westerfeld has provided valuable ideas for the design of this project.
Citation
@misc{chen2023wavmark,
title={WavMark: Watermarking for Audio Generation},
author={Guangyu Chen and Yu Wu and Shujie Liu and Tao Liu and Xiaoyong Du and Furu Wei},
year={2023},
eprint={2308.12770},
archivePrefix={arXiv},
primaryClass={cs.SD}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wavmark-0.0.1.tar.gz.
File metadata
- Download URL: wavmark-0.0.1.tar.gz
- Upload date:
- Size: 369.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b00d219a346e3bd4bfbf494c219e27308edfa48324b8db0af309deae3bd5aba
|
|
| MD5 |
4f4a3a9ca7ed42d9d3c66efc6fe50021
|
|
| BLAKE2b-256 |
6f28841187f007dcfae3d03012ccd818661eb51062be0e12441be19e3c65115e
|
File details
Details for the file wavmark-0.0.1-py3-none-any.whl.
File metadata
- Download URL: wavmark-0.0.1-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
661d4b6d047df57ad1ab60bc857845875fbd86d67896873b1bbac8c901a11192
|
|
| MD5 |
ada575b46108d79f5731bc1f977bb24d
|
|
| BLAKE2b-256 |
d6e8140850a9bdf5b6d63a6b5a25fe5d6fa691b9f86f160ed8215e58a727e14d
|