Crates.io | law-encoder |
lib.rs | law-encoder |
version | 0.1.0 |
source | src |
created_at | 2024-02-01 19:19:27.903923 |
updated_at | 2024-02-01 19:19:27.903923 |
description | A library for encoding 16bit PCM to a-law and mu-law. |
homepage | |
repository | https://github.com/bericyb/law-encoder |
max_upload_size | |
id | 1123497 |
size | 15,176 |
⚖️️️law-encoder
👨⚖ is a Rust library for A-law and μ-law (mu-law) audio encoding. These encoding schemes are defined in ITU-T standards G.711 and are widely used in digital audio processing, particularly in telephony and audio compression.
Add law-encoder
to your Cargo.toml
:
[dependencies]
law-encoder = "0.1.0"
Here's a quick example to get you started with law-encoder
:
use law_encoder::{LawEncoder, InputFormat, OutputFormat};
let encoder = LawEncoder;
let mut output = [0; 150000];
let num_bytes_encoded = encoder
.encode(
InputFormat::BigEndian,
&audio,
OutputFormat::Mulaw,
&mut output,
)
.unwrap();
println!("Encoded {} bytes!", num_bytes_encoded);
More detailed examples in the examples directory.
Contributions are welcome! Please read our CONTRIBUTING.md for details.
This project is licensed under the MIT License - see the LICENSE file for details.
For support and inquiries, please open an issue on the GitHub repository issue tracker.