{"library":"resemble-perth","title":"Perth Audio Watermarking and Detection","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install resemble-perth"],"cli":null},"imports":["from resemble_perth import Watermarker","from resemble_perth import Detector"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import librosa\nimport numpy as np\nfrom resemble_perth import Watermarker, Detector\n\n# Create a dummy audio signal (replace with your actual audio file)\nsr = 44100 # Sample rate in Hz\nduration = 3 # seconds\n# A simple sine wave for demonstration\ny = np.sin(2 * np.pi * 440 * np.linspace(0, duration, int(sr * duration))).astype(np.float32)\n\n# Initialize Watermarker and watermark the audio\nwatermarker = Watermarker()\nwatermarked_audio = watermarker.watermark(y, sr)\n\nprint(f\"Original audio shape: {y.shape}, sample rate: {sr}\")\nprint(f\"Watermarked audio shape: {watermarked_audio.shape}\")\n\n# Initialize Detector and detect watermark\ndetector = Detector()\nis_watermarked = detector.detect(watermarked_audio, sr)\n\nprint(f\"Is audio watermarked? {is_watermarked}\")\n\n# Example with a non-watermarked audio\nnon_watermarked_audio = np.random.randn(int(sr * duration)).astype(np.float32)\nis_watermarked_false = detector.detect(non_watermarked_audio, sr)\nprint(f\"Is non-watermarked audio detected as watermarked? {is_watermarked_false}\")","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}