File size: 4,219 Bytes
83a5709
 
 
640691f
83a5709
 
 
 
4f607c0
83a5709
 
4f607c0
83a5709
4f607c0
83a5709
 
 
4f607c0
83a5709
 
 
4f607c0
83a5709
4f607c0
83a5709
 
4f607c0
 
83a5709
 
 
4f607c0
83a5709
 
 
 
 
4f607c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83a5709
4f607c0
83a5709
4f607c0
83a5709
4f607c0
 
 
 
 
83a5709
4f607c0
83a5709
4f607c0
 
 
 
83a5709
 
4f607c0
 
 
 
 
 
 
83a5709
4f607c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83a5709
 
 
 
 
 
 
 
 
 
 
 
 
4f607c0
 
 
83a5709
4f607c0
83a5709
4f607c0
83a5709
4f607c0
83a5709
4f607c0
 
 
 
 
83a5709
4f607c0
83a5709
4f607c0
 
 
83a5709
4f607c0
 
 
 
 
 
 
 
83a5709
4f607c0
 
 
 
 
 
 
 
 
83a5709
 
 
 
4f607c0
83a5709
640691f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
---
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

```bash
# 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
```bash
GET /health
```

### Get API Information
```bash
GET /info
```

### Analyze Music
```bash
POST /analyze
```

## Authentication

All API requests require an API key in the header:

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

## Usage Examples

### Single File Analysis
```bash
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
```bash
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
```python
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

```json
{
  "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

```bash
# 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](https://madverse.co) for more information.