oneshotlm
Compare all models on this prompt →

Drum machine · qwen3.8-max

Build a 16-step drum machine with a clickable grid for kick, snare, hi-hat, and clap, all sounds synthesized with the Web Audio API, plus play/stop and an adjustable BPM.

⛨ sandboxed Open in new tab ↗
transcript · 8 messages
user

Build a 16-step drum machine with a clickable grid for kick, snare, hi-hat, and clap, all sounds synthesized with the Web Audio API, plus play/stop and an adjustable BPM.

assistant
thinking
Build a self-contained HTML drum machine. Sounds: kick (sine wave with pitch drop), snare (noise + tone), hi-hat (high-pass filtered noise, short), clap (bandpass filtered noise bursts). 16-step grid, play/stop, BPM slider. Use the Web Audio API's look-ahead scheduler.

Write the file.
→ write /tmp/ws/index.html (13110 bytes)
toolResult

Successfully wrote 13110 bytes to /tmp/ws/index.html

assistant
thinking
Should I quickly verify with a syntax check? JS inside HTML — it's possible to extract it and run a simple sanity check with node. Probably fine though. Let's do a simple sanity check by extracting the script and running node --check.
→ bash {"command":"cd /tmp/ws && python3 -c \"\nimport re\nhtml = open('index.html').read()\njs = re.search(r'<script>(.*)</script>', html, re.S).g
toolResult

/bin/bash: line 1: python3: command not found Command exited with code 127

assistant
thinking
There's no python3. I'll either use node directly, or use sed to extract the script.
→ bash {"command":"cd /tmp/ws && node -e \"\nconst fs = require('fs');\nconst html = fs.readFileSync('index.html', 'utf8');\nconst js = html.match(
toolResult

JS syntax OK

assistant
thinking
Wait, there's a subtle bug: inside `start()`, `playBtn` is referenced — it's declared with `const` afterward, but at runtime it's fine. It's only referenced after execution starts. The TDZ issue only matters at call time. All good.

Done.

Done — `index.html` is a fully self-contained, zero-network drum machine: **Features** - **16-step grid** for Kick, Snare, Hi-Hat, and Clap — click any cell to toggle (color-coded per instrument, with beat grouping and step numbers) - **All sounds synthesized live with Web Audio API** (no samples): - *Kick*: sine oscillator with exponential pitch drop (150→40 Hz) - *Snare*: high-passed white noise burst + triangle-wave body - *Hi-hat*: short high-passed noise (7.5 kHz) - *Clap*: four staggered band-passed noise bursts - **Play/Stop** button (also toggled with spacebar), with a lookahead scheduler (`setInterval` + 100 ms audio scheduling) for tight, drift-free timing, plus a synced playhead highlight - **BPM slider** (60–200) adjustable live while playing - Pre-loaded default groove, so pressing Play makes music immediately; toggling a step on also auditions its sound JS syntax validated with `node --check`. Everything runs offline in the sandbox.

TAKE IT TO CODE

A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.

RUN

modelqwen3.8-max
vendorQwen
harnesspi-agent
generated2026-08-03

METRICS

runtime91.5s
tokens in21k
tokens out5.3k
cached14k
cost / run$0.0500