Done
Add basic Web Audio setup and one-shot playback for bundled drum samples.
The mini DAW needs a small audio engine before sequenced playback. This task should establish AudioContext lifecycle handling, sample loading and decoding, and a typed playback API.
Included:
- Create an audio engine module under
src/audio/. - Set up
AudioContextcreation/resume behavior. - Load bundled drum samples when the scaffold has an asset strategy.
- Decode samples into runtime
AudioBufferobjects. - Store decoded buffers in a runtime cache keyed by sample ID.
- Add one-shot sample playback.
- Expose a small typed API to the UI.
- Add minimal manual UI only if useful for verifying playback.
Excluded:
- Sequenced playback.
- Lookahead scheduler.
- Drum sequencer UI.
- Piano roll UI.
- User sample import.
- Arrangement playback.
- Effects or mixer.
- Do not store
AudioBufferobjects in project JSON. - Create a new
AudioBufferSourceNodefor each one-shot playback. - Keep audio engine logic independent from React components.
- Avoid new dependencies unless clearly justified.
- A user gesture can initialize or resume audio.
- Bundled sample metadata can resolve to decoded runtime buffers.
- A sample can be triggered repeatedly as a one-shot.
- The UI calls a typed audio API rather than Web Audio internals directly.
Run:
npm run typechecknpm run lintnpm run testnpm run build
Manual check:
- In the browser, trigger each available sample more than once and confirm playback works.
- Stop/reload the page and confirm audio setup handles browser autoplay policy.
- Document where runtime buffers are cached.
- Mention any browser-specific behavior observed during manual testing.