pyampact.alignmentUtils.durations_from_midi_ticks

pyampact.alignmentUtils.durations_from_midi_ticks(filename)[source]

Extract note durations from a MIDI file using MIDI ticks. This function processes a MIDI file, calculates note onset and offset times based on MIDI ticks and tempo, and returns the duration matrix (nmat). It handles tempo changes and computes times by converting MIDI ticks to seconds.

Assumes a default pulses-per-quarter-note (PPQN) value of 96.

Parameters:

filename (str) – Path to the MIDI file to be processed.

Returns:

A numpy array where each row contains the start and end times of notes (in seconds) based on MIDI ticks and tempo changes.

Return type:

np.ndarray