A command-line utility for macOS that captures audio from an aggregate device input and routes it to one or more output channel pairs using CoreAudio and AudioUnit.
- Select an Aggregate Device (created in Audio MIDI Setup) that combines one or more physical input/output devices.
- Route any combination of source channels to any number of destination channels, including duplication and round-robin mapping.
- Minimal dependencies (only Swift, CoreAudio, AudioUnit).
- Optional debug logging controlled by a
DEBUGflag in the source.
- macOS 12.0 or later
- Swift 5.x toolchain
- Xcode command line tools (for
swiftc)
Compile the program as a universal binary (Intel + ARM) via the provided build script:
chmod +x build.sh
./build.shOr build manually with Swift:
swiftc -o AudioPassThroughUniversal AudioPassThrough.swift./AudioPassThroughUniversal <AggregateDeviceName> <SrcChannels> <DstChannels><AggregateDeviceName>: Name of the aggregate device (see Help below).<SrcChannels>: String of source channel numbers (e.g.12for channels 1 & 2).<DstChannels>: String of destination channel numbers (e.g.3456for channels 3, 4, 5 & 6).
./AudioPassThroughUniversal -hDisplays usage and lists available Aggregate Devices on the system.
-
Basic stereo pass-through (channels 1→3, 2→4):
./AudioPassThroughUniversal "MyAggregate" 12 34 -
Duplicate stereo to two pairs (1→3,2→4 and 1→5,2→6):
./AudioPassThroughUniversal "MyAggregate" 12 3456 -
Debug mode (enable by setting
DEBUG = truein the source and recompiling):DEBUG=true ./AudioPassThroughUniversal "MyAggregate" 12 34
A command-line utility to create an Aggregate Audio Device from two existing devices.
Usage:
./create-agg <AggDeviceName> <InputDeviceName> <OutputDeviceName><AggDeviceName>: Desired name for the new aggregate device.<InputDeviceName>: Display name of the device to use as the master (input) device.<OutputDeviceName>: Display name of the device to include as the second device.
After running, the new aggregate device will be created and ready to use.
A command-line utility to create a Multi-Output Audio Device (Stacked) from two or more existing devices.
Usage:
./create-multi <MultiDeviceName> <OutputDevice1> [OutputDevice2] [...]<MultiDeviceName>: Desired name for the new multi-output device.<OutputDevice1>,<OutputDevice2>, …: Display names of the devices to combine.
After running, the new multi-output device will be created and visible in Audio MIDI Setup as a stacked (multi-output) device.
- Open Audio MIDI Setup (macOS Utilities folder).
- Click the + button under Audio Devices and choose Create Aggregate Device.
- Add your input (e.g.
BlackHoleA) and output (e.g.External Headphones) devices. - Rename the aggregate device to your desired
<AggregateDeviceName>.
MIT License. See LICENSE for details.