import { AudioCoreHost, parseMidi, sendMidiToHost, type AudioCore } from '@datamoc/mwg/audio';
declare const midiBytes: ArrayBuffer;
declare const factory: (rate: number) => AudioCore;
const host = new AudioCoreHost({ sampleRate: 44100, factory });
const lastFrame = sendMidiToHost(host, parseMidi(midiBytes));
console.log(lastFrame / 44100);
Starts a MIDI file on a host: resets the core, drops what was rendered ahead and queues every channel message at its own output frame in one post (before any further audio is requested, so a worker never renders the first seconds without them), and returns the frame of the last message.
startFramemoves the whole file later.