# An instrument

> Judgement week: an agent can build a synth but can't hear the result, so your ear is the harness.

> turn the browser into a musical instrument --- something a stranger can pick
> up and play

Interpret _instrument_ as broadly as you like: a theremin driven by the mouse, a
drum machine, a step sequencer, wind chimes that never repeat, a keyboard that
plays chords --- if a person acts and the page sounds, it counts. The
[Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API)
does the synthesis, it's all client-side, and the whole thing ships straight to
GitHub Pages. The bar is playability: the player's choices shape what they hear,
two people at the same page sound different, and there's no way to get it
wrong --- no score, no fail state. (Hold that thought for
[C5](https://comp.anu.edu.au/courses/comp4020-agentic-coding-studio/crits/05-game/).)

The building blocks are few: an
[`OscillatorNode`](https://developer.mozilla.org/en-US/docs/Web/API/OscillatorNode)
or an
[`AudioBufferSourceNode`](https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode)
through a
[`GainNode`](https://developer.mozilla.org/en-US/docs/Web/API/GainNode), all
hung off one
[`AudioContext`](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext)
and driven by
[pointer](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events) or
[keyboard](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent)
events. The context starts suspended until a user gesture resumes it (the
[autoplay policy](https://developer.mozilla.org/en-US/docs/Web/Media/Guides/Autoplay)),
so nothing sounds before the player's first tap. MDN's
[simple synth](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Simple_synth)
is a worked example.

This week's crit opens cold: your pod plays the instrument before you say a
word. The pod then discusses the sound, the interaction, and whether it's any
good. After that you can talk and explain your instrument. Latency, feel,
whether a gesture is expressive or just exhausting: none of that shows up in a
test suite or a Lighthouse score.

Source: <https://comp.anu.edu.au/courses/comp4020-agentic-coding-studio/crits/04-instrument/>\
Licence: [CC-BY-NC-SA-4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)\
Cite as: Swift, B. (2026). _COMP4020/COMP8020 Agentic Coding Studio_ [Course materials]. ANU School of Computing. https://doi.org/10.5281/zenodo.21395760
