<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AudioToolbox",
  "identifier" : "/documentation/AudioToolbox/MusicTrackMerge(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@MusicTrackMerge"
  },
  "title" : "MusicTrackMerge(_:_:_:_:_:)"
}
-->

# MusicTrackMerge(_:_:_:_:_:)

Copies a range of events from one music track and merges them into another music track.

```
func MusicTrackMerge(_ inSourceTrack: MusicTrack, _ inSourceStartTime: MusicTimeStamp, _ inSourceEndTime: MusicTimeStamp, _ inDestTrack: MusicTrack, _ inDestInsertTime: MusicTimeStamp) -> OSStatus
```

## Parameters

`inSourceTrack`

The music track that you want to copy events from.

`inSourceStartTime`

The start time, in beats, for the range of music track events that you want to copy from the source track.

`inSourceEndTime`

The end time, in beats, for the range of music track events that you want to copy from the source track.

`inDestTrack`

The music track that you want to add events to.

`inDestInsertTime`

The insertion point, in beats, in the destination music track for the copied events.

## Return Value

A result code.

## Discussion

The events inserted into the destination music track are merged with existing events in that track. The events in the destination track that existed prior to calling this function remain in place.

The `inSourceStartTime` value must be less than the `inSourceEndTime` value.

---

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)