pacmog
pacmog is a decoding library for the PCM file.
Designed for use in playing the PCM file embedded in microcontroller firmware.
Rust has an include_bytes! macro to embed the byte sequence in the program. Using it, PCM files can be embedded in firmware and used for playback.
| Format | Status |
|---|---|
| WAV 16bit | ✅ |
| WAV 24bit | ✅ |
| WAV 32bit | ✅ |
| WAV 32bit float | ✅ |
| WAV 64bit float | ✅ |
| IMA ADPCM | ✅ |
| AIFF 16bit | ✅ |
| AIFF 24bit | ✅ |
| AIFF 32bit | ✅ |
| AIFF 32bit float | ✅ |
| AIFF 64bit float | ✅ |
Example
Low-level: Read the sample at an arbitrary position
use PcmReader;
let wav = include_bytes!;
let mut input = &wav;
let reader = new?;
let specs = reader.get_pcm_specs;
let num_samples = specs.num_samples;
let num_channels = specs.num_channels;
println!;
for sample in 0..num_samples
High-level: PcmPlayer
use ;
let wav = include_bytes!;
let mut input = &wav;
let reader = new?;
let mut player = new;
let specs = player.reader.get_pcm_specs;
let num_samples = specs.num_samples;
player.set_loop_playing;
let mut buffer: = ;
let buf = buffer.as_mut_slice;
for sample in 0..num_samples
no_std
pacmog works with no_std by default.
No setup is needed.