Getting Started with Web Components
@dawcore/components ships framework-agnostic Web Components for multi-track audio editing. Drop <daw-editor> into any HTML page — no React, no build step required.
Installation
npm install @dawcore/components@next
Peer dependencies:
npm install @waveform-playlist/core@next @waveform-playlist/engine@next
Audio backend — choose one:
npm install @dawcore/transport@next # Native Web Audio (recommended)
# or
npm install @waveform-playlist/playout@next tone # Tone.js (required for MIDI playback today)
Optional (for recording):
npm install @waveform-playlist/worklets@next
Minimal setup
<script type="module">
import '@dawcore/components';
import { NativePlayoutAdapter } from '@dawcore/transport';
const editor = document.querySelector('daw-editor');
editor.adapter = new NativePlayoutAdapter(new AudioContext());
</script>
<daw-editor id="editor" samples-per-pixel="1024" wave-height="100" timescale>
<daw-track src="/audio/drums.opus" name="Drums"></daw-track>
<daw-track src="/audio/bass.opus" name="Bass"></daw-track>
<daw-track src="/audio/synth.opus" name="Synth"></daw-track>
</daw-editor>
<daw-transport for="editor">
<daw-play-button></daw-play-button>
<daw-pause-button></daw-pause-button>
<daw-stop-button></daw-stop-button>
</daw-transport>
The editor loads audio, generates waveforms, and handles playback.
Important: AudioContext + adapter are required
<daw-editor> does not create an AudioContext for you. You must:
- Create an
AudioContext(new AudioContext()ornew AudioContext({ sampleRate: 48000 })) - Instantiate a
PlayoutAdapter(e.g.,NativePlayoutAdapterfrom@dawcore/transport) - Assign it to
editor.adapter
This is intentional — it lets consumers choose their audio backend (native Web Audio or Tone.js) and keeps AudioContext lifecycle in your hands.
The <daw-track> elements wait for the adapter: once it is set, they enter the editor in document order and their audio loads. A track whose audio cannot be loaded stays in the editor and fires daw-track-error (its clip is drawn failed when its length is known: a duration on the <daw-clip>, or peaks-src); editor.retryTrack(trackId) loads it again. A download that stops arriving (no response, or no new bytes, for 30 seconds) fails the same way (each daw-clip-error carries an Error whose name is 'TimeoutError'); one that keeps arriving is never cut off. The 30 seconds belong to the editor's own arrangement and cannot be changed for tracks declared in markup: an arrangement you build and hand in (editor.arrangement = createArrangement({ tracks, sourceStallTimeout, sourceTimeout })) sets its own limits, see A load that takes too long.
Memory use of decoded audio
<daw-editor> decodes each clip's source whole into an AudioBuffer before it plays: 4 bytes per sample per channel at the AudioContext's rate, about 1.38 GB for one hour of stereo audio at 48 kHz, whatever the file's format or size (a 39 MB Opus file and a 635 MB WAV of the same hour decode to the same 1.38 GB). While a file decodes the page needs two to three times that, more for an uncompressed file in Chrome and Safari; the runs in three browsers are in the table under Memory Use of Decoded Audio (the same loader serves both editors). The library sets no limit and gives no warning.
For long material to be played rather than edited (a podcast, an audiobook, hours of recording), use <daw-player>: it plays one file through an audio element, which streams it, and decodes nothing up front; its waveform comes from pre-computed peaks (peaks-src), or it shows a scrubber without them.
Try it on this site
Runnable examples — rendered with @dawcore/components directly, no React in the audio path:
- Basic — Minimal
<daw-editor>with the native Web Audio adapter - Multiclip — Multiple
<daw-clip>per track, drag/trim/split, pre-computed peaks via<daw-keyboard-shortcuts> - Player — Lightweight single-track
<daw-player>: HTMLMediaElement streaming, pre-computed peaks or scrubber fallback, playback rate
Run it locally
For the full set (programmatic, record, spectrogram, beats-grid, metronome, automation, analyser, plus Tone.js variants including MIDI), clone the repo:
git clone https://github.com/naomiaro/waveform-playlist.git
cd waveform-playlist
pnpm install
pnpm example:dawcore-native # Native Web Audio backend
pnpm example:dawcore-tone # Tone.js backend (includes MIDI)
Next steps
For the complete element catalog, audio-backend comparison, MIDI loading, recording reference, and CSS theming, see the @dawcore/components README.
Using React instead? → React Getting Started