---
title: Examples
order: 3
summary: Fifteen complete pieces made from code, each with a player.
---

<!-- Generated by tools/generate-docs.bxs from examples/explorer/catalog.json. Do not edit. -->

Every example is a BoxLang script that makes a complete piece of sound from code, with no samples and no licensing questions: all the music is original. The clips below are short renders at 96 kbps; the scripts make the full pieces. Each is one readable file in [`examples/`](https://github.com/ortus-boxlang/bx-audio/tree/development/examples), covered by tests that render it and measure what it sounds like.

```bash
bx-audio pieces                         # the list
bx-audio render house --out=house.mp3   # render one, with its own settings
bx-audio explorer                       # play them all in the browser
```

## Pop Drive

*Upbeat pop.* Voices, a beat grid, kick pump and mastering. A port of a numpy script, checked against the original.

<audio controls preload="none" src="../assets/audio/pop-drive.mp3"></audio>

```bash
bx-audio render pop-drive --out=pop-drive.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 8 to 56 | `28` |
| `--bpm` | Tempo | 90 to 150 | `128` |
| `--style` | Style | pop, drive | `pop` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/01-pop-drive)

## Lofi

*Lofi hip hop.* Swing, humanised timing, tape wobble and vinyl crackle over jazzy seventh chords.

<audio controls preload="none" src="../assets/audio/lofi.mp3"></audio>

```bash
bx-audio render lofi --out=lofi.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 8 to 32 | `16` |
| `--bpm` | Tempo | 60 to 95 | `78` |
| `--swing` | Swing | 0.5 to 0.7 | `0.58` |
| `--seed` | Seed | 1 to 99 | `7` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/02-lofi)

## House

*House.* Four on the floor with sidechain pumping, a rolling bass, stabs, a riser and a drop.

<audio controls preload="none" src="../assets/audio/house.mp3"></audio>

```bash
bx-audio render house --out=house.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 16 to 48 | `32` |
| `--bpm` | Tempo | 118 to 130 | `124` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/03-house)

## Ambient

*Drone and pads.* Slow envelopes, inharmonic bells, noise swells and a very large reverb.

<audio controls preload="none" src="../assets/audio/ambient.mp3"></audio>

```bash
bx-audio render ambient --out=ambient.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 4 to 24 | `12` |
| `--bpm` | Tempo | 36 to 70 | `48` |
| `--seed` | Seed | 1 to 99 | `5` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/04-ambient)

## Techno

*Techno.* A hypnotic groove in F sharp minor: hard kick, rumble bass, a resonant acid line and echoing stabs.

<audio controls preload="none" src="../assets/audio/techno.mp3"></audio>

```bash
bx-audio render techno --out=techno.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 16 to 48 | `32` |
| `--bpm` | Tempo | 124 to 145 | `132` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/05-techno)

## Synthwave

*Synthwave.* A night drive: pulsing bass, a gated snare in a huge room, wide pads, an arpeggio and a lead melody.

<audio controls preload="none" src="../assets/audio/synthwave.mp3"></audio>

```bash
bx-audio render synthwave --out=synthwave.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 16 to 48 | `32` |
| `--bpm` | Tempo | 85 to 120 | `100` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/06-synthwave)

## Cinematic

*Trailer music.* Tension, a build, one silent beat, then a huge boom, taiko drums and a theme. Ends on a ringing hit.

<audio controls preload="none" src="../assets/audio/cinematic.mp3"></audio>

