Expand description
§Audio Codec Implementations
This module contains G.711 audio codec implementation for VoIP applications.
§Available Codecs
§G.711 (PCMU/PCMA) - g711
- Standard: ITU-T G.711
- Sample Rate: 8 kHz
- Bitrate: 64 kbps
- Quality: ~37 dB SNR
- Use Case: Standard telephony
- Variants: μ-law (PCMU), A-law (PCMA)
§Testing
G.711 is validated with real speech samples through WAV roundtrip tests:
- Downloads reference audio samples
- Round-trip encoding and decoding validation
- Signal-to-Noise Ratio (SNR) measurement
§Usage Examples
§Using the Codec Factory
use codec_core::codecs::CodecFactory;
use codec_core::types::{CodecConfig, CodecType, SampleRate};
// Create any codec through the factory
let config = CodecConfig::new(CodecType::G711Pcmu)
.with_sample_rate(SampleRate::Rate8000);
let mut codec = CodecFactory::create(config)?;
// Use unified interface
let samples = vec![0i16; 160];
let encoded = codec.encode(&samples)?;
let decoded = codec.decode(&encoded)?;§Direct Codec Access
use codec_core::codecs::g711::{G711Codec, G711Variant};
// Direct instantiation
let mut g711_ulaw = G711Codec::new(G711Variant::MuLaw);
let mut g711_alaw = G711Codec::new(G711Variant::ALaw);§Testing & Validation
All codecs include comprehensive test suites:
- ITU-T compliance validation
- Real audio roundtrip tests
- Performance benchmarks
- Quality measurements (SNR)
# Test all codecs
cargo test
# Test with real audio (downloads speech samples)
cargo test wav_roundtrip_test -- --nocaptureModules§
- g711
- G.711 Audio Codec Implementation
Structs§
- Codec
Capabilities - Codec capability information
- Codec
Factory - Codec factory for creating codec instances
- Codec
Registry - Codec registry for managing multiple codec instances