web-audio
Skill202 starsChanged 29 days agoMITView on GitHub
Load this before writing any code that makes or measures sound in a web page: Web Audio API, AudioContext, GainNode, BiquadFilterNode, oscillators, AnalyserNode, MIDI or microphone input. It fixes clicks, crackle and zipper noise when a knob or fader moves a parameter (use ramps, never param.value from a drag), dB to gain, headroom and clipping, look-ahead scheduling on the audio clock when a sequencer or metronome drifts (not setInterval), suspended AudioContext until a click, node cleanup on unmount, and live level meters, spectrum analyzers, waveform playheads and pitch tuners that must not re-render React every frame. Use it whenever audio code is being written or debugged, even if the user does not name audio/ui.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/audio-ui/AGENTS.mdAGENTS.md
- skills/core/AGENTS.mdAGENTS.md
- skills/design/AGENTS.mdAGENTS.md
- skills/web-audio/AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- add-registry-itemSkill
- change-primitiveSkill
- film-componentSkill
- audio-uiSkill
- coreSkill
- designSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 58
Keep the display off React state: Put the signal in a source and read it in the leaf that prints it (live-source-not-state, …
- Distinctive: line 66
Read the rule files for the explanation and the incorrect and correct code:
- Distinctive: line 77
Every rule of this skill expanded in one file: AGENTS.md
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Web Audio with audio/ui
Sound and live data for audio/ui controls. Getting sound out takes an AudioContext that is allowed to start, parameters that move without clicks, and a clock that does not drift. Showing sound takes sources that update outside React: a meter that re-renders the page 60 times a second is the most common way an audio interface becomes slow.
When to Apply
- Starting sound from a button: creating, resuming and cleaning up an
AudioContext - Connecting a knob or fader to a
GainNode, filter or oscillator parameter - Scheduling notes from a step sequencer, a piano roll or a transport clock
- Showing live level, spectrum, waveform or playhead position
- Reading the microphone, a MIDI keyboard or the pitch of a sound
- Fixing clicks, zipper noise, distortion, timing drift or a page that re-renders every frame
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
| 1 | Web Audio | CRITICAL | audio- |
| 2 | Live Data | CRITICAL | live- |
Quick Reference
1. Web Audio (CRITICAL)
audio-resume-in-gesture- Create the AudioContext lazily on the client, resume it in the click that starts soundaudio-ramp-parameters-setTargetAtTime, neverparam.value =from a dragaudio-schedule-on-audio-clock- Start notes at an AudioContext time from a look-ahead clock, never from timersaudio-play-note-state- Skip muted notes, roll each note's chance, stray its velocity by its deviationaudio-db-to-gain- dB on the control,10 ** (db / 20)on the GainNodeaudio-headroom- Size voices, resonance and master volume so the loudest case stays under full scaleaudio-cleanup- Stop and disconnect nodes, cancel frames on unmount
2. Live Data (CRITICAL)
live-source-not-state- Meters, traces, waveforms and playheads take asource(createSource), never per-frame statelive-meter-levels-use-audio-levelsfor RMS in dB from time-domain samples, with peak holdlive-mic-input- Raw microphone signal up-mixed to stereo, analysers never connected to the speakerslive-midi-input-use-midi-inputfor the page's one MIDI input, connected from a clicklive-pitch-detection- A YIN period search (use-pitch) for a tuner, never the loudest FFT binlive-playhead-source- Playback position through a source updated every framelive-decode-once- Decode and reduce waveform peaks once per filelive-leaf-subscription- Subscribe to a source only in the leaf that prints itlive-spectrum-hook-use-spectrumfor a log-axis spectrum on a Plot
Workflow
- Create the context lazily on the client and resume it in the click that starts sound (
audio-resume-in-gesture). Nothing makes sound before that gesture. - Move parameters with ramps. A drag fires dozens of changes a second;
param.value =from one is audible (audio-ramp-parameters). - Keep the display off React state. Put the signal in a source and read it in the leaf that prints it (
live-source-not-state,live-leaf-subscription). - Schedule on the audio clock, never from
setTimeoutorsetInterval(audio-schedule-on-audio-clock). - Verify. Drag every control fast and listen for clicks, background the tab during playback, and check in the profiler that nothing re-renders per frame. A headless browser has no microphone: feed an
OscillatorNodethrough the same analyser to test an input path.
Components, install names and the controls themselves: the audio-ui skill. Picking the look: the design skill.
How to Use
Read the rule files for the explanation and the incorrect and correct code:
rules/audio-ramp-parameters.md
rules/live-source-not-state.md- Full docs: https://www.audio-ui.dev/llms.txt
Full Compiled Document
Every rule of this skill expanded in one file: AGENTS.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

