# Examples

Playable `.track` files demonstrating the format's features. Play the entry
file of each example with `track-play` (follows `@jump` automatically) or
render it with `track-export`:

```
cargo run --bin track-play --features play -- examples/song/intro.track
cargo run --bin track-export --features export -- examples/song/loop.track loop.wav
```

## song/

A two-part demo of the `@jump` song graph, plus two standalone pieces.
`sounds.track` holds the shared instrument palette, a `pentatonic` shimmer
motif, and imports `scales/scales.track`.

- **intro.track → loop.track** — `intro.track` plays once (`@length 8`) then
  `@jump`s into `loop.track`, which loops forever via a self-`@jump`. Shows
  the graph structure (separate files for a non-repeating intro and a looping
  body) and layers a `pentatonic`-tuned bell ostinato (just intonation, via
  `@tuning`/`@root`) over an otherwise 12-TET arrangement.
- **action.track** — a single file that `@jump`s to itself; no separate
  intro needed for a plain loop. Driving tempo, `distortion` on the sound
  definitions and a `bitcrusher` layer effect for a lo-fi/chiptune edge.
- **ambient.track** — no `@jump` (stops after playing once). The whole
  harmonic bed uses the `seven_limit` just-intonation tuning as its actual
  harmony, not just decoration, and the lead melody uses `glide` between
  fractional scale-degree pitches to show tunings interpolating smoothly
  between degrees, not just landing on integers.
- **panned.track** — a call-and-response figure alternating between a
  hard-left and a hard-right layer (`@pan -0.7`/`0.7`), answered by a
  centered pad with `highpass` and layer-level `tremolo` (amplitude
  modulation, distinct from a sound's own `vibrato`/`tremolo` fields). The
  `pluck` sound uses `slide` for a pitch-drop attack. Everything sits in the
  `minor` tuning from `scales/scales.track`.

## suite/

A five-part linear piece (`intro → track1 → track2 → track3 → outro`) with
no loops and no cycle — `@jump` used purely as a way to chain distinct
sections, each with its own tempo. `sounds.track` imports `song/sounds.track`
and defines a leitmotif family:

- `quest` — the plain leitmotif.
- `quest_frag` — its first half only (fragmentation).
- `quest_wide` — the same shape with doubled note durations (augmentation).
- `quest_inv` — the same shape with inverted intervals (melodic inversion).

The motif appears sparingly and always transposed to fit the local harmony:
once plainly in `track1` (exposition), twice fragmented over a tenser
borrowed harmony in `track2` (development), three times layered/overlapping
in `track3` (climax: one augmented statement plus two inversions in canon),
and once more, quiet, in `outro` (resolution/callback). `intro.track` has no
motif at all — pure atmosphere before the theme is introduced.

## scales_demo/

- **tunings.track** — the same short motif (`phrase`) played back-to-back on
  four layers, each with a different `@tuning` from `scales/scales.track`
  (`chromatic`, `major`, `pentatonic`, `seven_limit`) but the same `@root`.
  Demonstrates that a tuning is a per-layer setting applied uniformly to both
  plain notes and motif instances — the identical motif definition (just
  scale-degree numbers) sounds different in each scale with no extra
  features required, since `render_layer` resolves one voicing per layer and
  uses it for everything on that layer.
- **modal.track** — the same motif (`drift`, this time with `glide` written
  into the motif definition itself rather than a plain note) played once in
  the `minor` tuning and once in `whole_tone` (`equal 6`, the symmetric,
  key-ambiguous scale), each under its own pad chord, back to back at the
  same root pitch. A practical A/B of scale character rather than an
  isolated comparison.
