2 releases
Uses new Rust 2024
| 0.1.1 | Mar 15, 2026 |
|---|---|
| 0.1.0 | Mar 15, 2026 |
#440 in Audio
48KB
579 lines
Handling Multi-Channel Audio Signals in Rust
Don't define containers,
define interfaces.
—Irish proverb
Nomenclature
TODO: "frame", "sample"
The term "planar" seems to originate from FFMPEG (which also seems to use the term "packed"). It is also used in Web Audio.
Potential Alternatives
In alphabetical order. Comments might be outdated (see version numbers in links).
- audio,
formerly known as rotary
- "dynamic", "interleaved", "sequential"
- traits:
Buf,BufMut, ...
- audioadapter and
audioadapter-buffers
- "interleaved", "sequential"
- audio-blocks
- "planar", "sequential", "interleaved", "mono"
- traits:
AudioBlock,AudioBlockMut,Sample
- audio_buffer_interface
- audio-channel-buffer
- not a lot of documentation, how are those buffers supposed to be passed around?
- audiochannelutils
- free functions FTW!
- a lot of
Vecs in API - trait
SampleType
- audio_samples
sample_rate: NonZeroU32Interleaved,NonInterleavedChannelIterator- good documentation, but feature creep, many dependencies
- dasp,
formerly known as sample
- no block-wise processing, only frame-wise?
Existing APIs
It might be interesting to look at existing APIs to see which terms they use, which data types etc.
- CPAL
- traits:
Sample, ... - input/output streams with callbacks taking
&[T]and&mut [T] - types:
pub type ChannelCount = u16; pub type FrameCount = u32; pub type SampleRate = u32; pub enum BufferSize { Default, Fixed(FrameCount), } - parameter names:
channels: ChannelCount sample_rate: SampleRate buffer_size: BufferSize
- traits:
Dependencies
~0–500KB