librosa.filters.diagonal_filter(window, n, slope=1.0, angle=None, zero_mean=False)[source]

Build a two-dimensional diagonal filter.

This is primarily used for smoothing recurrence or self-similarity matrices.

windowstring, tuple, number, callable, or list-like

The window function to use for the filter.

See get_window for details.

Note that the window used here should be non-negative.

nint > 0

the length of the filter


The slope of the diagonal filter to produce

anglefloat or None

If given, the slope parameter is ignored, and angle directly sets the orientation of the filter (in radians). Otherwise, angle is inferred as arctan(slope).


If True, a zero-mean filter is used. Otherwise, a non-negative averaging filter is used.

This should be enabled if you want to enhance paths and suppress blocks.

kernelnp.ndarray, shape=[(m, m)]

The 2-dimensional filter kernel


This function caches at level 10.