Check a File for the AI Watermark

Every audio file made with cut.audio's text to speech carries an inaudible watermark that says it is AI-generated. The EU AI Act requires AI-generated audio to be marked this way. The watermark is in the sound itself, so it is still there in the MP3 and the WAV. Anyone can read it with a free, open-source detector. This page shows how. The check runs on your own computer and nothing is uploaded.

What you need

Python 3.10 or newer and about 1.5 GB of free disk space. No graphics card is needed. The steps are for Linux and macOS; on Windows, activate the environment with venv\Scripts\activate instead of the second line.

1. Install the detector

python3 -m venv venv
. venv/bin/activate
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install audioseal==0.2.1 librosa

2. Save this script

Save it as check_ai_mark.py in the same folder.

check_ai_mark.py
"""Does an audio file carry cut.audio's AI watermark?

    python3 check_ai_mark.py file.mp3 [more files…]

Speech made with cut.audio's text to speech carries an inaudible watermark
(AudioSeal, by Meta, MIT licence) with a 16-bit message that is ours. This
reads it back with AudioSeal's public detector. Nothing is uploaded.
"""
import os
import sys

os.environ.setdefault("NO_TORCH_COMPILE", "1")  # AudioSeal otherwise wants a C compiler

import librosa
import torch
from audioseal import AudioSeal

RATE = 24000  # the rate the speech is made and marked at
CUT_AUDIO = (1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1)


def main():
    if len(sys.argv) < 2:
        sys.exit(__doc__)
    detector = AudioSeal.load_detector("audioseal_detector_16bits").eval()
    for path in sys.argv[1:]:
        audio, _ = librosa.load(path, sr=RATE, mono=True)
        wav = torch.from_numpy(audio[: 30 * RATE])[None, None, :]
        with torch.no_grad():
            probability, message = detector.detect_watermark(wav, RATE)
        bits = sum(int(a) == b for a, b in zip(message[0].tolist(), CUT_AUDIO))
        if probability >= 0.5 and bits >= 15:
            verdict = "AI-generated with cut.audio"
        elif probability >= 0.5:
            verdict = "carries an AudioSeal watermark, not cut.audio's"
        else:
            verdict = "no watermark found"
        print(f"{path}: watermark {float(probability):.2f}, {bits} of 16 bits match: {verdict}")


if __name__ == "__main__":
    main()

3. Check your file

python check_ai_mark.py speech.mp3

Replace speech.mp3 with your file. The first run downloads the detector, about 30 MB.

What the result means

speech.mp3: watermark 1.00, 16 of 16 bits match: AI-generated with cut.audio

How it works

The watermark is made with AudioSeal, an open-source watermark for speech published by Meta under the MIT licence. It hides a 16-bit message in the audio. Ours is 1100 1010 0111 0101, the same in every file: it identifies the service, not you and not your text. The script reads the first 30 seconds of a file. Every download from the tool also says so in plain text, in the comment field of its metadata: "AI-generated speech (synthetic voice). Made with cut.audio." That note is easy to remove; the watermark is the marking that stays.