# plot\_self\_similarity

> plot\_self\_similarity(y: npt.ArrayLike, sr: int, affinity: bool = False, hop\_length: int = 1024)

{% hint style="info" %}
Function description
{% endhint %}

To visualize the similarity matrix of the signal

{% hint style="info" %}
Parameter
{% endhint %}

y\_ref: reference signal&#x20;

y\_comp: signal to be compared&#x20;

sr: sampling rate affinity: to use affinity or not&#x20;

hop\_size: hop size between frames

{% hint style="info" %}
Return
{% endhint %}

None

{% hint style="info" %}
Example
{% endhint %}

```python
from audioviz import *
import librosa
import numpy as np
from audioviz import StructureAnalysis

y, sr = librosa.load('Mozart_Turkish_March.wav', duration = 45)
StructureAnalysis.plot_self_similarity(y_ref = y, sr = sr)
```

<figure><img src="https://3500702469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh9wXRXdIQoYFVdZ0YFUo%2Fuploads%2FY8uQQ9s6IXq0UArbCpkm%2Fimage.png?alt=media&#x26;token=b1e9c4e0-0347-479d-8f82-b3ed5f25994c" alt=""><figcaption></figcaption></figure>

```python
StructureAnalysis.plot_self_similarity(y_ref = y, sr = sr, affinity=True)
```

<figure><img src="https://3500702469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh9wXRXdIQoYFVdZ0YFUo%2Fuploads%2FywebJnXAoGvSIwJPf70r%2Fimage.png?alt=media&#x26;token=22632a1c-14d5-48dd-8ff3-e1d3f11d11e7" alt=""><figcaption></figcaption></figure>
