A one-hour sound
An hour of peaks, written right here as an audiowaveform
.dat file and read back, with no audio at all.
The length comes from the file, so it shows at once; zoom in
to see the detail.
Try it
What happens
-
The page makes an hour of samples and writes them
with
writeWaveform, as a server would when a file is uploaded. -
readWaveformreads the bytes back, folding them to the most peaks kept. - A bare frame with zoom, a timeline above and a minimap below draws them. No audio is ever loaded.
// An hour of made-up speech, 100 points per second: bursts and pauses.
const bytes = writeWaveform([points], { sampleRate: 100, samplesPerPeak: 1, bits: 8 });
const waveform = readWaveform(bytes, { maxPeaks: points.length });
new SonicFrame({
container,
peaks: waveform, // { peaks, duration, … }
zoom: { wheel: true, scroll: true, pinch: true, keys: true },
plugins: [timeline({ placement: 'above' }), minimap({ a11y: { keys: true } })],
});