Music
=====

Story music paths resolve relative to this directory.

Block music markup:

```text
#music[track-name.ogg](crossfade, loop, lead=4)
```

Supported modes:

- `queue`: start the new track after the current track ends.
- `crossfade`: fade from the current track into the new track.
- `cut`: stop the current track and start the new track immediately.

Supported playback flags:

- `loop`: repeat the track.
- `once`: play the track one time.
- `lead=<seconds>`: for block music, let the music play alone for this many seconds before the next text/TTS paragraph starts.

Music volume is controlled by master volume and music volume in the options menu. While TTS is playing, music is ducked to 70% of its configured volume and restored when TTS playback is idle.

The ducking amount is configurable in the options menu and can be disabled with the music-ducking mute toggle. Music state is saved with browser savegames when a track is active, including the current playback position, and restored with a fade-in on load.

Browsers require a user interaction before audio can play, so music should begin after `new game` or `load`, not during passive page load.

Document third-party source and license information here or next to the file.
