web-audio-api
Skill864 starsChanged 8 days agoMITView on GitHub
Web Audio API spec reference and browser passthrough layer (src/web-core/). Use when implementing a node that must match the Web Audio API spec, checking parameter default values and ranges, adding or modifying src/web-core/ wrapper classes, deciding whether a feature belongs to the spec or is an RN-specific extension, or updating the coverage table. Trigger phrases: "web-core", "spec compliance", "coverage table", "api.web.ts", "Web Audio spec", "parameter default", "browser passthrough", "not in spec", "spec deviation", "webaudio.github.io".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- martinholovsky/claude-skills-generatortheir own version, first seen Nov 29, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- martinholovsky/claude-skills-generator★ 48same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- apps/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/expressive-code.mdcCursor rule
- audio-nodesSkill
- build-compilation-dependenciesSkill
- expressive-codeSkill
- flowSkill
- host-objectsSkill
- post-work-checksSkill
- thread-safety-itcSkill
- turbo-modulesSkill
- utilitiesSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 5 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 91
Every public method/property must have a direct counterpart in the spec (or be in custom/)
- Distinctive: line 93
No business logic — the browser engine is the source of truth for audio processing
- Very specific: line 94
If a node does not exist in the browser, it goes in src/web-core/custom/
- Distinctive: line 104
When adding a new RN-specific feature that should also work on web, implement the web version here.
- Very specific: line 147
When implementing these on the RN side, a web stub or polyfill in src/web-core/custom/ should be considered if the feature can be …
- Distinctive: line 153
When adding a new Web Audio API node that is in the spec:
- Distinctive: line 160
Add any validation that matches the RN side's error behaviour
- Very specific: line 172
If the node does not exist in the browser (e.g.
- Very specific: line 174
Add a stub or alternative implementation in src/web-core/custom/
- Distinctive: line 182
When in doubt, cross-check the spec.
- Very specific: line 185
feedforwardall-zeros: must throw InvalidStateError — the spec requires at least one non-zero coefficient. - Very specific: line 186
OscillatorNode.type = 'custom': must throw InvalidStateError — use setPeriodicWave() instead.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Skill: Web Audio API
Spec Reference
Everything that has a counterpart in the Web Audio API specification must match it:
- Spec: https://webaudio.github.io/web-audio-api/
- MDN reference: https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API
Key spec sections to check when implementing or reviewing a node:
- Processing model and render quantum (128 frames)
AudioNodechannel count rules andchannelCountMode/channelInterpretationAudioParamautomation methods, value clamping, and timing- Each node's constructor options, property defaults, and valid ranges
Platform Routing
The library ships one TypeScript API that runs on two platforms. The entry point swap happens via package.json field resolution:
index.ts # re-exports from api.ts (or api.web.ts on web)
├── api.ts # React Native — re-exports from src/core/*
└── api.web.ts # Browser — re-exports from src/web-core/*On React Native: classes in src/core/ hold a reference to a C++ JSI HostObject. All method calls go to native.
On Web (browser): classes in src/web-core/ wrap the corresponding globalThis.* (browser Web Audio API) object. All method calls delegate directly to the browser engine.
Both sides share:
- The same TypeScript interfaces (
src/interfaces.ts) - The same types (
src/types.ts) - The same error classes (
src/errors/) - The same hooks (
src/hooks/)
src/web-core/ — Browser Passthrough Layer
Each file in src/web-core/ is a thin wrapper around the corresponding browser API object. The pattern is:
Constructor: instantiate the browser node via globalThis.XxxNode (or new window.AudioContext), store it as this.node (or this.context), read readonly properties from it.
Getters/setters/methods: delegate directly to this.node.
AudioParam: wrapped in the local AudioParam class (which stores this.param: globalThis.AudioParam and delegates all automation calls).
// Example: GainNode.tsx (minimal)
export default class GainNode extends AudioNode {
readonly gain: AudioParam;
constructor(context: BaseAudioContext, gainOptions?: GainOptions) {
const gain = new globalThis.GainNode(context.context, gainOptions);
super(context, gain);
this.gain = new AudioParam(gain.gain, context);
}
}
// Example: OscillatorNode.tsx (with extra validation)
public set type(value: OscillatorType) {
if (value === 'custom') {
throw new InvalidStateError("'type' cannot be set to 'custom' directly...");
}
(this.node as globalThis.OscillatorNode).type = value;
}AudioContext (web) wraps window.AudioContext. It also adds validation matching the RN side (e.g. sampleRate range check) so error behaviour is consistent across platforms.
decodeAudioData on web additionally supports a string URL source (fetches the file, then decodes). This is a deliberate extension beyond the browser spec signature (which only takes ArrayBuffer), mirroring the RN native implementation.
Rules for web-core code
- Every public method/property must have a direct counterpart in the spec (or be in
custom/) - Extra validation (range checks, length checks) is fine — it makes error messages consistent with the RN side
- No business logic — the browser engine is the source of truth for audio processing
- If a node does not exist in the browser, it goes in
src/web-core/custom/
src/web-core/custom/ — RN Extensions on Web
Nodes or features that don't exist in the Web Audio API spec but are in this library as mobile extensions. The custom/index.ts re-exports them and api.web.ts re-exports the custom barrel.
Currently: signalsmith-stretch WASM wrapper (LoadCustomWasm.ts, signalsmithStretch/) for time-stretch on web. Native pitch correction uses WSOLA in the C++ engine.
When adding a new RN-specific feature that should also work on web, implement the web version here.
Implementation Coverage
Current status (from packages/audiodocs/docs/other/web-audio-api-coverage.mdx):
Fully implemented ✅
AnalyserNode, AudioBuffer, AudioBufferSourceNode, AudioDestinationNode, AudioNode, AudioParam, AudioScheduledSourceNode, BiquadFilterNode, ChannelMergerNode, ChannelSplitterNode, ConstantSourceNode, ConvolverNode, DelayNode, GainNode, IIRFilterNode, OfflineAudioContext, OscillatorNode, PeriodicWave, StereoPannerNode, WaveShaperNode, MediaElementAudioSourceNode
Partially implemented 🚧
| Interface | What's available |
AudioContext | baseLatency, outputLatency, getOutputTimestamp, close, suspend, resume, currentTime, destination, sampleRate, state |
BaseAudioContext | currentTime, destination, listener, sampleRate, state, decodeAudioData, all create* for available nodes |
AudioListener | All nine AudioParams; used by PannerNode for 3D spatialization; deprecated setPosition / setOrientation provided in JS (set AudioParam values) |
PannerNode | Equal-power spatialization, distance models, cone gain; panningModel is 'equalpower' only |
Not yet implemented ❌
AudioSinkInfo, AudioWorklet, AudioWorkletGlobalScope, AudioWorkletNode, AudioWorkletProcessor, DynamicsCompressorNode, MediaStreamAudioDestinationNode, MediaStreamAudioSourceNode
Goal: everything in the Web Audio API spec should eventually be in this library. If you implement a node from the ❌ list, update the coverage table in packages/audiodocs/docs/other/web-audio-api-coverage.mdx.
RN-Specific Extensions (beyond spec)
These are exported from api.ts but not from api.web.ts (or have a stub/custom web implementation):
| Class | Purpose |
AudioBufferQueueSourceNode | Queue of audio buffers, plays them sequentially — no Web Audio spec equivalent |
AudioRecorder | Microphone input recording — no Web Audio spec equivalent |
RecorderAdapterNode | Connects recorder to the audio graph |
WorkletNode / WorkletSourceNode / WorkletProcessingNode | JS-on-audio-thread via React Native Worklets — different from browser AudioWorkletNode |
AudioManager | iOS/Android audio session management (permissions, routing, interruption handling) |
decodeAudioData (standalone) | Standalone decode utility (not on context) |
decodePCMInBase64 | Decode raw PCM from base64 |
When implementing these on the RN side, a web stub or polyfill in src/web-core/custom/ should be considered if the feature can be reasonably approximated in a browser.
Adding a New Spec Node — Web Layer Checklist
When adding a new Web Audio API node that is in the spec:
- Implement
src/web-core/MyNode.tsx- Extend the right base class (
AudioNode,AudioScheduledSourceNode) - Constructor:
new globalThis.MyNode(context.context, options) - Wrap all
AudioParamproperties innew AudioParam(node.myParam, context) - Delegate all getters/setters/methods to
this.node - Add any validation that matches the RN side's error behaviour
- Extend the right base class (
Export from
src/api.web.tsexport { default as MyNode } from './web-core/MyNode';- Ensure the interface in
src/interfaces.ts(or a dedicated interface file) is shared between both paths. - Update the coverage table in
packages/audiodocs/docs/other/web-audio-api-coverage.mdx— move the node from ❌ to ✅.
If the node does not exist in the browser (e.g. AudioBufferQueueSourceNode):
- Add a stub or alternative implementation in
src/web-core/custom/ - Export it from
src/web-core/custom/index.ts - It will be picked up automatically by the
export * from './web-core/custom'line inapi.web.ts
Spec Compliance Notes
When in doubt, cross-check the spec. Key invariants that are easy to get wrong:
feedback[0]must not be 0 forIIRFilterNode— the spec requires it; we validate in TypeScript and in C++.feedforwardall-zeros must throwInvalidStateError— the spec requires at least one non-zero coefficient.OscillatorNode.type = 'custom'must throwInvalidStateError— usesetPeriodicWave()instead.AudioParammin/max — must match the spec's exact values; do not invent ranges.createBuffer/createDelay/createPeriodicWave— the spec defines when these throw and what error type. Match it.decodeAudioData— on RN side, we extend it to accept a URL string in addition toArrayBuffer. This is intentional and documented.sampleRaterange — spec says [8000, 96000]; enforced inAudioContextconstructor on both platforms.
Maintenance: see maintenance.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.

