Structure and Segmentation
audio_samples.segment holds path enhancement, time-lag filtering, temporally constrained clustering and subsegmentation.
Structure analysis over feature matrices: path enhancement, temporally constrained clustering, subsegmentation.
- class audio_samples.segment.TimelagFiltered
Bases:
objectThe filter that [timelag_filter] returns.
- audio_samples.segment.agglomerative(data, k, *, clusterer=None, axis=-1)
Segment boundaries from Ward clustering in which only neighbouring segments merge.
- Parameters:
- Returns:
The first frame of each segment.
- Return type:
numpy.ndarray[int64]
- audio_samples.segment.diagonal_filter(window, n, *, slope=1.0, angle=None, zero_mean=False)
A normalised smoothing kernel along a line through the origin.
- Parameters:
- Returns:
The kernel.
- Return type:
numpy.ndarray[float64]
- audio_samples.segment.path_enhance(R, n, *, window='hann', max_ratio=2.0, min_ratio=None, n_filters=7, zero_mean=False, clip=True, **kwargs)
The largest response of a recurrence matrix to diagonal kernels of several slopes.
- Parameters:
R (
array_like) –(..., n, n)or lag matrix.n (int) – Length of each kernel, before rotation.
window (str | tuple |
array_like) – The window along each diagonal. Default"hann".max_ratio (float) – Largest slope. Default 2.
min_ratio (Optional[float]) – Smallest slope. Default
1 / max_ratio.n_filters (int) – Number of slopes. Default 7.
zero_mean (bool) – Subtract each kernel’s mean. Default false.
clip (bool) – Set negative results to zero. Default true.
**kwargs –
mode("reflect","constant","nearest","mirror","wrap"),cvalandorigin.
- Returns:
The shape of
R, of its precision.- Return type:
- audio_samples.segment.subsegment(data, frames, *, n_segments=4, axis=-1)
Subdivides each interval of a segmentation with
agglomerative().- Parameters:
- Returns:
The first frame of each subsegment.
- Return type:
numpy.ndarray[int64]
- audio_samples.segment.timelag_filter(function, pad=True, index=0)
Wraps a filter so that it runs on a recurrence matrix in lag coordinates.
- Parameters:
- Returns:
Takes the same arguments as
functionand returns a recurrence matrix.- Return type:
Callable