librosa.util.match_intervals

librosa.util.match_intervals(intervals_from, intervals_to)[source]

Match one set of time intervals to another.

This can be useful for tasks such as mapping beat timings to segments.

Note

A target interval may be matched to multiple source intervals.

Parameters:
intervals_from : np.ndarray [shape=(n, 2)]

The time range for source intervals. The i th interval spans time intervals_from[i, 0] to intervals_from[i, 1]. intervals_from[0, 0] should be 0, intervals_from[-1, 1] should be the track duration.

intervals_to : np.ndarray [shape=(m, 2)]

Analogous to intervals_from.

Returns:
interval_mapping : np.ndarray [shape=(n,)]

For each interval in intervals_from, the corresponding interval in intervals_to.

Raises:
ParameterError

If either array of input intervals is not the correct shape

See also

match_events