# Soundscape implementation

A no-build HTML page with local scripts and CSS. `engine.js` contains the audio and lifecycle code without DOM references. `app.js` renders controls and sends commands to the engine. `catalog.js` contains the supplied recording manifest as JavaScript data.

## Choices

- City, Forest and Water each use a supplied continuous recording, three initially enabled recorded events, generated coloured noise and an optional musical layer.
- Each recorded event has an independent enable switch, level and minimum/maximum waiting time. It waits before its first playback and waits again after finishing. Preview plays an event once.
- Intensity controls a separate scene gain. Movement changes synthesis modulation rates and depths. Neither replaces the source levels or event wait values.
- The noise path passes through a filter, volume modulation, stereo panner and attack/release envelope. LFOs act directly on synthesis volume, filter frequency and pan. Smooth random interpolates the same parameters; manual mode holds them still.
- The drone has its own slow volume, filter and pan modulation. Sparse notes use locally generated sine oscillators, soft envelopes and a short pentatonic pitch set. The tone implementation is independent of experiment 15.
- Calm, Restless and Quiet musical change scene intensity, movement and musical mode while preserving source levels and event waits.
- Space uses a generated stereo impulse response. Lo-fi warmth blends a low-pass filter and soft saturation. Both begin at zero.
- Imports support multiple local MP3/WAV files as loops or occasional events, including individual levels, event timing, preview and removal. Importing does not play audio.
- Global Stop invalidates in-flight playback requests, clears the scheduler, stops tracked sources and oscillators, disconnects nodes, and closes the AudioContext to discard the reverb tail. Controls and decoded recordings remain available for another start.
- `attempts/001/` preserves the first complete implementation before subsequent checks or corrections.

## Checks and limitations

- `node --check` passed for `engine.js`, `app.js` and `catalog.js`.
- `node checks/engine-lifecycle.cjs` passed. A Web Audio mock checked initial silence, delayed first events, macro preservation of per-event levels/waits, stopping an active event, stopping all tracked sources and LFOs, closing the reverb context, cancelling a pending start and restarting.
- Supplied recording paths and HTML control IDs were checked locally.
- Post-snapshot review corrected active-event cancellation, a background selection during initial loading, preview status and cancellation of removed/disabled events during decoding.
- Browser and listening checks are delegated to the parent task as requested. No browser tools or server were used in this implementation trial.
- Use the local course server so browsers can fetch the supplied recordings. The scripts need no build step, internet service or external library.
- Scene/background changes restart playback with the chosen recording rather than crossfading environments.
- Imported files and settings live in memory for this page; reload clears them.
- Backgrounds loop at their supplied file boundaries. Source recordings have not been edited to manufacture seamless joins.
- Browser timer throttling in a background tab may delay occasional events. It does not create a catch-up burst.
- Envelope attack/release times are smoothing times rather than fixed ADSR stages. Continuous noise and the drone remain tonal/ambient; this is not a sequencer.

## Source files consulted

- `prompt.txt`, the exact student brief.
- `../../manifest.csv`, for supplied filenames, environments, categories and durations.
- `../03-import/audio-engine.js`
- `../03-import/import-engine.js`
- `../03-import/event-engine.js`
- `../08-random/app.js`
- `../08-random/index.html`, control options only.
- `../09-lofi/app.js`
- `../10-reverb/app.js`
- `../14-textures/index.html`

The generated audio, import/event lifecycle and effects were implemented here using the permitted experiments as references. No source or notes from experiment 15, previous attempts, slides, conversation archives or other projects were consulted. The general `unslop` skill was read for plain-language writing and did not provide implementation material.
