pacmog is a decoding library for the PCM file.
Designed for use in playing the PCM file embedded in microcontroller firmware.
Rust has an includebytes! macro to embed the byte sequence in the program. Using it, PCM files can be embedded in firmware and used for playback.
pacmog works with nostd by default.
| 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 | ✅ |
bash
cargo run --example beep
Read a sample WAV file. ```Rust use pacmog::PcmReader;
let wav = includebytes!("../tests/resources/Sine440Hz1ch48000Hz16.wav");
let reader = PcmReader::new(wav);
let specs = reader.getpcmspecs();
let numsamples = specs.numsamples;
let numchannels = specs.numchannels as u32;
println!("PCM info: {:?}", specs);
for sample in 0..numsamples { for channel in 0..numchannels { let samplevalue = reader.readsample(channel, sample).unwrap(); println!("{}", sample_value); } } ```
bash
cargo test
bash
cargo criterion
pacmog works with no_std by default.
No setup is needed.