Code Examples
Ready-to-use examples for integrating the WhitePrint API.
Python
import requests
API_KEY = "your-api-key"
BASE_URL = "https://concertmaster.aimastering.tech"
# Full mastering pipeline
response = requests.post(
f"{BASE_URL}/api/v1/jobs/master",
headers={
"X-Api-Key": API_KEY,
"Content-Type": "application/json",
},
json={
"audio_url": "https://storage.example.com/track.wav",
"route": "full",
"target_lufs": -14.0,
"target_true_peak": -1.0,
},
)
# Save mastered audio
with open("mastered.wav", "wb") as f:
f.write(response.content)
# Access metadata from headers
analysis = response.headers.get("X-Analysis")
deliberation = response.headers.get("X-Deliberation")
print(f"Elapsed: {response.headers.get('X-Elapsed-Ms')}ms")Node.js
import fs from 'fs';
const API_KEY = 'your-api-key';
const BASE_URL = 'https://concertmaster.aimastering.tech';
const response = await fetch(`${BASE_URL}/api/v1/jobs/master`, {
method: 'POST',
headers: {
'X-Api-Key': API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
audio_url: 'https://storage.example.com/track.wav',
route: 'full',
target_lufs: -14.0,
target_true_peak: -1.0,
}),
});
// Save mastered audio
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync('mastered.wav', buffer);
// Access metadata
console.log('Elapsed:', response.headers.get('X-Elapsed-Ms'), 'ms');Analysis Only (JSON response)
curl -X POST https://concertmaster.aimastering.tech/api/v1/jobs/master \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"audio_url": "https://storage.example.com/track.wav",
"route": "analyze_only"
}'
# Response: JSON with BS.1770-4 metrics
# {
# "track_identity": { "duration": 240.5, "sample_rate": 44100, ... },
# "whole_track": { "lufs": -12.3, "true_peak": -0.5, "lra": 8.2, ... },
# "sections": [...],
# "problems": [...]
# }