3 releases
Uses new Rust 2024
new 0.0.3 | May 16, 2025 |
---|---|
0.0.2 | May 15, 2025 |
0.0.1 | May 14, 2025 |
#835 in Audio
45 downloads per month
Used in 2 crates
12KB
143 lines
XLaw - aLaw and μLaw PCM codecs
PCM-aLaw and PCM-MuLaw codecs.
Overview
The usage is very simple.
let alaw_encoder = PcmXLawEncoder::new_alaw();
let samples = vec![1i16, 30000i16, 500i16, -30000i16];
let mut encoded = Vec::<u8>::new();
for sample in samples {
encoded.push(alaw_encoder.encode(*sample));
}
There are also PcmXLawDecoder
, new_alaw()
, and new_ulaw()
to create them, and the encode()
and decode()
functions are just as easy as you want.
Simply, they do encode i16
samples into u8
codes, and decode u8
codes into i16
samples.
Personally, I'd prefer not to use these encoders. Just convert the WAV s16le
PCM to the u8
PCM. My supreme sound card can handle u8
playback, its DSP functions can restore the u8
sound just like you are hearing the i16
format sample audio.