Bindings for the FAudio library, a cross-platform, open-source implementation of the XAudio APIs.
These bindings provide access to all of FAudio's powerful features:
- ๐ XAudio2 API implementation with support for submix voices and mastering
- ๐ Built-in audio processing effects (reverb, equalization, etc.)
- ๐ง Hardware-accelerated 3D audio positioning via F3DAUDIO
- ๐ Real-time audio format conversion and resampling
- ๐ Support for various audio formats (PCM, ADPCM, xWMA)
- ๐๏ธ XAPO (audio processing objects) framework for custom audio effects
- ๐จ XACT3 audio engine support for content-driven audio
- ๐ฑ Cross-platform compatibility (Windows, macOS, Linux, iOS, Android)
- ๐ฎ Designed specifically for game audio needs
- ๐น STB Vorbis integration for Ogg Vorbis decoding
import "path/to/faudio"
// Initialize FAudio
faudio_engine: ^faudio.FAudio
faudio.FAudioCreate(&faudio_engine, 0, faudio.FAUDIO_DEFAULT_PROCESSOR)
// Create a mastering voice
mastering_voice: ^faudio.FAudioMasteringVoice
faudio.FAudio_CreateMasteringVoice(
faudio_engine,
&mastering_voice,
2, // Two channels for stereo
48000, // 48kHz sample rate
0, // No special effects
nil, // Use default device ID
nil, // No effect chain
faudio.AudioCategory_GameEffects
)
// Clean up when done
faudio.FAudioVoice_DestroyVoice(mastering_voice)
faudio.FAudio_Release(faudio_engine)When using these bindings in your project:
- ๐ป On Windows: Link against
FAudio.lib - ๐ง On Linux/macOS: The library will be linked as
system:FAudio, so either have FAudio installed in your system or follow the Linux/macOS Configuration instructions below.
On Linux/macOS, if you want to use a local FAudio installation, you'll also need an SDL3 build, and after that you can follow these steps:
# Clone or git subtree the FAudio repository
git subtree add --prefix=vendor/FAudio https://github.com/FNA-XNA/FAudio.git [LATEST_TAG] --squash
# Build it (SDL3 is required, and we're using an example `vendor` directory here)
mkdir -p vendor/FAudio/build
cd ./vendor/FAudio/build
cmake .. -DSDL3_DIR=/path/to/SDL3/build
make -j$(nproc)
# Make sure the linker can find your local FAudio build
odin build [your_project] \
-extra-linker-flags:"-L/path/to/vendor/FAudio/build -Wl,-rpath,/path/to/vendor/FAudio/build"I'm sure you can do something similar in Windows, but I don't know how to do it ๐คทโโ๏ธ.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- FAudio - The amazing library these bindings are built for
- Odin Language - The programming language used for these bindings