# Demo sounds

> The two sounds the previews play, made with Web Audio and no samples: listen to each and ask for one by name.

A device preview plays a loop through the effect so you can hear what it does. Those loops are not recordings: each is drawn in code with oscillators, filters and noise, once per sample rate, then looped as a buffer. They live in one file, `demo-sound`, and each has a name.

## Listen

One at a time, through the same master bus as a preview.

| Name | Sound | What to listen for |
| --- | --- | --- |
| `chord` | Drone | An A minor chord that never stops: a gate or a ducker has something to open and close. |
| `groove` | Boom bap | Two bars of boom bap at 90 BPM: drums, bass, keys and a plucked line. |
| `kick` | Boom bap kick | The kick of the boom bap alone: its key. |

## Ask for one by name

`DEMO_SOURCES` holds the sounds by name, with a title and what to listen for. `renderDemoSource` draws one for a sample rate and keeps it, so the same buffer comes back each time.

Usage and API: [`demo-sound`](/docs/lib/demo-sound).

## How they are made

**Boom bap** (`groove`) is two bars at 90 BPM. The off-beat sixteenths are pushed back a fraction of a step, which is the swing. The snare has quiet ghost notes, the hats are harder on the beat, and each hit lands a few milliseconds early or late from a fixed sequence, so it is the same every time. A sine bass, an electric piano on two chords and a plucked line sit on top. What rings past the end is folded back into the start, so no note is cut where the loop turns.

**Drone** (`chord`) is four oscillators on an A minor chord that never stop. A signal that is never quiet by itself is what a gate has to open and close.

Boom bap has a kick to go with it, not offered in the picker: a gate or a ducker follows it.

The drum voices are the ones of [Synthesis](/docs/guides/synthesis#drum-hits).

## The code

<ItemFiles name="demo-sound" />
