# Game music that loops cleanly

> Make music for your indie game: level loops that repeat cleanly, boss fights, a cozy village. Change each layer by asking. You own what you make.

Describe the level, and Shawarma makes a loop for it. Each song is a set of short patterns, so the end leads back into the start with no gap and no click.

Every layer is separate: drums, bass, chords, melody. Ask for a faster boss version, take the melody out for a menu, or add a layer when the player finds the key.

Level one

chiptune, square lead, a 4-bar loop

1. **The loop** drums, bass, lead

[Open this song in Shawarma](https://shawarma.studio/open?example=made-game-level)

## Two more loops

- Boss fight: 160 BPM, strings, toms and a fast lead: [Make it yours](https://shawarma.studio/open?example=made-game-boss)
- Cozy village: marimba, flute and a soft shaker: [Make it yours](https://shawarma.studio/open?example=made-game-village)

## Then ask for *changes*

Once your song plays, type what it needs. It changes while it plays, and you keep only what you like.

- You make a faster version for the boss
- You take the melody out for the pause menu
- You make it sound like an 8-bit console
- You add a layer of strings for the last level
- You make a short jingle for the level end

## Made for indie games

- Loops that repeat cleanly: A song is a set of patterns of whole bars, so it comes back round on the beat.
- Layers you can switch: Drums, bass, chords and melody are separate. Keep one version with all of them and one without the melody.
- Yours to use: You own what you make and can use it in your videos and games. Some built-in sounds ask for a credit; the list is on the Terms page.

**See the code of “Level one”**

```
setcpm(35) // 140 BPM, C major, a level that loops every 4 bars

const drums = s("bd ~ sd ~, hh*8").gain(.36)
const bass = note("<[c2 c3]*4 [a1 a2]*4 [f1 f2]*4 [g1 g2]*4>").s("triangle").gain(.45)
const lead = note("<[e5 g5 c6 g5 e5 g5 c6 e6] [e5 a5 c6 a5 e5 a5 c6 e6] [f5 a5 c6 a5 f5 a5 c6 f6] [g5 b5 d6 b5 g5 b5 d6 g6]>")
  .s("square").decay(.1).sustain(.3).lpf(3000).gain(.11)

stack(drums, bass, lead)
```

## Questions

**Does the loop repeat without a gap?**

Yes. Each part is a pattern of whole bars, so the end of the loop leads straight back into the start. Export it as WAV and set it to loop in your engine.

**Can I use the music in my game?**

You own what you make and can use it in your videos and games. Some built-in sounds ask for a credit; the list is on the Terms page.

**Can I get each layer on its own?**

Yes. Ask for a version with only the drums and bass, or without the melody, and export each one. Every version is saved.

**How do I get the audio file?**

Pro exports WAV and MP3. On Free you can make, edit and share songs.

The sounds that ask for a credit: [Sound credits on the Terms page](https://shawarma.studio/terms#sound-credits).

## Make the music for your game

A platformer level is already typed in. Describe your own level, or press the button.

Free. No sign-up for your first song.

Have an account? [Continue with Google](https://shawarma.studio/auth/google)

By continuing you agree to the [Terms](https://shawarma.studio/terms) and the [Privacy policy](https://shawarma.studio/privacy).

---

The page: https://shawarma.studio/make/game-music
