How heroeslament/melpe-rs works
melpe-rs is a fixed-size, 600 bps MELPe speech codec. Its main workflow encodes 540 audio samples into a six-byte superframe, then decodes that superframe back into audio. Encoding analyzes frames and packs quantized parameters; decoding unpacks and dequantizes them before excitation generation and synthesis. The graph follows the README’s documented stages and sampled module references; unsampled implementation details are not expanded.
Main entry points: encoder.rs Encoder · decoder.rs Decoder · math.rs Math shim · bitstream.rs Bitstream codec
Components 14
Speech Analysis
- LPC / LSF
src/lpc.rs - Pitch detection
src/pitch.rs - Voicing analysis
src/voicing.rs - Math shim
src/math.rs
Parameters & Bitstream
- Quantization
src/quantize.rs - Bitstream codec
src/bitstream.rs - Codec parameters
src/core_types.rs
Speech Synthesis
- Mixed excitation
src/voicing.rs - Filter & de-emphasis
src/synthesis.rs
Other components
- Audio input
- Audio output
- libm
Connections 23
- Audio input → Encoder: provides samples
README.md - Encoder → LPC / LSF: analyzes spectrum
src/encoder.rs - Encoder → Pitch detection: estimates pitch
src/encoder.rs - Encoder → Voicing analysis: analyzes voicing
src/encoder.rs - Encoder → Quantization: quantizes parameters
src/encoder.rs - Encoder → Bitstream codec: packs parameters
src/encoder.rs - Encoder → Codec parameters: uses frame types
src/encoder.rs - Encoder → Bitstream codec: emits six bytes
README.md - Bitstream codec → Decoder: provides six bytes
README.md - Decoder → Bitstream codec: unpacks parameters
README.md - Decoder → Quantization: dequantizes parameters
src/decoder.rs - Decoder → Mixed excitation: generates excitation
README.md - Decoder → Filter & de-emphasis: synthesizes frames
src/decoder.rs - Decoder → Codec parameters: uses frame types
src/decoder.rs - Decoder → Audio output: returns samples
README.md - Mixed excitation → Voicing analysis: uses voicing methods
README.md - Filter & de-emphasis → LPC / LSF: uses LPC conversion
src/synthesis.rs - LPC / LSF → Math shim: uses math functions
src/lpc.rs - Pitch detection → Math shim: uses math functions
src/pitch.rs - Voicing analysis → Math shim: uses math functions
src/voicing.rs - Quantization → Math shim: uses math functions
src/quantize.rs - Filter & de-emphasis → Math shim: uses math functions
src/synthesis.rs - Math shim → libm: dispatches in embedded builds
src/math.rs