§ Game music · Loops in layers

AI game music generator

Published November 2026

Looping music for a game: written to come round, exactly its bars long, with every part as its own layer to fade in and out.

Get an API key →OpenAPI 3.1The job catalog

A free account has 120 credits a month. The catalog, a quote and the OpenAPI document need no key.

Market Waltz, a town theme for a game: written as 463 notes by an AI composer and played through the API on November 16, 2026. 32 bars of 3/4 at 144 bpm, 40.000 seconds, 1,920,000 samples. It plays round with no crossfade in the page, and the slider fades whole layers in and out. The score it was played from: the MIDI file. The audio, lossless: the loop, harp and bass, strings, clarinet and celesta, flute and oboe.

What makes it loop

A piece of music cut at its last bar does not loop. The last notes and the room are still sounding at the cut, so the repeat starts dry and the ear hears the join. Three things have to be true, and here they are:

The answer says how the join measures: loop.seam_db is the step from the last sample to the first against the largest steps inside the music. The demo's is −20.2 dB: well under its own note attacks.

Two calls

Make a key at Settings → API keys and send it as X-API-Key (or Authorization: Bearer):

export DOO_API_KEY=dsk_live_...

First the notes, played. The demo's score is a MIDI file with a track for each part; the call gives the tempo and names an instrument for each track. Your own file goes in its place, or send the notes inline as parts:

curl -s -X POST https://api.doseedo.com/api/jobs \
  -H "X-API-Key: $DOO_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: market-waltz-v1' \
  -d '{
  "kind": "render_score",
  "input": {
    "bpm": 144,
    "midi_url": "https://doseedo.com/static/game/market-waltz/score.mid",
    "instruments": {
      "Flute": { "instrument": "flute" },
      "Oboe": { "instrument": "oboe" },
      "Clarinet": { "instrument": "clarinet" },
      "Celesta": { "instrument": "celesta" },
      "Harp": { "instrument": "harp" },
      "Double bass": { "instrument": "double_bass_pizz" },
      "Violas": { "instrument": "viola", "players": 4 },
      "Cellos": { "instrument": "cello", "players": 3 }
    }
  }
}'

Then its mix, as a loop, with every part printed alone. This is the call as the demo made it: loop and print_parts are what make the loop and its layers; the style is the room, and the balance brings its tune forward a little.

curl -s -X POST https://api.doseedo.com/api/jobs \
  -H "X-API-Key: $DOO_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: market-waltz-loop-v1' \
  -d '{
  "kind": "mix",
  "input": {
    "from_job": "<the render_score job id>",
    "loop": { "bars": 32, "bpm": 144, "beats_per_bar": 3 },
    "print_parts": true,
    "style": "film-scoring-stage",
    "balance": { "Flute": 2.5, "Oboe": 2.5, "Clarinet": -1, "Harp": -1, "Double bass": -2 }
  }
}'

The finished mix job, trimmed to its shape. This is the demo's own, from November 16, 2026:

{
  "object": "job",
  "kind": "mix",
  "status": "succeeded",
  "output": {
    "mix_url": "https://api.doseedo.com/api/files/…/market-waltz_mix.wav",
    "loop": { "length_s": 40, "samples": 1920000, "sr": 48000, "passes": 2, "seam_db": -20.2 },
    "loudness": { "lufs": -17.99, "true_peak_db": -2.66 },
    "part_stems": [
      { "name": "Flute", "url": "…/market-waltz_Flute.wav" },
      { "name": "Oboe", "url": "…/market-waltz_Oboe.wav" },
      { "name": "Clarinet", "url": "…/market-waltz_Clarinet.wav" },
      { "name": "Celesta", "url": "…/market-waltz_Celesta.wav" },
      { "name": "Harp", "url": "…/market-waltz_Harp.wav" },
      { "name": "Double bass", "url": "…/market-waltz_Double-bass.wav" },
      { "name": "Violas", "url": "…/market-waltz_Violas.wav" },
      { "name": "Cellos", "url": "…/market-waltz_Cellos.wav" }
    ]
  }
}

The score has eight parts (flute, oboe, clarinet, celesta, harp, double bass, violas, cellos), and every one passed its check against its notes. Result links are pre-signed: download them with a plain GET and no header. They last 24 hours, and a result link is accepted as the audio_url of a later job.

The whole thing as one Python script, with requests:

import os, requests

API = "https://api.doseedo.com"
H = {"X-API-Key": os.environ["DOO_API_KEY"]}

def run(kind, input, key=None):
    """Submit a job and long-poll it to the end. Returns the finished job."""
    r = requests.post(f"{API}/api/jobs", json={"kind": kind, "input": input},
                      headers={**H, **({"Idempotency-Key": key} if key else {})})
    job = r.json()
    if r.status_code >= 400:
        raise SystemExit(job["error"])
    while job["status"] in ("queued", "running"):
        job = requests.get(f"{API}/api/jobs/{job['id']}", headers=H, params={"wait": 50}).json()
    if job["status"] != "succeeded":
        raise SystemExit(job["error"])
    return job

BARS, BEATS, BPM = 32, 3, 144
SCORE = "https://doseedo.com/static/game/market-waltz/score.mid"    # your own MIDI file goes here

