Library
Install
import audio from 'audio'
await audio('voice.wav').trim().normalize('podcast').save('clean.mp3')
How it works
A sound is a chain of edits. Nothing is rendered until it is played, saved or measured. On top of its packages it adds paging (no 2 GB limit), streaming (it plays and encodes while it decodes) and non-destructive edits (infinite undo).
Examples
Clean a take, and prove it meets Apple's podcast spec.
let voice = audio('voice.wav') .trim().normalize('podcast') await voice.save('clean.mp3') let { pass, rules } = await voice.check('podcast')Master a song to a reference track: its tone, width and loudness.
audio('mix.wav') .master(await audio('ref.wav')) .save('master.wav')Tighten the pauses of a talking-head video; the same cuts go to the video editor.
let talk = audio('talk.mp4') .shrink(0.3) await talk.save('talk.m4a') await talk.save('talk.edl')The page's Audio element in Node, Bun and Deno: one import, the same events and promises.
import 'audio/polyfill' let song = new Audio('song.mp3') await song.play() song.currentTime = 30
Run
npx audio voice.wav trim normalize podcast save clean.mp3
How it works
A source, its edits in order, a sink. With no sink, a file opens in the terminal's player.
Examples
Check a file against a delivery spec. A fail exits 1, so the line guards a build.
$ audio clean.mp3 check podcast ✓ Loudness -16.44 LUFS -17 to -15 ✓ True peak -1.18 dBTP ≤ -1 passPlay a hook on a loop; play with effects applied live.
$ audio song.mp3 30s..45s play loop $ audio song.mp3 normalize \ broadcast highpass 80hz playSplit an album at its cue sheet, each track tagged.
$ audio album.wav split \ --cue album.cue \ save '{i} - {title}.mp3'
Use
import audio from 'audio'
await audio('take.wav').compressor(-30, 8).save('out.wav')
How it works
A plugin is a processor from an @audio package: an effect, a repair, a synth. Its family installs with audio and loads at the first render that calls it. A value takes its parameter’s unit. The same processor runs in an AudioWorklet and, experimental and on macOS, builds to VST3 and CLAP.
Examples
By its name, a value in its parameter’s unit.
audio('take.wav') .compressor({ attack: '10ms' }) .delay({ time: '250ms' })One of your own: a block processor, by a name of yours.
audio.op('invert', (inp, out) => { for (let c = 0; c < inp.length; c++) out[c].set(inp[c].map(v => -v)) }) audio('take.wav').invert()The contract: a function that returns a function, its parameters on it.
export const gain = (ctx) => (inputs, outputs, params) => { … } gain.params = { gain: { type: 'number', min: -60, max: 24, default: 0, unit: 'dB' }, }
Use
<script type="module"
src="https://audio.js.org/audio/elements/index.js"></script>
How it works
The editor in parts: custom elements a page composes, each the HTML face of a module the editor itself runs on, in the page's own DOM and styled by it. A sound's script runs in a worker; the page's thread stays free.
Examples
A sound as a script makes it, with its picture and its parts
<audio-clip> <audio src="take.mp3" data-name="take.mp3"></audio> <audio-code> <pre><code>audio('take.mp3') .trim() .save('clean.mp3')</code></pre> </audio-code> <audio-wave></audio-wave> <audio-play></audio-play> <audio-save></audio-save> </audio-clip>A script alone, coloured as the editor colours it, editable
<audio-code> <pre><code>audio('take.mp3') .normalize('podcast')</code></pre> </audio-code>The editor whole, in any page: the element's text is its script
<script type="module" src="https://audio.js.org/embed.js"> </script> <audio-repl height="320"> <pre>audio('chime.wav').trim()</pre> </audio-repl>
Connect
npx add-mcp "npx -y audio --mcp"
What it does
An agent measures, edits and plays sound with the same calls a script makes: Claude Code, Codex, Cursor, Gemini CLI, Zed and others.
Examples
Ask for the result, not the steps.
> make ~/Desktop/interview.m4a podcast-ready and tell me the loudness before and afterThe same as an agent skill.
$ npx skills add audiojs/audioYour own agent inside the editor: it measures, looks at, edits and plays the sound that is open there.
$ npx audio --bridge audio bridge on http://127.0.0.1:7777
FAQ
How is it different from the Web Audio API?
Audio.js is platform independent stack with own DSP.
See web-audio-api
Does it need ffmpeg or native addons?
No FFmpeg: codecs and DSP are JavaScript and WebAssembly. In Node, the speaker and the microphone use one small addon, prebuilt for macOS, Linux and Windows. Nothing compiles at install.
What formats does it decode and encode?
Is it as fast as FFmpeg or SoX?
Not as fast as FFmpeg yet: FFmpeg wins four of the six timed against it. Ahead of SoX in four of five.
| 10-minute file | audio | FFmpeg | SoX |
|---|---|---|---|
| WAV decode | 246 ms | 73 ms | 50 ms |
| MP3 decode | 306 ms | 484 ms | – |
| LUFS | 229 ms | 336 ms | – |
| Peak normalize | 405 ms | – | 555 ms |
| Resample to 48 kHz | 450 ms | 292 ms | 1.04 s |
| Time stretch 0.8× | 3.09 s | 665 ms | 5.82 s |
| Pitch shift +2 st | 2.83 s | 821 ms | 6.02 s |
How it was measured, 2026-11. Shorter is faster.
How big is it?
| In a page | 155.5 KB gzipped; codecs load on first use |
|---|---|
| One package | @audio/decode-wav: 24 KB |
| All of it | npm i audio: 16.6 MB, the 24 decoders and 14 encoders in it, nothing compiled |
| For scale | FFmpeg in WebAssembly, @ffmpeg/core: 64.7 MB |
Sizes unpacked, as npm states them, 26 Nov 2026.
TypeScript?
Yes. audio ships its types, audio.d.ts.