<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVMusicTrack/addEvent(_:at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVMusicTrack(im)addEvent:atBeat:"
  },
  "title" : "addEvent(_:at:)"
}
-->

# addEvent(_:at:)

Adds a music event to a track at the time you specify.

```
func addEvent(_ event: AVMusicEvent, at beat: AVMusicTimeStamp)
```

## Parameters

`event`

The event to add.

`beat`

The time to add the event at.

## Discussion

The system copies event contents into the track, so you can add the same event at different timestamps. You can’t add all [`AVMusicEvent`](/documentation/AVFAudio/AVMusicEvent) subclasses to a track.

- You can only add [`AVExtendedTempoEvent`](/documentation/AVFAudio/AVExtendedTempoEvent) and [`AVMIDIMetaEvent`](/documentation/AVFAudio/AVMIDIMetaEvent) with certain [`AVMIDIMetaEvent.EventType`](/documentation/AVFAudio/AVMIDIMetaEvent/EventType) to a sequencer’s tempo track.
- You can add [`AVParameterEvent`](/documentation/AVFAudio/AVParameterEvent) to automation tracks.
- You can’t add other event subclasses to tempo or automation tracks.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)