mwg API
    Preparing search index...

    Class GrooveExtractor

    Extracts a groove template from a pair of performances of the same material.

    Every note-on in recordedMidi is matched to the closest still-unused note-on of the same channel and pitch in quantizedMidi. A match is only taken when it falls inside half a slot, so a recorded part with notes the quantized one never plays is ignored instead of being forced onto a neighbour, and a slot the pair never reaches keeps the neutral offset rather than a value invented from no evidence at all.

    import { parseMidi, GrooveExtractor, type GrooveTemplate } from '@datamoc/mwg/audio';

    declare const straightBytes: ArrayBuffer;
    declare const playedBytes: ArrayBuffer;

    const straight = parseMidi(straightBytes);
    const played = parseMidi(playedBytes);

    const template = await new GrooveExtractor().extractFromMidiPair(straight, played, '16n');
    console.log(template.offsets[0].timeOffsetTicks, template.name); // 0 'extracted'

    Implements

    Index