<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMAudioClockCreate(allocator:clockOut:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMAudioClockCreate"
  },
  "title" : "CMAudioClockCreate(allocator:clockOut:)"
}
-->

# CMAudioClockCreate(allocator:clockOut:)

Creates a clock that advances at the same rate as audio output.

```
func CMAudioClockCreate(allocator: CFAllocator?, clockOut: UnsafeMutablePointer<CMClock?>) -> OSStatus
```

## Parameters

`allocator`

Allocator for the new clock; pass <doc://com.apple.documentation/documentation/CoreFoundation/kCFAllocatorDefault> or `nil` to use the default allocator.

`clockOut`

Upon return, a pointer to the newly created clock.

## Discussion

This clock doesn’t drift from audio output, but may drift from [`CMClockGetHostTimeClock()`](/documentation/CoreMedia/CMClockGetHostTimeClock()). When audio output is completely stopped, the clock continues to advance, tracking `CMClockGetHostTimeClock` until audio output starts up again.

> Important:
> In Objective-C, you’re responsible for calling <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> to release the returned `clockOut`.

You can use this clock as the <doc://com.apple.documentation/documentation/AVFoundation/AVPlayer/sourceClock> of an <doc://com.apple.documentation/documentation/AVFoundation/AVPlayer> instance when synchronizing video-only playback with audio played through other APIs or objects.

> Note:
> For Mac apps built with Mac Catalyst, use ``doc://com.apple.coremedia/documentation/CoreMedia/CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:)`` or ``doc://com.apple.coremedia/documentation/CoreMedia/CMAudioDeviceClockCreateFromAudioDeviceID(allocator:deviceID:clockOut:)`` to target a specific, nondefault audio device.

---

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)