<!--
{
  "documentType" : "article",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/cmaudioclock-api",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "CMAudioClock"
}
-->

# CMAudioClock

A specialized reference clock that synchronizes with audio sources.

## Discussion

An audio clock is a specialized [`CMClock`](/documentation/CoreMedia/CMClock) that you use to synchronize with audio sources. For details on clocks and synchronization, see [`CMClock`](/documentation/CoreMedia/CMClock).

## Topics

### Creating Audio Clocks

[`CMAudioClockCreate(allocator:clockOut:)`](/documentation/CoreMedia/CMAudioClockCreate(allocator:clockOut:))

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

[`CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:)`](/documentation/CoreMedia/CMAudioDeviceClockCreate(allocator:deviceUID:clockOut:))

Creates a clock that tracks playback through a Core Audio device with the specified unique identifier.

[`CMAudioDeviceClockCreateFromAudioDeviceID(allocator:deviceID:clockOut:)`](/documentation/CoreMedia/CMAudioDeviceClockCreateFromAudioDeviceID(allocator:deviceID:clockOut:))

Creates a clock that tracks playback through a Core Audio device with the specified identifier.

### Configuring Audio Clocks

[`CMAudioDeviceClockGetAudioDevice(_:deviceUIDOut:deviceIDOut:trackingDefaultDeviceOut:)`](/documentation/CoreMedia/CMAudioDeviceClockGetAudioDevice(_:deviceUIDOut:deviceIDOut:trackingDefaultDeviceOut:))

Returns the Core Audio device the clock is tracking.

[`CMAudioDeviceClockSetAudioDeviceUID(_:deviceUID:)`](/documentation/CoreMedia/CMAudioDeviceClockSetAudioDeviceUID(_:deviceUID:))

Changes the Core Audio device the clock is tracking by specifying a new device unique identifier.

[`CMAudioDeviceClockSetAudioDeviceID(_:deviceID:)`](/documentation/CoreMedia/CMAudioDeviceClockSetAudioDeviceID(_:deviceID:))

Changes the Core Audio device the clock is tracking by specifying a new device identifier.



---

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)