---
title: "addEvent(_:at:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avmusictrack/addevent(_:at:)"
---

# addEvent(_:at:)

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

## Declaration

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

## Parameters

- `event`: The event to add.
- `beat`: The time to add the event at.

## Discussion

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 subclasses to a track. You can only add AVExtendedTempoEvent and AVMIDIMetaEvent with certain AVMIDIMetaEvent.EventType to a sequencer’s tempo track. You can add AVParameterEvent to automation tracks. You can’t add other event subclasses to tempo or automation tracks.

## See Also

### Adding and Clearing Events

- [moveEvents(in:by:)](avfaudio/avmusictrack/moveevents(in:by:).md)
- [clearEvents(in:)](avfaudio/avmusictrack/clearevents(in:).md)