```bash
bx-audio render cinematic --out=cinematic.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 16 to 40 | `24` |
| `--bpm` | Tempo | 70 to 120 | `90` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/07-cinematic)

## Chiptune

*8 bit game music.* Original music for an imaginary console: two pulse channels, a triangle bass and noise drums. Five tracks, from an overworld theme to a boss fight.

<audio controls preload="none" src="../assets/audio/chiptune.mp3"></audio>

```bash
bx-audio render chiptune --out=chiptune.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--track` | Track | overworld, cave, boss, title, victory | `overworld` |
| `--loops` | Loops (0 is the track's own) | 0 to 4 | `0` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/08-chiptune)

## Game sound effects

*Sound effects.* A jump, a coin, a laser, an explosion and more, made from pulse waves and noise. Hear them all in the sampler or one at a time.

<audio controls preload="none" src="../assets/audio/sfx.mp3"></audio>

```bash
bx-audio render sfx --out=sfx.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--sound` | Sound | sampler, jump, coin, laser, explosion, powerup, hit, blip, alarm, gameover, footstep | `sampler` |
| `--seed` | Seed (the noise in the explosion, hit and footstep) | 1 to 99 | `1` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/09-sfx)

## Jazz

*Swing blues.* A trio on a twelve bar blues in F: walking bass, ride, piano comping and an improvised solo. Change the seed for another solo.

<audio controls preload="none" src="../assets/audio/jazz.mp3"></audio>

```bash
bx-audio render jazz --out=jazz.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--choruses` | Choruses | 2 to 6 | `3` |
| `--bpm` | Tempo | 100 to 180 | `132` |
| `--swing` | Swing | 0.5 to 0.75 | `0.64` |
| `--seed` | Seed | 1 to 99 | `4` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/10-jazz)

## Rock

*Rock.* Distorted power chords, a bass guitar, drums with fills and crashes, and a pentatonic solo from a seeded generator.

<audio controls preload="none" src="../assets/audio/rock.mp3"></audio>

```bash
bx-audio render rock --out=rock.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 16 to 48 | `32` |
| `--bpm` | Tempo | 100 to 160 | `128` |
| `--seed` | Seed | 1 to 99 | `3` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/11-rock)

## Voice-over

*Narration over music.* A trailer style announcement: a text to speech voice over music that ducks under it. Needs the speech engine, so it runs from the command line.

<audio controls preload="none" src="../assets/audio/voiceover.mp3"></audio>

```bash
bx-audio render voiceover --out=voiceover.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--voice` | Voice | text | `joe` |
| `--text` | Lines, separated by | | text | `none` |
| `--duck` | Music ducking in dB | -24 to 0 | `-12` |
| `--bpm` | Tempo | 80 to 130 | `100` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/12-voiceover)

## Trailer soundtrack

*A scored video.* Music cut to an exact length, a voice-over with captions, ducking, mastering to a loudness target and chapter markers. Needs the speech engine, so it runs from the command line.

<audio controls preload="none" src="../assets/audio/trailer.mp3"></audio>

```bash
bx-audio render trailer --out=trailer.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--seconds` | Length in seconds | 8 to 40 | `15` |
| `--voice` | Voice | text | `joe` |
| `--text` | What the voice says | text | `none` |
| `--target` | Loudness target | streaming, podcast, game, broadcast, cinema | `streaming` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/13-trailer)

## Game audio

*A scripted play session.* What a game asks of a sound engine: effects with variations, a looping theme, a boss theme made with time stretch and pitch shift, and a real time mixer with music and effects buses. A scripted session is rendered here.

<audio controls preload="none" src="../assets/audio/game-audio.mp3"></audio>

```bash
bx-audio render game-audio --out=game-audio.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--seed` | Seed (changes the variations) | 1 to 20 | `1` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/14-game-audio)

## The BxAudio theme

*Grid anthem.* A neon grid runner: a pulsing saw bass, gated pads, an opening filter, then an original adventure fanfare of rising fourths with a harp run.

<audio controls preload="none" src="../assets/audio/theme.mp3"></audio>

```bash
bx-audio render theme --out=theme.mp3
```

| Setting | | Range | Default |
|---|---|---|---|
| `--bars` | Bars | 8 to 32 | `16` |
| `--bpm` | Tempo | 120 to 145 | `132` |

[Script and notes](https://github.com/ortus-boxlang/bx-audio/tree/development/examples/15-theme)

