A demo of compiling minimp3 to WebAssembly without Emscripten.
import { createDecoder } from './dist/minimp3-wasm.js';
const mp3Data = /* Some Uint8Array */;
const decoder = await createDecoder(mp3Data, './dist/decoder.opt.wasm');
decoder.seek(/*position_in_secounds=*/30);
const results = decoder.decode(/*duration_in_seconds=*/10);
// => { pcm: Int16Array(...), ... }
Prerequisites:
$ make
$ npm install
$ npm run build
The decoder wasm and its bindings will be generated under dist/
directory.