Skip to main content

Crate melpe

Crate melpe 

Source
Expand description

§melpe-rs

Pure Rust implementation of the MELPe (Mixed Excitation Linear Prediction — enhanced) vocoder, conforming to STANAG 4591 / NATO narrowband voice coding at 600 bps.

§Quick start

use melpe::encoder::Encoder;
use melpe::decoder::Decoder;
use melpe::core_types::{SUPERFRAME_SAMPLES, SUPERFRAME_BYTES_600};

let mut enc = Encoder::new();
let mut dec = Decoder::new();

let samples = [0.0f32; SUPERFRAME_SAMPLES];
let mut bitstream = [0u8; SUPERFRAME_BYTES_600];
enc.encode(&samples, &mut bitstream);

let mut output = [0.0f32; SUPERFRAME_SAMPLES];
dec.decode(&bitstream, &mut output);

§Feature flags

  • std (default) — native f32 math, hardware-backed on x86_64
  • embedded#![no_std], routes math through libm

Modules§

bitstream
Bit-level packing and unpacking of 41-bit superframes into 6 bytes.
core_types
Constants, frame geometry, and superframe data structures.
decoder
Top-level decoder: 6 bytes → 540 samples.
encoder
Top-level encoder: 540 samples → 6 bytes.
lpc
LPC analysis: autocorrelation, Levinson-Durbin, LPC↔LSF conversion, windowing.
math
Floating-point math shim — dispatches to std or libm based on feature flags.
pitch
Pitch detection via normalized autocorrelation with parabolic interpolation.
quantize
Scalar quantization of LSFs, pitch, gain, and voicing for 600 bps superframes.
synthesis
All-pole synthesis filter, de-emphasis, and frame-level synthesis processor.
voicing
5-band bandpass voicing analysis and mixed excitation generation.