# XLaw - aLaw and μLaw PCM codecs
PCM-aLaw and PCM-MuLaw codecs.
## Overview
The usage is very simple.
```rust
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.