mwg API
    Preparing search index...

    Function renderMidiStems

    • Renders one file as several stems that line up: each named group of channels is rendered on its own, and every stem is padded with silence to the length of the longest, so they start together, loop together and can be mixed by level for adaptive music (AdaptiveMusic). A group with no notes in the file comes out silent rather than failing, since an arrangement may leave a layer empty. All options of renderMidiToBuffer apply, channels excepted.

      Parameters

      Returns Record<string, RenderedMidi>

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

      declare const midiBytes: ArrayBuffer;

      const stems = renderMidiStems(parseMidi(midiBytes), { rhythm: [9], melody: [0, 1], pads: [2] });
      console.log(stems.rhythm.duration === stems.melody.duration); // true