#codec #adpcm #heap-memory #encoding #a-law #u-law

no-std audio-codec-algorithms

Audio codec algorithms: A-law, μ-law and IMA ADPCM

4 releases

0.6.0 Jul 24, 2024
0.5.6 Apr 7, 2024
0.5.5 Apr 2, 2024
0.5.2 Mar 31, 2024

#253 in Audio

Download history 16/week @ 2024-07-01 111/week @ 2024-07-08 40/week @ 2024-07-15 152/week @ 2024-07-22 48/week @ 2024-07-29 37/week @ 2024-08-05 4/week @ 2024-08-12 9/week @ 2024-08-19 13/week @ 2024-08-26 23/week @ 2024-09-02 21/week @ 2024-09-09 20/week @ 2024-09-16 30/week @ 2024-09-23 4/week @ 2024-09-30 9/week @ 2024-10-07 21/week @ 2024-10-14

64 downloads per month
Used in 2 crates

MIT/Apache

55KB
884 lines

Audio Codec Algorithms

Cross-platform tests

Decoding and encoding for few basic audio codecs implemented in Rust:

Features:

  • supports no_std
  • no heap memory allocations
  • no unsafe code
  • no panicking
  • only dependencies for testing: no-panic and criterion

Running the example

Try out decoding and encoding values:

cargo run --example codec-tester decode ulaw 3 130 221
cargo run --example codec-tester encode alaw 10 -5430 3263
cargo run --example codec-tester encode adpcm_ima 25 40 60 80 100 160 220
cargo run --example codec-tester decode adpcm_ima 7 7 2 2 2 7 5

Running tests

Run:

# run the tests
cargo test
# ensure good code quality
cargo clippy
# ensure that the release build never panics
cargo test --release --features internal-no-panic

Performance testing:

cargo bench

There is a GitHub Action called "Cross-platform tests" (cross-test.yml), which automatically runs cargo test for little-endian 64-bit x64_86 and big-endian 32-bit PowerPC.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~110KB