https://github.com/sebbekarlsson/akit
3D audio engine
https://github.com/sebbekarlsson/akit
3d-audio audio audio-engine binaural
Last synced: 11 months ago
JSON representation
3D audio engine
- Host: GitHub
- URL: https://github.com/sebbekarlsson/akit
- Owner: sebbekarlsson
- License: gpl-3.0
- Created: 2022-08-20T19:33:11.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-05T22:29:56.000Z (about 3 years ago)
- Last Synced: 2025-03-25T20:46:33.596Z (over 1 year ago)
- Topics: 3d-audio, audio, audio-engine, binaural
- Language: C
- Homepage:
- Size: 12.2 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Akit (Audio kit)
> 3D Audio engine for Linux
## Dependencies
> Currently, the only driver supported is `alsa`.
## Example usage
```C
#include
int main(int argc, char* argv[]) {
// setup configuration
AkitDriverConfig config = {0};
config.sample_rate = 44100;
config.frame_length = 512;
config.type = AKIT_DRIVER_TYPE_ASOUND;
// initialize engine
AkitEngine engine = {0};
akit_engine_init(&engine, (AkitEngineConfig){.driver_config = config,
.max_sounds = 10,
.normalize_stereo = true});
// update or set where listener is
akit_engine_set_listener(&engine, (AkitListener){.forward = VEC3(0, 0, 1),
.up = VEC3(0, 1, 0),
.position = VEC3(0, 0, 0)});
// start engine
akit_engine_start(&engine);
// emit sound
akit_engine_push_sound(&engine, (AkitSound){
.data = wav.data, // raw data from wav file
.length = wav.length,
.sample_rate = wav.header.sample_rate,
.position = VEC3(16.0f, 0.0f, 1.0f), // position where sound is supposed to origin
.duration = fmax(wav.duration, 0.5f),
.channels = wav.header.channels,
.block_align = wav.header.block_align,
.gain = 1.0f // gain (0 to 1)
});
// wait for engine to finish playing audio
while (akit_engine_is_playing(&engine)) {
akit_msleep(10);
}
// stop and destroy engine
akit_engine_stop(&engine);
akit_engine_destroy(&engine);
return 0;
}
```