A simple API for creating waveform images from audio files in the browser.
Optional configuration values can be passed when creating an instance.
color: string; // #666
barGap: number; // 0.4
barWidth: number; // 6
height: number; // 936
width: number; // 132
const waveformer = new Waveformer({
/** ...configuration */
});
// get result as a data url
const dataUrl = waveformer.convertFileToDataUrl(file, 'image/jpeg', 0.9);
// ..or get raw pixel data
const imageData = waveformer.convertFileToImageData(file);
- Convert must happen after first user event or gesture. (Details)
- Uses browser
Canvas
andAudioContext
API's.