Adaptive Music
How Do You Make a Seamless Music Loop?
By the Starchild Music team · November 19, 2026 · 7 min read

The short answer
A seamless loop needs three things: a length that is a whole number of bars, a start and end that join without a click or a gap, and a plan for the reverb tail. Most loops that "almost work" fail on the tail, because a basic loop cuts the last bar's ring-out at the jump. Fix it by playing a second copy that carries the tail over the restart, or by folding the tail into the start of the file.
A seamless loop is a piece of music that ends exactly where it begins, so the listener never hears the restart. Three things have to be right. The length must be a whole number of bars. The join must have no click and no gap. And whatever rings out at the end, such as a reverb tail, must be handled on purpose.
The third one catches most people. Austin Haynes, a game composer who makes loop tools, writes that in a basic one-voice loop "the engine stops the end of the file and jumps back to the beginning." Because of that jump, "any natural ring-out after the loop point disappears with it." Your loop can be sample-perfect and still sound dry at the restart.
Step 1: build it in whole bars
Looping works because music repeats on a grid. Pick a tempo, pick a length in bars, and keep every part inside that grid. Bars multiply easily into time. At 120 beats per minute in 4/4, one bar lasts two seconds, so an 8-bar loop lasts 16 seconds. At a 44,100 samples-per-second rate, that is 705,600 samples. If your exported file is even a few samples longer, the loop drifts off the beat. Check the exported length, not just the project.
Write the ending so it leads back to the beginning. Land on a chord that can start the next pass, and avoid a final cymbal crash or a big stop unless you want the listener to feel the restart.
Step 2: choose a format that does not add silence
Use WAV or OGG for loops. Lossy formats add padding. The Wikipedia entry on gapless playback explains that lossy codecs add silence at the start and end of a track, and that "the popular MP3 format defines no way to record the amount of delay or padding for later removal." Some encoders store the padding in metadata, but only players that read it can use it. Haynes makes the same point for games: some formats, "MP3 especially, add a little silence to the start of the file."
If you must ship a compressed file, test the loop in the real engine, not in a media player.
Step 3: tell the engine where the loop is
A file does not always carry its own loop points, and engines read them differently. Haynes's survey of loop handling, which comes from a tool maker, says:
- Unity reads the loop region stored in a WAV file, though the survey says this is undocumented. Compressed import can shift or lose the points, so it recommends uncompressed audio.
- Godot reads the WAV loop region natively. For OGG files, Godot's AudioStreamOggVorbis has a loop setting and a loop_offset, "the time in seconds at which the stream starts after being looped."
- Unreal ignores those embedded points but reads cue markers sample-accurately.
- FMOD defines loops inside the project, as a loop region on the event timeline. Wwise uses entry and exit cues on a music segment.
- GameMaker, AGS and Defold ignore embedded points. Some repeat the whole clip, so the start and end must already join cleanly.
Engines change, so treat that list as a map of questions to ask, then check your engine's current documentation.
Step 4: handle the reverb tail
Here is why a DAW fools you. Haynes notes that DAWs keep effects running while a cycle plays, so the loop sounds fine there, while exported files do not. The tail from the last bar spills into the first bar in the DAW but not in the game. He describes two fixes.
- Two voices. A second copy starts at the loop start while the first plays past its end, so the old tail overlaps the new pass. Haynes says Wwise does this natively, FMOD can do it with a transition timeline, and Unreal can with two wave players in a MetaSound. In Unity, Godot and the web it takes code. In Unity he recommends scheduling with the audio system's DSP clock, which is sample-accurate and does not drift, using absolute times for each start.
- A folded tail. Mix the decay into the opening of the file, so a plain loop works with no extra playback code. The cost is that the first time through, the music opens with a tail from a pass that never played. That is audible on a sparse opening, so an intro section can hide it.
Haynes recommends two voices where the engine can schedule accurately, and folded tails for engines that play one voice at a time.
A worked example: eight bars with a big hall
Say you have an 8-bar piece at 120 beats per minute with a long reverb. Render it for the two-voice method like this. Export the 8 bars, 16 seconds exactly, plus a separate tail of a few seconds. Place the loop markers at bar 1 and the end of bar 8. The engine starts voice two at 16 seconds while voice one keeps ringing.
For the folded method, render a second pass in your DAW. Make the loop run twice, export the middle section, and the reverb from the end of pass one now sits at the start of the file. The same idea works by hand: render three copies end to end and keep the middle one.
Mistakes that break a loop
- A crossfade shorter than the tail. Fading the end into the start can hide a click, but if the fade is shorter than the reverb, the reverb still drops out at the seam.
- A file that is a few samples too long. The loop slips off the grid a little more on each pass.
- Testing in a player instead of the engine. Players and engines treat padding and loop points differently.
- Listening once. Play the loop for ten minutes while you do something else. Any seam you can hear when you are not listening for it is a real seam.
Do this today
- Pick tempo and bars first, then compute the exact length in seconds and samples.
- Export WAV, and confirm the file's length matches.
- Decide: two voices or a folded tail. Write it in the project notes so the next person knows.
- Loop it in the real engine for ten minutes.
- Listen for three things: a click, a gap, and a dry restart.
Loops are the base of adaptive music
Layers and segments in an adaptive score are all loops joined at musical points. A loop that restarts cleanly is what lets a game fade in a layer or switch to a new section without a bump. For how those systems are built, read horizontal resequencing vs vertical layering. To change a loop's speed without a pitch shift, see how time stretching works.
Sources
Find a song to license
Every song on Starchild can be heard in different styles and in your key before you license it.