Core Audio

On this page 7

Core Audio is the digital audio infrastructure of macOS: a layered set of frameworks, a system daemon and a driver model that move sound between applications and hardware with low, predictable latency. Every beep, music player, video call and professional recording session on a Mac passes through it, which makes Core Audio one of the quieter but most important parts of macOS fundamentals.

Unlike older designs that relied on separate mixing layers, Core Audio was built into Mac OS X from the start, with floating-point processing, multichannel support and sample-accurate timing as native features. It sits above the Darwin kernel and XNU drivers and below user-facing tools such as Audio MIDI Setup and the sound controls in Control Center.

How Core Audio moves sound through the system

Core Audio works as a pipeline of buffers driven by the hardware clock. An audio device, such as built-in speakers or a USB interface, requests a new block of samples at a fixed interval, and Core Audio calls each client through a real-time I/O callback to fill or read that block before the deadline passes.

The central broker is the Hardware Abstraction Layer (HAL), which runs inside the coreaudiod daemon launched by launchd. The HAL presents every device through one uniform model of devices, streams and properties, so an application can query sample rate, channel count or volume without knowing whether the device is a Bluetooth headset or a Thunderbolt interface.

Internally, samples travel as 32-bit floating-point linear PCM, which gives generous headroom and avoids clipping during mixing. Conversion to the integer formats that hardware expects happens at the edge of the pipeline, ideally only once.

The following table shows the main stages a sound passes through on its way to the speakers.

StageComponentWhat happens
GenerationApplication or audio unitSamples are produced or decoded
ProcessingAudio units and AVAudioEngineEffects, mixing and format conversion
BrokeringHAL in coreaudiodClients are scheduled against the device clock
Driver transferAudio Server plug-in or kernel driverBuffers are copied to device memory
PlaybackHardware codec or DACDigital samples become an analog signal
Stages of the Core Audio output path

Frameworks and layers in the Core Audio stack

Core Audio is not a single API but a family of frameworks at different levels of abstraction. Developers choose the highest level that meets their timing needs, because lower levels offer more control at the cost of considerably more code and stricter real-time rules.

Framework or serviceLevelTypical use
AVFoundation and AVAudioEngineHighPlayback, recording and effect graphs
Audio ToolboxMiddleAudio queues, file and format services
Audio Units (AUv2, AUv3)MiddlePlug-in instruments and effects
Core MIDIMiddleMIDI devices, networks and timing
Core Audio HAL APILowDirect device access and properties
AudioDriverKit and Audio Server plug-insDriverCustom or virtual audio devices
Main Core Audio frameworks and their roles

Audio Units deserve special mention: they are the native plug-in format of macOS, used by digital audio workstations for synthesizers and effects. The newer AUv3 model packages a plug-in as an app extension, which runs it in a separate, sandboxed process for better stability and security.

Latency, buffer size and sample rate

Latency in Core Audio is mainly determined by the I/O buffer size divided by the sample rate, plus fixed converter and driver delays. A smaller buffer reduces delay but gives the processor less time per cycle, which raises the risk of dropouts, clicks and glitches when the workload is heavy.

The table below gives approximate buffer durations at 48 kHz, excluding hardware safety offsets, which usually add one to a few milliseconds depending on the device.

Buffer sizeApproximate delayTypical use
32 framesAbout 0.7 msLive monitoring on capable hardware
128 framesAbout 2.7 msRecording with software instruments
512 framesAbout 10.7 msDefault playback and general use
1024 framesAbout 21.3 msMixing large sessions with many plug-ins
Buffer size and approximate one-way buffer delay at 48 kHz

Core Audio also handles sample rate conversion when an application and a device disagree, for example a 44.1 kHz song played through a 48 kHz output. The converter quality is high, but matching rates avoids extra processing and is preferred in professional work.

Aggregate devices, multi-output devices and routing

Core Audio can combine several physical devices into one virtual device, configured in the Audio MIDI Setup utility. This lets a recording app see the inputs of two interfaces as a single device, or lets the system send identical sound to speakers and headphones at once.

Device typeWhat it doesMain caveat
Aggregate deviceMerges inputs and outputs of several devicesNeeds a clock source and drift correction
Multi-output devicePlays one stream to several outputsVolume control is often unavailable
Virtual loopback deviceRoutes audio from one app to anotherRequires a third-party Audio Server plug-in
Virtual device types and when to use them

Because independent devices run on separate clocks that drift apart slowly, an aggregate device designates one clock source and applies drift correction to the others. Without it, buffers slowly overflow or underrun, producing periodic clicks over long sessions.

Common problems and how to diagnose them

Most Core Audio faults come from real-time deadline misses, misconfigured devices or a stuck daemon rather than from defects in the frameworks themselves. A structured approach usually finds the cause quickly.

  • Crackling under load: increase the buffer size, freeze plug-in tracks or close heavy background apps.
  • No sound or a missing device: restarting the coreaudiod process from Terminal forces the HAL to rebuild its device list.
  • Wrong pitch or speed: check that the sample rate in Audio MIDI Setup matches the session rate.
  • Bluetooth quality drops during calls: opening the microphone can switch a headset to a low-bandwidth profile.
  • Plug-in crashes in a host: AUv3 isolation and validation with the auval tool help locate the faulty component.

A frequent developer mistake is allocating memory, taking locks or logging inside the render callback. These operations can block for an unpredictable time, so the real-time thread misses its deadline and the listener hears a glitch.

Explained without jargon

Core Audio is the sound system built into every Mac. Think of it as a busy traffic controller for audio. Apps hand it the sounds they want to play, and it decides how to mix them and which speaker or headphone should receive them.

It works on a strict timetable. Every few milliseconds, the speakers ask for the next small slice of sound, and Core Audio makes sure it arrives on time. When everything keeps up, playback is smooth. When the computer is too busy to deliver a slice in time, you hear a click or a short gap. The key idea is reliable timing, and that reliability is why many musicians choose the Mac.

A typical use case

A podcast producer records a two-person interview in a small home studio. Each host has a microphone connected to a separate USB interface, so the producer opens Audio MIDI Setup and creates an aggregate device that combines both interfaces, choosing the first one as the clock source and enabling drift correction for the second.

In the recording app, the producer selects the aggregate device, sets the sample rate to 48 kHz and the buffer to 128 frames so the hosts hear themselves in their headphones without a distracting echo. During editing, when many noise-reduction plug-ins are active, the producer raises the buffer to 1024 frames. The result is a clean, synchronized two-track recording with no clicks, captured without any dedicated mixing hardware.