5 unstable releases

0.5.0 Nov 7, 2024
0.4.2 Aug 9, 2024
0.4.1 Mar 30, 2023
0.4.0 Jan 30, 2023
0.3.1 Jan 18, 2023

#160 in Audio

Download history 12/week @ 2024-08-12 1/week @ 2024-08-19 3/week @ 2024-08-26 58/week @ 2024-09-09 21/week @ 2024-09-16 18/week @ 2024-09-23 44/week @ 2024-09-30 32/week @ 2024-10-07 24/week @ 2024-10-14 16/week @ 2024-10-21 3/week @ 2024-10-28 121/week @ 2024-11-04 19/week @ 2024-11-11 62/week @ 2024-11-18 8/week @ 2024-11-25

210 downloads per month

MIT/Apache

53KB
1K SLoC

pacmog

Cargo
Documentation
Tests

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.
pacmog works with no_std 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

Example

cargo run --example beep

Read a sample WAV file.

use pacmog::PcmReader;

let wav = include_bytes!("../tests/resources/Sine440Hz_1ch_48000Hz_16.wav");                        
let reader = PcmReader::new(wav);
let specs = reader.get_pcm_specs();
let num_samples = specs.num_samples;
let num_channels = specs.num_channels as u32;

println!("PCM info: {:?}", specs);

for sample in 0..num_samples {
    for channel in 0..num_channels {
        let sample_value = reader.read_sample(channel, sample).unwrap();
        println!("{}", sample_value);
    }
}

Test

cargo test

Benchmark

cargo criterion

no_std

pacmog works with no_std by default.
No setup is needed.

Dependencies

~4.5MB
~91K SLoC