A simple web application for adding watermark samples to audio files.
- Upload WAV audio files (44.1kHz or 48kHz, 16-bit or 24-bit)
- Automatically adds 16 watermark samples at the beginning of the file
- Downloads the processed audio file with format:
[original-name]--WM.wavfor watermarked files - Remove watermark and download with format:
[original-name]--NWM.wavfor unwatermarked files - Support for both mono and stereo audio files
- Python 3.9+
- Flask
- NumPy
- librosa (for audio metadata extraction)
- soundfile
- psycopg2-binary (for database operations)
- Clone this repository
- Install dependencies:
pip install -r requirements.txt
- Start the Flask backend server:
The backend API will run on
python app.py
http://localhost:5000and provides the following endpoints:POST /upload- Add watermark to audio filePOST /remove- Remove watermark from audio fileGET /api/nodes- Retrieve all nodes from databaseGET /api/artists- Retrieve all artists with collective information
-
Start the React frontend (in a separate terminal):
cd frontend npm install # First time only npm start
The frontend will run on
http://localhost:3000 -
Open your browser and navigate to:
http://localhost:3000 -
Upload a WAV file (44.1kHz or 48kHz, 16-bit or 24-bit) and the processed file will be automatically downloaded
The original HTML interface (index.html, artists.html) is no longer served by the backend. Use the React frontend at http://localhost:3000 instead.
The application adds 16 samples at the start of the audio file with amplitudes representing a binary pattern using two dB levels:
- 0 (low): -99dB
- 1 (high): -90dB
These dB values are converted to 16-bit amplitude values using the formula:
amplitude = 10^(dB/20) × 32767
The watermark samples are prepended to the original audio data.
- Backend: Python Flask server
- Audio Processing: NumPy for array manipulation, wave module for WAV file handling
- Frontend: Single HTML page with vanilla JavaScript
- File Format: WAV (44.1kHz or 48kHz, 16-bit or 24-bit, mono or stereo)
- Max Upload Size: 500 MB
- Download Format:
- Watermarked:
[original-name]--WM.wav - Unwatermarked:
[original-name]--NWM.wav
- Watermarked:
For production deployment:
- Use a production WSGI server (e.g., Gunicorn, uWSGI) instead of Flask's development server
- Set
debug=Falsein the Flask app configuration - Configure appropriate file upload limits
- Use HTTPS for secure file transfers
- Implement authentication if needed
To test the application with a sample file:
- Create a test audio file (or use your own 44.1kHz or 48kHz, 16-bit or 24-bit WAV file)
- Upload through the web interface
- The watermarked file will download automatically with suffix
--WM
This is an initial experimental repository looking at CoPilot and how to work closely with the ML tool to accelerate my develop throughout a more complex, holistic and useful product.
python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip setuptools wheel
python -m pip install flask numpyThere is more to come here, I'm expecting all PRs to be raised by CoPilot based on my prompts.