ai-music-detection / README.md
juzer09's picture
Update README.md
640691f verified
metadata
license: mit
title: AI Music Detection
sdk: docker
emoji: 😻
colorFrom: purple
colorTo: green
short_description: Detect AI-generated music vs human-created music using advan
sdk_version: 1.46.1

Madverse Music: AI Music Detection API

AI-powered REST API to detect AI-generated music vs human-created music using advanced transformer technology.

What is Madverse Music?

Madverse Music is an AI-powered REST API that can detect whether music is created by AI or human artists. With the growth of AI music generation platforms like Suno and Udio, it's important to distinguish between human creativity and artificial intelligence.

Key Features

  • REST API for seamless integration
  • High accuracy: 97% F1 score with 96% sensitivity and 99% specificity
  • Supports WAV, MP3, FLAC, M4A, and OGG files via URL
  • Uses SpecTTTra transformer technology
  • Trained on 97,000+ songs
  • Concurrent processing for multiple files
  • Built with FastAPI for automatic documentation

Quick Start

Installation

# Install dependencies
pip install -r requirements.txt

# Start the API server
python app.py

The API will be available at http://localhost:8000 with automatic documentation.

API Endpoints

Health Check

GET /health

Get API Information

GET /info

Analyze Music

POST /analyze

Authentication

All API requests require an API key in the header:

X-API-Key: madverse-music-api-key-2024

Usage Examples

Single File Analysis

curl -X POST "http://localhost:8000/analyze" \
     -H "X-API-Key: madverse-music-api-key-2024" \
     -H "Content-Type: application/json" \
     -d '{"urls": ["https://example.com/song.mp3"]}'

Multiple Files Analysis

curl -X POST "http://localhost:8000/analyze" \
     -H "X-API-Key: madverse-music-api-key-2024" \
     -H "Content-Type: application/json" \
     -d '{"urls": ["https://example.com/song1.mp3", "https://example.com/song2.wav"]}'

Python Example

import requests

headers = {
    'X-API-Key': 'madverse-music-api-key-2024',
    'Content-Type': 'application/json'
}

data = {
    'urls': ['https://example.com/your-song.mp3']
}

response = requests.post('http://localhost:8000/analyze', 
                        headers=headers, json=data)
result = response.json()
print(result)

Response Format

{
  "success": true,
  "total_files": 1,
  "successful_analyses": 1,
  "failed_analyses": 0,
  "results": [
    {
      "url": "https://example.com/song.mp3",
      "success": true,
      "classification": "Real",
      "confidence": 0.85,
      "probability": 0.15,
      "raw_score": -1.73,
      "duration": 30.5,
      "message": "🎤 Detected as real music",
      "processing_time": 2.34
    }
  ],
  "total_processing_time": 2.45,
  "message": "🎤 Detected as real music"
}

Model Performance

Our model (SpecTTTra-α 120s) achieves:

  • F1 Score: 0.97
  • Sensitivity: 0.96
  • Specificity: 0.99

Technical Details

  • Model: SpecTTTra (Spectro-Temporal Tokens Transformer)
  • Sample Rate: 16kHz
  • Max Duration: 120 seconds
  • Max File Size: 100MB per file
  • Max Files per Request: 50
  • Concurrent Processing: Up to 5 files simultaneously

API Documentation

When the server is running, visit http://localhost:8000 for interactive API documentation (Swagger UI) or http://localhost:8000/docs for ReDoc format.

Supported Formats

  • MP3 (.mp3)
  • WAV (.wav)
  • FLAC (.flac)
  • M4A (.m4a)
  • OGG (.ogg)

Rate Limits

  • Maximum 50 URLs per request
  • Maximum 100MB per file
  • 5 concurrent downloads per request

Error Handling

The API provides detailed error messages for:

  • Invalid API keys (401)
  • File too large (413)
  • Unsupported formats (400)
  • Network errors (400)
  • Processing errors (500)

Environment Variables

  • MADVERSE_API_KEY: Set custom API key (default: "madverse-music-api-key-2024")

Testing

# Run API tests
python test_api.py

Acknowledgments

This API is designed for research, education, and transparency in AI music detection. Results may vary depending on audio quality and content type.

Visit madverse.co for more information.