Crate pacmog

Source
Expand description

pacmog is a decoding library for PCM files for embedded environments.

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.

§Examples

Read a sample WAV file.

use pacmog::PcmReader;

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

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);
    }
}

Modules§

imaadpcm
IMA-ADPCM

Structs§

PcmPlayer
High level of organized players for LinearPCM (WAVE or AIFF) file.
PcmReader
Reads low level information and Data chunks from the PCM file.
PcmSpecs
Basic information on the PCM file.

Enums§

AudioFormat
Audio format
PcmPlayerError
Error type for PcmPlayer
PcmReaderError
Error type for LinearPCM