# onsets\_detection

> onsets\_detection(y: npt.ArrayLike, sr: int, write\_to\_wav: bool = False)

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

To show onsets of the input signal with time axis and modify the .wav with onset click sounds

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

y: input signal&#x20;

sr: sampling rate (22050 Hz by default)&#x20;

save\_to\_wav: to add onset click sounds (not to store by default)

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

None

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

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

y, sr = librosa.load('Mozart_Turkish_March.wav', duration = 45)
BeatAnalysis.onsets_detection(y = y, sr = sr)
```

<figure><img src="https://3500702469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh9wXRXdIQoYFVdZ0YFUo%2Fuploads%2FBDwbfP4OzBvFM1Y4zhMQ%2Fimage.png?alt=media&#x26;token=2f9171e9-d438-40cc-be11-e5a29a081df5" alt=""><figcaption></figcaption></figure>
