Expand description
A real-time audio engine for games and interactive applications.
§Quick start
use aire::{Engine, Sound, Oscillator, Waveform};
let engine = Engine::new()?;
let rate = engine.sample_rate();
let osc = Oscillator::new(Waveform::Sine, 440.0, rate).duration(2000);
let _handle = engine.add_sound(Sound::new(osc, rate))?;§Key types
Engine— opens the output device and drives the audio threadEngineConfig— optional configuration (command buffer size, etc.)Sound— wraps a source with volume, pan, and an effect chainSoundHandle— controls a playing sound from any threadGroupHandle— controls volume and pan for a named category of soundsSource— trait for anything that produces audioEffect— trait for DSP effectsFileSource— loads or streams WAV, OGG, FLAC, and MP3 filesOscillator— band-limited synthesized waveform source with six shapesAdsr— ADSR amplitude envelope with linear or exponential curvesDecodePool— background thread pool for streaming decode. Only needed when usingFileSource::stream.
Structs§
- Adsr
- An ADSR (Attack, Decay, Sustain, Release) amplitude envelope effect. Shapes the volume of a sound over time. All time values are in milliseconds, sustain amplitude is in decibels.
- Decode
Pool - A pool of background threads that incrementally decode streaming audio into ring buffers.
- Engine
- The audio engine. Opens the default output device and drives the mixer on a real-time audio thread. All communication with the audio thread is lock-free and safe to call from any thread.
- Engine
Config - Configuration for the audio engine.
- File
Source - Plays audio from a file. Use
FileSource::loadfor short sounds andFileSource::streamfor music or long ambience tracks. - Group
Handle - A handle for controlling a group of sounds by category (e.g.
"music","sfx"). Obtained fromcrate::Engine::group. All methods returnAireError::CommandBufferFullif the command queue is full. - Oscillator
- A band-limited oscillator with six waveforms.
- Sound
- A playable sound with volume, pan, and an optional effect chain.
- Sound
Handle - A handle for controlling a sound after it has been added to the engine.
Obtained from
crate::Engine::add_sound. All methods returnAireError::CommandBufferFullif the command queue is full.
Enums§
- Aire
Error - Errors returned by aire.
- Curve
- Shape of the attack and release envelope segments.
- Waveform
- The waveform shape produced by an
Oscillator.
Traits§
- Effect
- A DSP effect that processes stereo samples. Implement this to create
custom effects and add them to a
crate::Soundviacrate::Sound::add_effect. - Source
- A source of audio samples. Can be a file, a synthesized signal, or anything that produces stereo output.