musicaiz.features.plot_ssm

musicaiz.features.plot_ssm(ssm: numpy.ndarray, segments: bool = False, threshold: float = 0.5, window: float = 2, save: Optional[bool] = False, filename: str = 'ssm', origin: str = 'lower', title: Optional[str] = None, colorbar: bool = True, dpi: int = 300)[source]

Plots a SSM.

Parameters
ssm: np.ndarray [shape=(n_bars, n_bars)]

The SSM.

segments: bool

Plot the sections boundaries over the SSM by computing the novelty function. Default is False.

threshold: float

The threshold for peak picking in the novelty curve if segments=True. Default is 0.5.

window: float

The window for peak picking in the novelty curve if segments=True. Default is 2.

save: Optional[bool]

True if we want to save the output plot in disk. Defaults to True.

filename: str

The name of the file of the plot in disk. Defaults to "ssm".

origin: str

to matplotlib.pyplot.imshow: https://matplotlib.org/3.5.0/tutorials/intermediate/imshow_extent.html. Defaults to "lower".

title: Optional[str]

Plot title. Defaults to None.

colorbar: bool

True if we want to show the colorbar in the plot. Defaults to True.

dpi: int

dpi of the plot. Defaults to 300.

Examples

>>> from pathlib import Path
>>> file = Path("C:/Users/Carlos/Downloads/988-aria.mid")
>>> ssm = musicaiz.features.compute_ssm(
    file=file,
    ssm_type="measures",
    measures="all"
)
>>> plot_ssm(ssm)