# 1. The notes, played: one instrument for each part of the file. Do not pass duration_seconds:
#    the render runs about 2 s past the last bar, and that tail is what the loop carries over its start.
score = run("render_score", {"bpm": BPM, "midi_url": SCORE, "instruments": {
    "Flute": {"instrument": "flute"},
    "Oboe": {"instrument": "oboe"},
    "Clarinet": {"instrument": "clarinet"},
    "Celesta": {"instrument": "celesta"},
    "Harp": {"instrument": "harp"},
    "Double bass": {"instrument": "double_bass_pizz"},
    "Violas": {"instrument": "viola", "players": 4},
    "Cellos": {"instrument": "cello", "players": 3},
}})

# 2. The mix, as a loop: exactly BARS x BEATS x 60 / BPM seconds, with every part printed alone.
loop = run("mix", {"from_job": score["id"], "loop": {"bars": BARS, "bpm": BPM, "beats_per_bar": BEATS}, "print_parts": True})["output"]

print(loop["loop"])                              # {'length_s': ..., 'samples': ..., 'sr': 48000, ...}
open("theme.wav", "wb").write(requests.get(loop["mix_url"]).content)
for layer in loop.get("part_stems", []):         # each part alone, the same length (with Pro)
    if "url" in layer:
        open(f"theme_{layer['name']}.wav", "wb").write(requests.get(layer["url"]).content)

Layers a game can mix

part_stems is every part alone, each a loop of the same 1,920,000 samples, printed through the mix's own master: its level, its place in the room and its share of the hall are in the file. Start them on the same sample and they are the mix. On the demo's job the parts sum to the mix at −131.8 dB.

Writing music that comes round

The notes are yours: written by you, by your composer, or by a model you ask. Each part is played by one of 100+ instruments and comes back as its own stem (the MIDI to audio API). Three rules make a piece loop:

How loud each part is written is how it sits in the mix: write the tune over what accompanies it, and trim with the mix's balance if you want more of one part.

No notes? A band generator writes them

A band generator writes every part of a piece in its genre from an id, a length, a tempo and a seed. Two of them are written to loop, a town (game_town) and a dungeon (game_dungeon):

curl -s -X POST https://api.doseedo.com/api/jobs \
  -H "X-API-Key: $DOO_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: town-theme-v1' \
  -d '{
  "kind": "render_score",
  "input": {
    "bpm": 96,
    "generator": { "id": "game_town", "bars": 16, "seed": 7 }
  }
}'

It is the quick way, and what it writes comes round. A theme written for your game will have more character of its own: the demo above was written note by note, not by a generator. There are many more generators, by genre, and most of them write a piece that ends; mixed as a loop, a piece that ends still ends once a pass. GET https://api.doseedo.com/api/generate/generators lists them, with no key.

From ChatGPT or Claude, with no code

The same two jobs are tools on a hosted MCP server, so an assistant can write the notes and run both for you. Connect it (https://api.doseedo.com/mcp), then ask in plain words: "write me a looping town theme for my game, 16 bars at 96, and give me the layers". The server carries the steps as a named recipe, game-loop.

What it costs

The render is 10 credits for each 30 seconds of music for each group of up to six players. The demo is eight parts and 40 seconds; its violas and cellos are sections, each player a render of their own, so it is thirteen players in three groups: 60 credits. Mixing it as a loop costs no credits.

One credit pool pays for every job. A free account has 120 credits a month; Pro is $12 a month with 2,000, plus one-time extra usage (500 credits for $5). The quote endpoint prices a call before you make it, a refused call spends nothing, and a failed job is refunded.

On a free account you get the looping mix; each part as its own layer comes with Pro, and the parts of a free render are kept, so they are there after an upgrade.

Limits

§ Same job, any name

An AI game music generator

AI game music generator, looping music generator, seamless music loops and adaptive music layers name the same thing here: music written to come round, returned exactly its bars long, with every part as its own loop of the same length.

InNotes you or your model wrote, a MIDI file, or a band generator written to loop (a town, a dungeon), with a length in bars and a tempo.
OutA looping mix exactly that many bars long, to the sample, and every part alone as a loop of the same length: layers a game fades in and out.
Also searched asai game music generator · game music generator · video game music generator · looping music generator · seamless music loop generator · loopable music ai · adaptive music layers · game background music ai · rpg town music generator · dungeon music generator · music for indie games · game music api · ai music for a game · vertical layering music

Make a loop for your game

Make a key and run the two calls, or connect the MCP server and ask your assistant for one. A free account has 120 credits a month.

Get an API key →

FAQ

Can AI make looping music for a game?

Yes. On Doseedo the music is written as notes (by you, by your model or by a band generator), AI instrument models play every part, and the mix comes back exactly its bars long and seamless. The demo on this page is 32 bars of 3/4 at 144 bpm: 1,920,000 samples.

Is the loop really seamless?

It is exactly its bars long, to the sample, and whatever still sounds at the loop point (a note ringing on, the room) is carried over the start, so the repeat does not begin dry. It is not a crossfade. The page plays the files as the API returned them, round and round, so you can hear the join for yourself.

Does it make adaptive or interactive music?

It makes the layers for it. Every part comes back as its own loop of the same length, and the game fades them in and out. The music itself is rendered once and does not change while it plays; nothing is generated in real time.

Does it work with Unity, Unreal, Godot, FMOD or Wwise?

The output is plain WAV files, 48 kHz, that loop on their own length, so anything that plays audio files in time can use them. There is no plugin for an engine or for audio middleware.

Do I get the layers on a free account?

A free account gets the looping mix. Each part as its own layer comes with Pro.

Can I use the music in a game I sell?

You own what you make, to the extent the law allows, on every plan including the free one (Terms §6.3).

The music API · music your code controls

By job
For games
  • Game music generatorseamless loops, in layers
Also

Related