[−][src]Crate fon
Rust audio types and conversions.
An audio buffer can be cheaply converted to and from raw samples (i8, i16, f32, and f64) buffers, enabling interoperability with other crates.
Many audio formats are supported:
Blending operations are supported for all formats.
Getting Started
To understand some of the concepts used in this library, this MDN article is a good read (although the stuff about compression isn't relevant to this crate's functionality). This crate uses the MDN definitions for what an audio frame and audio channel are.
8-Bit Sawtooth Wave Example
use fon::chan::Ch8; use fon::mono::Mono8; use fon::stereo::Stereo16; use fon::{Audio, Frame}; let mut a = Audio::<Mono8>::with_silence(44_100, 256); for (i, s) in a.iter_mut().enumerate() { s.channels_mut()[0] = Ch8::new(i as i8); } // Convert to stereo 16-Bit 48_000 KHz audio format let audio = Audio::<Stereo16>::with_stream(48_000, &a);
Modules
chan | Audio channels (left, right, etc. samples that make up each audio
|
mono | Mono speaker configuration and types. |
ops | Audio mixing operations. |
stereo | Stereo speaker configuration and types. |
surround | Surround Sound 5.1 speaker configuration and types. |
Structs
Audio | Audio buffer (array of audio |
Resampler | Context for an audio resampler. |
Traits
Frame | Frame - A number of interleaved sample channels. |
Sink | Audio sink - a type that consumes audio samples. |
Stream | Audio stream - a type that generates audio samples. |