Generate royalty-free music from text prompts using Meta's MusicGen. Background tracks, jingles, soundtracks — all via a simple REST API. $0.01/generation.
import requests
response = requests.post("https://api.pixelapi.dev/v1/musicgen",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"prompt": "Upbeat electronic dance music with punchy synths "
"and a driving beat, 120 BPM",
"duration": 15 # seconds
}
)
with open("generated_music.wav", "wb") as f:
f.write(response.content)
print("Music generated!")// JavaScript / Node.js
const response = await fetch("https://api.pixelapi.dev/v1/musicgen", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
prompt: "Upbeat electronic dance music with punchy synths " +
"and a driving beat, 120 BPM",
duration: 15
})
});
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync("generated_music.wav", buffer);YouTube intros, social media reels, corporate presentations. Describe the mood and get a matching soundtrack instantly.
Background loops, menu music, level themes. Generate variations quickly for different game sections.
Notification tones, loading screens, ambient audio. Short-form audio perfect for mobile apps.
Quickly prototype musical ideas. Describe a style, tempo, and instruments — get an audio sketch in seconds.
Generate unique intro/outro music for podcasts. No licensing headaches, no stock music fees.
Quick, catchy background music for advertisements and marketing content. Generate multiple options, pick the best.
// Genre-specific prompts
"Gentle acoustic guitar folk song with soft vocals humming"
"Epic orchestral cinematic soundtrack, dramatic strings and brass"
"Lo-fi hip hop beat with jazzy piano and vinyl crackle"
"Upbeat pop rock with electric guitar riff and energetic drums"
"Ambient electronic with ethereal pads and soft arpeggios"
"Latin jazz with saxophone solo and bossa nova rhythm"| Provider | Price / Track | Model | Max Duration | Royalty-Free |
|---|---|---|---|---|
| PixelAPI | $0.01 | MusicGen | 30s | Yes |
| Replicate | $0.03+ | MusicGen | 30s | Yes |
| Suno API | $0.05+ | Suno v3 | 2min | Paid plans |
| Mubert API | $0.10+ | Proprietary | Variable | Licensed |
| Soundraw | $16/mo | Proprietary | 5min | Licensed |
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt | string | required | Text description of the music to generate |
duration | int | 8 | Duration in seconds (1–30) |
MusicGen is Meta's open-source AI music generation model. It generates high-quality music from text descriptions, supporting various genres, instruments, and moods. It produces royalty-free audio you can use commercially.
PixelAPI charges 10 credits ($0.01) per music generation. You get 100 free credits on signup — 10 free music tracks. Paid plans start at $10/month (1,000 tracks).
Yes. Music generated by MusicGen through PixelAPI is royalty-free. Use it in commercial projects, videos, apps, and games without licensing fees.
The API returns audio in WAV format. You can specify the duration — default is 8 seconds, configurable up to 30 seconds.
Yes! Describe the style in your prompt: "upbeat electronic dance music with synths", "gentle acoustic guitar folk song", "epic orchestral cinematic soundtrack". MusicGen follows text descriptions to generate matching music.