# getSoundBPM (Client)

> Detects the sound's tempo in beats per minute, rounded down.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Sound
- **URL**: https://wiki.mymp.gg/en/getSoundBPM

## Syntax

```lua
float|false getSoundBPM(sound sound)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `sound` | `sound` | The `sound` element, or a `dui` element for the browser's sound. |

## Returns

The beats per minute, or `false` if no tempo was detected.

## Example

```lua
local music = playSound("sounds/track.mp3", true)
local bpm = getSoundBPM(music)
if bpm then
    outputDebugString("BPM: " .. bpm)
end
```

### Note

The first call analyses the whole sound on the spot, which can stall for a moment. The result is kept for later calls.

## See also

- [getSoundFFTData (Client)](https://wiki.mymp.gg/en/getSoundFFTData.md): Returns the frequency spectrum of what the sound is playing right now, for building visualisers.
- [getSoundLength (Shared)](https://wiki.mymp.gg/en/getSoundLength.md): Returns the sound's length.
