Repository navigation
Musicwright Game
musicwright-game handles music for games: seamless loops (bar-exact length, tail crossfaded into the head, a seam check), intro then loop, vertical layers and stems, stingers, victory and defeat cues, cue lists built from a level plan or beat chart, conventions and lengths for menu, map, combat and boss music, listener fatigue, Unity import, OGG loop tags, FMOD and Wwise basics, and Steam's AI disclosure. It runs mw.py loop and seam. Since 0.1.17 its advice is that stingers play at once by default, with quantising to the beat as a choice.
"make this loop seamless", "music for my deckbuilder", "combat music with layers", "import music into Unity", "why does my loop click", "intro then loop", "refresh musicwright-game". Generating the audio is generate.
- Plan the set. When the game has a level plan (a beat chart with one column per level, a
LEVEL-PLAN.md, a design one-pager), the cue list comes from it: its music row gives the track per area in play order, its big and small moments set the intensity, a new enemy's first room gets a warning cue, a rest room gets silence or a rest cue, and the same track in two neighbouring areas is flagged (after Rogers, Level Up!;references/adaptive.mdadds the cue types mystery, warning, chase and a villain motif). Without a plan, by game state (menu, map, combat, boss, shop, victory, defeat, stingers). Long sessions tire players: 2 to 4 minute loops with A/B variation, several tracks per area, a sparse 1 to 4 kHz range left for sound effects, silence between fights. Loop length in seconds = bars x beats per bar x 60 / bpm: at 96 bpm in 4/4, 32 bars = 80 s. - Generate for looping: a take at the planned bpm and key, 10 to 20 s longer than the loop, with a steady caption ("steady loop, no intro, no ending"), WAV or FLAC only.
- Cut the loop:
mw.py loop <take> --start <s> --bars <N> --bpm <bpm> --xfade 1.5 --out out/<name>_loop.wav [--ogg]. The tail after the loop end is crossfaded into the head, so reverb tails carry over; the result is exactly N bars (Commands). - Read the seam, then ask a person to play it three times through and listen at the seams: only a listener can tell whether the last bar leads back to the first.
- Master after looping to
game-music, then runseamagain on the mastered file. - Into the engine, and disclose (below).
seam compares the jump between the file's last and first sample with the file's own 99th-percentile step (ratio), and the level at its start and end (level_jump_db, since 0.1.2 read at the seam from a robust line through 50 ms window levels over each half second). "clean" needs a ratio of 2 or less and a level jump under 3 dB (the skill now says 2, not "about 1"); "check by ear" a ratio of 5 or less and under 6 dB; anything else is "audible seam likely". A loop that starts on a strong drum hit read "check by ear" in 0.1.1 with a smooth seam (the stand-in take's 12-bar loop from 5.0 s: ratio 0.85, level jump 3.5 dB); 0.1.2 reads the same loop clean at 1.29 dB, while a tone that drops to half level still reads 6.02 dB, "audible seam likely" (the outputs).
From references/unity.md (Unity 6.6 manual, checked 2026-10-17): music clips as Streaming with Vorbis compression, Load In Background on, Preload off; short loops and stingers Compressed In Memory. Unity ignores OGG loop tags and has no loop import setting, so a simple loop is AudioSource.loop = true on the file mw.py loop wrote, and intro then loop is two sources started with PlayScheduled, the second at the end of the first. The FAQ has the snippet.
Steam's Content Survey covers AI-made sound that ships with the game; the disclosure line goes on the store page (generate's references/licences.md has the wording). Each deliverable goes into music.json with its loop data (bars, bpm, length) and model.
- No MP3 anywhere in the loop chain; no fades or silence inside a loop file.
- Every music file of one game at one loudness.
- Layers of one piece come from one take (stems) or one seed, never from unrelated renders.
- Rotate two tracks per area, and beds that never repeat exactly; layers are built by subtraction from the full arrangement (from the 0.1.1 CHANGELOG).
Files: skills/musicwright-game/references/loops.md, unity.md, adaptive.md (with "Cues from the level plan"). Maintenance: tier moderate (next check due 2026-11-16); 8 eval cases, three runs recorded in TESTS.md (the latest on 2026-10-23: 17 of 18 runs, 8 of 8 cases).
This wiki describes musicwright 0.1.19 (tag v0.1.19, commit 3211a94) and was last updated on 2026-11-07. The plugin is MIT licensed. Report problems in the issues.
Using it
- Getting started
- Commands
- Recipes and loudness presets
- The project contract and studio
- Workflows
- Errors and edge cases
- FAQ
- Works with
The skills
- musicwright (hub)
- musicwright-generate
- musicwright-compose
- musicwright-produce
- musicwright-game
- musicwright-score
- musicwright-curate
The releases
Contributing
Elsewhere