# plot\_spectrogram

> plot\_spectrogram(y: npt.ArrayLike, sr:int, scale : str = 'STFT')

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

To show the pitch esitmation result with spectrograms (STFT and Mel)

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

y: input signal&#x20;

sr: sampling rate (22050 Hz by default)

scale: STFT or MEL

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

None

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

<pre class="language-python"><code class="lang-python"><strong>from audioviz import *
</strong>import librosa
import numpy as np
from audioviz import GeneralAnalysis

y, sr = librosa.load('Mozart_Turkish_March.wav', duration = 45)
GeneralAnalysis.plot_spectrogram(y, sr, scale = 'STFT')
</code></pre>

<figure><img src="https://3500702469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh9wXRXdIQoYFVdZ0YFUo%2Fuploads%2FMDZarge8TJJzbdJoXxMt%2Fimage.png?alt=media&#x26;token=8b9f656c-5adf-4dc7-9d8c-6ab688705f7b" alt=""><figcaption></figcaption></figure>

```python
GeneralAnalysis.plot_spectrogram(y, sr, scale = 'Mel')
```

<figure><img src="https://3500702469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh9wXRXdIQoYFVdZ0YFUo%2Fuploads%2FvTv8UxnPGES1SHQA1ziG%2Fimage.png?alt=media&#x26;token=a0019e69-54ee-4a17-90c4-0f636b81db76" alt=""><figcaption></figcaption></figure>
