A simple command-line tool to control audio device volume levels on macOS.
Note
This is my first project written in Zig. While I'm learning the language and trying to follow best practices, there might be some non-idiomatic code.
- List available audio devices
- Get volume levels for input/output channels
- Set volume levels for input/output channels
- Support for both scalar (0-1) and decibel values
- macOS (uses CoreAudio)
- Zig 0.13.0 or later
git clone https://github.com/wnkz/mcgain.git
cd mcgain
zig buildThe binary will be available at zig-out/bin/mcgain
mcgain lsmcgain get-levels # Show volume levels in scalar (0-1)
mcgain get-levels -d # Show volume levels in decibels
mcgain get-levels -n # Show device namesmcgain set-levels <device_id> <in|out> <value> # Set volume using scalar (0-1)
mcgain set-levels -d <device_id> <in|out> <value> # Set volume using decibels
mcgain set-levels -n "Device Name" <in|out> <value> # Set volume by device namezig build # Build the project
zig build run # Build and runThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Written in Zig
- Uses macOS CoreAudio Framework