https://github.com/rplstr/portaudio
Zig wrappers for PortAudio library.
https://github.com/rplstr/portaudio
audio wrapper zig
Last synced: 11 months ago
JSON representation
Zig wrappers for PortAudio library.
- Host: GitHub
- URL: https://github.com/rplstr/portaudio
- Owner: rplstr
- Created: 2025-07-07T16:23:56.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-07-07T18:01:16.000Z (12 months ago)
- Last Synced: 2025-07-07T18:50:23.686Z (12 months ago)
- Topics: audio, wrapper, zig
- Language: Zig
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# portaudio
PortAudio is a portable audio I/O library designed for cross-platform
support of audio.
[Zig](http://ziglang.org) wrapper for the [PortAudio](http://www.portaudio.com) library.
The library will be updated only for STABLE Zig releases. The current latest stable Zig version is 0.14.1 with the `minimum_zig_version` set to the same value.
## Usage
If you have Nix with flakes enabled, you can enter a development shell with all dependencies by running:
```sh
nix develop
```
This provides the correct Zig compiler and system libraries such as ALSA and JACK.
### Adding to your project
1. Add this repository as a dependency in your `build.zig.zon`.
```sh
zig fetch --save git+https://github.com/rplstr/portaudio.git
```
2. In your `build.zig`, add the dependency and link against it:
```zig
// build.zig
const exe = b.addExecutable(...);
const portaudio = b.dependency("portaudio", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("portaudio", portaudio.module("portaudio"));
exe.linkLibrary(portaudio.artifact("portaudio"));
```
## Examples
The `examples/` directory contains several examples demonstrating how to use the library.
You can build and run any of them using `zig build run-`. For example:
```sh
zig build run-devs
zig build run-sine
zig build run-record
```