Skip to content

Music Generation

Generate original, royalty-free music from text descriptions using AI.

Overview

The Music Generation API creates original compositions from natural language prompts. Control genre, tempo, duration, and output format to produce royalty-free tracks ready for any project. Stems separation lets you isolate individual instruments for remixing.

Text-to-music generation
Genre control
Tempo & duration control
Multiple formats
Royalty-free output
Stems separation

Quickstart

Generate a music track from a text description in just a few lines.

1from nur import NurClient
2
3client = NurClient()
4
5# Generate a track from a prompt
6track = client.music.generate(
7 prompt="Upbeat lo-fi hip hop beat with jazzy piano chords and vinyl crackle",
8 duration=30,
9 genre="lo-fi",
10 tempo=85
11)
12
13print(f"Track ID: {track.id}")
14print(f"Audio URL: {track.audio_url}")

Generate Music

POST/v1/music/generate

Generate an original music track from a natural language description. The model interprets your prompt to determine instrumentation, mood, and structure. Optional parameters let you constrain genre, tempo, duration, and output format.

ParameterTypeDescription
promptREQUIREDstringNatural language description of the desired music.
durationintegerTrack length in seconds (5-300). Default: 30.
genrestringTarget genre (e.g., lo-fi, electronic, classical, rock, ambient).
tempointegerTempo in BPM (40-220). Auto-detected from prompt if omitted.
output_formatstringAudio format: mp3, wav, flac, ogg. Default: mp3.
1# Generate a cinematic orchestral piece
2track = client.music.generate(
3 prompt="Epic cinematic orchestral soundtrack with sweeping strings and brass",
4 duration=60,
5 genre="classical",
6 tempo=100,
7 output_format="wav"
8)
9
10print(f"Track ID: {track.id}")
11print(f"Status: {track.status}")
12print(f"Audio URL: {track.audio_url}")
13print(f"Genre: {track.genre}, Tempo: {track.tempo} BPM")
14print(f"Duration: {track.duration}s")

Response

1{
2 "id": "trk_m8k2v9x1q4w7",
3 "status": "completed",
4 "audio_url": "https://cdn.nur.ai/music/trk_m8k2v9x1q4w7.wav",
5 "duration": 60,
6 "genre": "classical",
7 "tempo": 100,
8 "prompt": "Epic cinematic orchestral soundtrack with sweeping strings and brass",
9 "created_at": "2025-01-15T14:20:00Z"
10}

Get Track

GET/v1/music/{track_id}

Retrieve a generated music track by its ID. The response includes download URLs, waveform data for visualization, and separated stems for remixing.

ParameterTypeDescription
track_idREQUIREDstringThe unique identifier of the music track.
1# Retrieve a track with stems
2track = client.music.get("trk_m8k2v9x1q4w7")
3
4print(f"Track: {track.id}")
5print(f"Download: {track.download_url}")
6print(f"Waveform: {track.waveform_url}")
7
8# Access individual stems for remixing
9print(f"Vocals: {track.stems.vocals}")
10print(f"Drums: {track.stems.drums}")
11print(f"Bass: {track.stems.bass}")
12print(f"Other: {track.stems.other}")

Response

1{
2 "id": "trk_m8k2v9x1q4w7",
3 "status": "completed",
4 "audio_url": "https://cdn.nur.ai/music/trk_m8k2v9x1q4w7.wav",
5 "download_url": "https://cdn.nur.ai/music/trk_m8k2v9x1q4w7/download.wav",
6 "waveform_url": "https://cdn.nur.ai/music/trk_m8k2v9x1q4w7/waveform.json",
7 "duration": 60,
8 "genre": "classical",
9 "tempo": 100,
10 "prompt": "Epic cinematic orchestral soundtrack with sweeping strings and brass",
11 "created_at": "2025-01-15T14:20:00Z",
12 "stems": {
13 "vocals": "https://cdn.nur.ai/music/trk_m8k2v9x1q4w7/stems/vocals.wav",
14 "drums": "https://cdn.nur.ai/music/trk_m8k2v9x1q4w7/stems/drums.wav",
15 "bass": "https://cdn.nur.ai/music/trk_m8k2v9x1q4w7/stems/bass.wav",
16 "other": "https://cdn.nur.ai/music/trk_m8k2v9x1q4w7/stems/other.wav"
17 }
18}

Response Objects

Reference for the objects returned by the Music Generation endpoints.

MusicTrack (Generate)

FieldTypeDescription
idstringUnique identifier for the music track.
statusstringOne of: pending, processing, completed, failed.
audio_urlstringURL to stream the generated audio.
durationnumberTrack length in seconds.
genrestringDetected or specified genre of the track.
tempointegerTempo of the track in BPM.
promptstringThe original text prompt used for generation.
created_atstringISO 8601 timestamp of track creation.

MusicTrack (Get - Full)

FieldTypeDescription
idstringUnique identifier for the music track.
statusstringOne of: pending, processing, completed, failed.
audio_urlstringURL to stream the generated audio.
download_urlstringDirect download URL for the audio file.
waveform_urlstringURL to the waveform data JSON for visualization.
durationnumberTrack length in seconds.
genrestringDetected or specified genre of the track.
tempointegerTempo of the track in BPM.
promptstringThe original text prompt used for generation.
created_atstringISO 8601 timestamp of track creation.
stemsobjectSeparated stems with URLs for vocals, drums, bass, and other.

Best Practices

Write descriptive prompts

Include details about mood, instruments, and style. "Chill lo-fi beat with jazzy Rhodes piano, soft drums, and rain ambiance" produces far better results than "lo-fi music".

Use WAV for production, MP3 for previews

Generate preview tracks in MP3 for faster iteration, then re-generate your final selection in WAV or FLAC for lossless quality in production.

Leverage stems for custom mixes

Use the stems separation feature to isolate drums, bass, vocals, and other instruments. This lets you remix, adjust levels, or combine elements from multiple generations.

Set tempo explicitly for rhythmic content

If your project requires precise BPM (e.g., syncing to video), always specify the tempo parameter rather than relying on auto-detection from the prompt.