---
title: lengthInBeats
framework: avfaudio
role: symbol
role_heading: Instance Property
path: avfaudio/avmusictrack/lengthinbeats
---

# lengthInBeats

The total duration of the track, in beats.

## Declaration

```swift
var lengthInBeats: AVMusicTimeStamp { get set }
```

## Discussion

Discussion This property returns the beat of the last event in the track, plus any additional time that’s necessary to fade out the ending notes, or to round a loop point to a musical bar. If the user doesn’t set this value, the track length always adjusts to the end of the last active event in a track, and adjusts dynamically as the user adds or removes events. This property returns the maximum of the user-set track length or the calculated length.

## See Also

### Configuring the Track Duration

- [lengthInSeconds](avfaudio/avmusictrack/lengthinseconds.md)
