# Implementation notes

Built from `prompt.txt` with plain HTML, CSS, JavaScript and native Web Audio. The first complete implementation is preserved in `attempts/001/`.

## Choices

- Three timing buttons compare the same selected recording. Fixed wait schedules the next start at the previous start plus 4 seconds plus the fixed wait. Random wait adds a newly sampled wait after each 4-second recording. Start-to-start samples the interval between starts, so intervals below 4 seconds overlap.
- All 53 supplied environmental event files are available in a grouped selector. No loop recordings are used. The background is quiet filtered noise generated in the browser.
- Calm uses random waits of 5–9 seconds after each event. Busy uses start-to-start intervals of 0.7–1.5 seconds. Both retain the selected event and volume.
- Sound starts only from the Start button. Settings change live if listening is already active, restarting the comparison. Default volume is 30%, event gain is 0.65, background gain is 0.028, with a compressor before the master volume.
- A Web Audio lookahead scheduler places event starts against the audio clock. Stop cancels the scheduler, all existing and scheduled event sources, the generated background, and any stale asynchronous loading result.
- The live display shows active voice count, the next-event countdown, and bars for recent events. A one-sentence rule sits directly under the timing buttons.

## Checks completed

- `node --check app.js` and `node --check events.js` passed.
- Verified all 53 selected event file paths exist in the allowed audio directory and the manifest declares 4-second duration for each.
- Reviewed the stop path and asynchronous loading token. Pending decoding cannot restart playback after Stop.
- No external URLs, libraries, network services or dependencies are used.

## Limits

- Browser and listening checks are owned by the parent agent and have not been performed here.
- Serve from a local HTTP page so browser fetch can load the supplied audio files. Direct `file:` loading may be restricted by browser policy.
- Timing controls restart playback when the slider is released. A background-tab delay skips missed events instead of playing a catch-up burst.
- The visual timeline uses animation frames; audible scheduling uses the Web Audio clock.
