A sophisticated browser-based audio watermarking system that embeds and detects invisible, robust digital watermarks in audio files. Built using advanced signal processing techniques including psychoacoustic masking, spread spectrum modulation, and error correction coding.
This project provides a complete end-to-end audio watermarking solution consisting of two main components:
- Embedder - Embeds invisible watermarks into audio files
- Detector - Detects and extracts watermarks from audio files
Both tools run entirely in the browser using JavaScript, requiring no server-side processing. They implement state-of-the-art digital signal processing techniques to create watermarks that are:
- Invisible: Perceptually transparent to human listeners
- Robust: Resistant to various signal processing operations
- Secure: Uses cryptographic spreading sequences
- Reliable: Incorporates error correction coding
Audio watermarking is the process of embedding imperceptible data (the "watermark") into an audio signal. Unlike metadata that can be easily stripped, watermarks are embedded directly into the audio samples themselves and remain part of the signal even after format conversions, compression, or other processing.
- Copyright Protection: Prove ownership of audio content
- Broadcast Monitoring: Track when and where content is played
- Leak Tracking: Identify the source of unauthorized distribution
- Content Authentication: Verify audio hasn't been tampered with
- Metadata Embedding: Store information within the audio itself
- Navigate to the
embedder/directory - Open
index.htmlin a modern web browser - Load an audio file (WAV or MP3)
- Enter your watermark data (up to 50 characters)
- Click "Embed Watermark"
- Download the watermarked audio file
Example:
Input Audio: song.wav
Watermark Data: "12345ABCD"
Output: song_watermarked.wav
- Navigate to the
detector/directory - Open
index.htmlin a modern web browser - Load a watermarked audio file
- Click "Detect Watermark"
- View detection results and extracted data
Example Output:
✓ Watermark Detected
Confidence Score: 87.3%
Extracted Data: "12345ABCD"
- FFT/IFFT: Fast Fourier Transform for frequency domain processing
- Psychoacoustic Masking: Embeds watermark below human hearing threshold
- Spread Spectrum: PN (Pseudo-Random Noise) sequence spreading with 4x redundancy
- Error Correction: Reed-Solomon coding (can correct up to 5 symbol errors)
- Temporal Integration: Combines detection across multiple frames
The embedder uses a sophisticated psychoacoustic model based on:
- Bark Scale: Perceptual frequency scale matching human auditory system
- Critical Bands: 24 bands matching auditory filter banks
- Masking Threshold: Simultaneous masking using spreading function
- ATH: Absolute Threshold of Hearing (frequency-dependent)
This ensures watermarks remain completely inaudible while maintaining robustness.
The detector uses correlation-based detection to find the watermark:
- Frame Analysis: Processes overlapping audio frames
- Feature Extraction: Extracts frequency domain features
- PN Correlation: Correlates with known spreading sequence
- Temporal Integration: Combines results across frames with confidence weighting
- Error Correction: Applies Reed-Solomon decoding
- Verification: Validates extracted data integrity
Audio Watermarking System
│
├── Embedder
│ ├── Audio Input (WAV/MP3)
│ ├── Frame Segmentation
│ ├── FFT Analysis
│ ├── Psychoacoustic Analysis
│ ├── Watermark Encoding (Reed-Solomon + PN Spreading)
│ ├── Magnitude Modification
│ ├── IFFT Reconstruction
│ └── Audio Output (WAV)
│
└── Detector
├── Audio Input (WAV/MP3)
├── Frame Segmentation
├── FFT Analysis
├── Feature Extraction
├── PN Correlation
├── Temporal Integration
├── Watermark Decoding (Reed-Solomon)
└── Results Output (JSON)
Audio-Watermarking/
├── README.md # This file
├── LICENSE # Project license
│
├── embedder/ # Watermark embedding tool
│ ├── index.html # Web interface
│ ├── main.js # UI controller
│ ├── watermark.js # Main watermarking engine
│ ├── psychoacoustic.js # Psychoacoustic masking model
│ ├── fft.js # FFT implementation
│ ├── reed-solomon.js # Error correction
│ └── README.md # Embedder documentation
│
└── detector/ # Watermark detection tool
├── index.html # Web interface
├── main.js # UI controller
├── detector.js # Detection engine
├── fft.js # FFT implementation
├── reed-solomon.js # Error correction
└── README.md # Detector documentation
- Invisible watermarking below psychoacoustic masking threshold
- Robust error correction (Reed-Solomon coding)
- Spread spectrum security
- Real-time progress tracking
- Configurable embedding strength
- Support for WAV and MP3 input
- Audio preview before download
- Correlation-based detection
- Confidence scoring
- Temporal integration across frames
- Automatic error correction
- Detailed detection statistics
- Support for WAV and MP3 input
- Export results as JSON
| Parameter | Default Value | Range | Description |
|---|---|---|---|
| Frame Size | 2048 samples | 1024-4096 | FFT window size |
| Overlap | 50% | 25-75% | Frame overlap percentage |
| Embed Strength | 0.01 | 0.001-0.1 | Watermark amplitude |
| Temporal Redundancy | 3x | 1-10x | Repetition factor |
| Frequency Range | 500-8000 Hz | - | Embedding frequency band |
| Spreading Factor | 4x | - | PN sequence spreading |
| ECC Symbols | 10 | - | Reed-Solomon error correction |
| Max Data Length | 50 chars | - | Maximum watermark size |
Both tools require a modern browser with support for:
- Web Audio API
- FileReader API
- Typed Arrays (Float32Array, Uint8Array)
- ES6+ JavaScript features (async/await, classes, arrow functions)
Tested on:
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
Processing time varies based on audio duration, sample rate, and settings:
| Audio Duration | Sample Rate | Typical Processing Time |
|---|---|---|
| 30 seconds | 44.1 kHz | 2-5 seconds |
| 3 minutes | 44.1 kHz | 10-20 seconds |
| 10 minutes | 44.1 kHz | 30-60 seconds |
Times measured on modern desktop hardware. Mobile devices may be slower.
-
Parameter Matching: Detector settings must match embedder settings
- Frame size
- Temporal redundancy
- Spreading factor
- PN sequence seed
-
No Synchronization: Current version assumes:
- No time-shifting or trimming
- Same sample rate as original
- No sample position changes
-
Single Channel: Only processes first channel of stereo audio
-
Limited Attack Resistance: Not extensively tested against:
- Heavy lossy compression
- Aggressive filtering/EQ
- Time stretching or pitch shifting
- Analog recording and playback
-
Format Limitations:
- Embedder outputs WAV only
- No MP3 output encoding (yet)
-
Clone or download this repository
git clone https://github.com/yourusername/Audio-Watermarking.git cd Audio-Watermarking -
No installation required! Just open the HTML files:
embedder/index.html- To embed watermarksdetector/index.html- To detect watermarks
-
Read the detailed documentation:
Both tools are implemented in vanilla JavaScript with no external dependencies. Key modules:
- fft.js: Cooley-Tukey radix-2 FFT implementation
- reed-solomon.js: Reed-Solomon error correction over GF(256)
- psychoacoustic.js: Psychoacoustic masking model
- watermark.js / detector.js: Core embedding/detection logic
- main.js: UI controller and audio I/O
All code is well-commented and modular for easy understanding and modification.
- Load audio file and convert to frequency domain (FFT)
- Analyze psychoacoustic properties to find "hiding spots"
- Encode watermark data with error correction
- Spread data using pseudo-random sequence
- Embed into selected frequency bins below masking threshold
- Convert back to audio (IFFT) and save
- Load potentially watermarked audio
- Convert to frequency domain (FFT)
- Correlate with known spreading sequence
- Combine detection results across frames
- Decode using error correction
- Extract and verify watermark data
- Synchronization codes for time-shift resilience
- Multi-channel stereo processing
- MP3 output encoding
- Automatic parameter detection
- Comprehensive robustness testing
- Batch processing support
- Visual spectrogram display
- Mobile app versions
- Real-time streaming watermarking
This implementation is based on research in:
- Zwicker, E., & Fastl, H. (1999). Psychoacoustics: Facts and Models
- ISO/IEC 11172-3 (MPEG-1 Audio Layer 3)
- Cox, I. J., et al. (2008). Digital Watermarking and Steganography
- Kirovski, D., & Malvar, H. (2003). Spread-spectrum watermarking of audio signals
- Kay, S. M. (1998). Fundamentals of Statistical Signal Processing: Detection Theory
- Reed, I. S., & Solomon, G. (1960). Polynomial Codes Over Certain Finite Fields
See LICENSE file for details.
This is an educational implementation demonstrating audio watermarking concepts. It is suitable for:
- Learning about digital signal processing
- Understanding psychoacoustic principles
- Studying error correction codes
- Research and experimentation
- Academic projects
Important Notes:
- This tool is for educational and research purposes only
- Ensure you have the right to modify any audio files you process
- Watermarking does not constitute legal proof of ownership without proper certification infrastructure
- Detection results should be validated independently
- False positives are possible with low correlation thresholds
- Not intended for production use without further robustness testing
Contributions are welcome! Areas for improvement:
- Enhanced attack resistance
- Better synchronization mechanisms
- Additional output format support
- Performance optimizations
- Comprehensive test suite
- Documentation improvements
For detailed usage instructions and technical documentation:
Built with: Vanilla JavaScript, Web Audio API, Digital Signal Processing
Keywords: Audio Watermarking, Spread Spectrum, Psychoacoustics, FFT, Reed-Solomon, Digital Signal Processing, Copyright Protection