# Example songs: five songs with code

> Five songs with their full code and notes on how they work: a simple beat, a house groove, an ambient pad, a maqsum groove and a breakbeat.

These are the starting points in Shawarma's New project dialog, shown with their full code. Each one is a complete song in code: read the code, or open it in Shawarma and change it by asking.

## Simple beat

A kick and hats at 120 BPM. A blank page with a pulse.

```
setcpm(30) // 120 BPM

s("bd*4, [~ hh]*4").gain(.8)
```

[Open in Shawarma](https://shawarma.studio/open?example=empty-beat)

### What to listen for

The smallest song there is: a kick on every beat and a hi-hat between the beats, at 120 BPM. The comma plays the two parts at once, and `gain(.8)` leaves room for what you add next.

### Things to ask for

- You add a clap on two and four
- You make it 128 BPM and add a bass line in A minor

## House groove

Four-on-the-floor, off-beat bass and minor seventh stabs, in four sections.

```
setcpm(31) // 124 BPM

const drums = s("bd*4, [~ cp]*2, [~ hh]*4, ~ ~ ~ oh").gain(.36)
const bass = note("<[c2 c3]*4 [a1 a2]*4 [f1 f2]*4 [g1 g2]*4>")
  .s("sawtooth").lpf(700).decay(.15).sustain(0).gain(.22)
const stabs = note("<[c4,eb4,g4,bb4] [a3,c4,eb4,g4] [f3,ab3,c4,eb4] [g3,bb3,d4,f4]>")
  .struct("[~ x]*2").s("piano").gain(.2).room(.3)

arrange(
  [4, drums],                        // intro
  [8, stack(drums, bass, stabs)],    // groove
  [4, stack(bass, stabs)],           // breakdown
  [8, stack(drums, bass, stabs)],    // groove again
)
```

[Open in Shawarma](https://shawarma.studio/open?example=house)

### What to listen for

A 124 BPM groove in four sections. The bass jumps between two octaves on every eighth note, moving through C, A, F and G, one root per bar; a low-pass filter and a short decay keep it tight. Piano chords land on beats two and four. `arrange` sets the form: four bars of drums, eight of the full groove, four without drums, then the groove again.

### Things to ask for

- You make the breakdown longer and filter the bass in it
- You swap the piano for a warm pad

## Ambient pad

Slow major-seventh pads with a wandering filter and a few bell notes.

```
setcpm(15) // 60 BPM

const pad = note("<[c3,g3,e4,b4] [a2,e3,c4,g4] [f2,c3,a3,e4] [g2,d3,b3,d4]>")
  .s("sawtooth").attack(1.5).release(3).lpf(sine.range(500, 1500).slow(16))
  .gain(.18).room(.9).size(8)
const bells = note("<e5 ~ b4 ~ g5 ~ ~ d5>").s("triangle")
  .decay(.8).sustain(0).gain(.25).delay(.4).room(.8)

arrange(
  [8, pad],                 // pads alone
  [8, stack(pad, bells)],   // bells drift in
)
```

[Open in Shawarma](https://shawarma.studio/open?example=ambient)

### What to listen for

Slow chords at 60 BPM, mostly major sevenths, on a sawtooth synth with a long attack and release, so each chord swells in and fades out. The filter follows a sine wave that takes 16 bars to open and close. After eight bars, triangle-wave bells come in with an echo.

### Things to ask for

- You add a soft, low drone under the pads
- You make the bells play less often

## Maqam groove

Maqsum rhythm on darbuka with an oud-like line in maqam Hijaz on D.

```
setcpm(27.5) // 110 BPM, maqsum (dum tek - tek dum - tek -)

const dum = s("darbuka:0").struct("x ~ ~ ~ ~ ~ x ~ ~ ~ ~ ~ ~ ~ ~ ~").gain(.9)
const tek = s("darbuka:4").struct("~ ~ ~ ~ x ~ ~ ~ ~ ~ ~ ~ x ~ ~ ~, ~ ~ x ~ ~ ~ ~ ~ ~ ~ x ~ ~ ~ ~ ~").gain(.6)
const riq = s("white").struct("[~ x]*8").hpf(8000).decay(.04).sustain(0).gain(.08)
// Hijaz on D: D Eb F# G A Bb C
const oudLine = note(`<
  [d4 ~ eb4 f#4 g4 ~ f#4 eb4]
  [d4 ~ f#4 g4 a4 bb4 a4 g4]
  [a4 ~ bb4 a4 g4 f#4 g4 ~]
  [f#4 eb4 d4 ~ ~ ~ d4 ~]
>`).s("gm_acoustic_guitar_nylon").lpf(2000).decay(.3).sustain(.2).gain(.6).room(.3)
const drone = note("d2").s("sawtooth").lpf(300).gain(.12)

arrange(
  [4, stack(dum, tek, riq)],                 // percussion
  [8, stack(dum, tek, riq, oudLine, drone)], // the line enters
)
```

[Open in Shawarma](https://shawarma.studio/open?example=maqam)

### What to listen for

A darbuka at 110 BPM, with low dum and high tek strokes on a sixteen-step grid, and a riq-like shimmer made from filtered white noise. After four bars, a nylon-string guitar plays a line in maqam Hijaz on D (D, E flat, F sharp, G, A, B flat, C) over a low drone on D.

### Things to ask for

- You add a second phrase that goes up to the high D
- You make the percussion busier in the last four bars

## Breakbeat

A syncopated break with a rolling bass line.

```
setcpm(34) // 136 BPM

const breakbeat = s("bd ~ ~ bd ~ ~ bd ~, ~ ~ sd ~ ~ sd ~ [~ sd], hh*8").gain(.6)
const bass = note("<[e1 ~ e2 ~ ~ e1 g1 ~] [a1 ~ a2 ~ ~ a1 b1 ~]>")
  .s("square").lpf(500).decay(.2).sustain(0).gain(.32)

arrange(
  [4, breakbeat],               // drums
  [8, stack(breakbeat, bass)],  // bass joins
)
```

[Open in Shawarma](https://shawarma.studio/open?example=breakbeat)

### What to listen for

A syncopated break at 136 BPM: kicks and snares off the beat over steady eighth-note hats, with a ghost snare just before the loop turns. The square-wave bass rolls between E and A, alternating each bar.

### Things to ask for

- You make the bass line busier in the second half
- You give the bass more growl

**Open in Shawarma** makes a new project with that song, after you sign in. You can also pick them by name under **New project**. To learn the code behind them, start with the [tutorial](https://shawarma.studio/learn/tutorial); the [drum patterns](https://shawarma.studio/learn/drum-patterns) guide explains the beats.

## Try it in Shawarma

Shawarma is a music editor where every song is code. Your song plays on a loop; ask the assistant for a change in plain words, listen to it, and keep it only if you like it. Or edit the code yourself, as in this guide. The editor is free, with 5 assistant replies to try it; Pro starts with 7 days free.

[Start free with Google](https://shawarma.studio/auth/google) [See pricing](https://shawarma.studio/pricing)

---

The page: https://shawarma.studio/learn/examples
