mwg API
    Preparing search index...

    Class HumanizerFactory

    One entry point for "humanize this file", so a game never names the class that does the work. The tier decides the engine; everything else about the request is the same for both shipped tiers, which is why the request extends the options rather than wrapping them.

    The engines load on demand through dynamic import. That is a size decision, not a style one: GrooveHumanizer, the extractor and the converter are all reachable from a game that only ever wanted the lite tier, and none of them should be in the bundle merely for living in the same module. The magenta tier is the case where loading would never succeed at all: it needs @magenta/music and a PerformanceRNN checkpoint, and a file:// build can fetch neither, so asking for it fails by name instead of hanging on a request that cannot resolve.

    import { HumanizerFactory, humanizeMidi, parseMidi } from '@datamoc/mwg/audio';

    declare const midiBytes: ArrayBuffer;

    const file = parseMidi(midiBytes);

    //the convenience path: the tier follows from the request
    const lite = await humanizeMidi(file, { intensity: 0.5, seed: 1 });

    //or hold the engine, when several files go through the same one
    const engine = await HumanizerFactory.create('lite');
    const again = await engine.process(lite, { intensity: 0.5, seed: 2 });

    console.log(engine.tierName, engine.approximateSizeMb); // 'lite' 0.05
    Index