Skip to main content

Crate sipx_audio

Crate sipx_audio 

Source
Expand description

Telephony audio primitives: G.711 (µ-law and A-law), L16, linear PCM conversion and resampling, WAV reading and writing, and Opus behind the opus feature.

Codecs are pure Rust by default. Opus lives behind the opus feature because it binds to C.

G.722 remains absent (X-26). G.722 and resampling were named in this crate’s description from the commit that scaffolded the workspace, although neither existed when X-26 removed those claims. M-43 deliberately restores only the explicit resampling claim below. The wideband slot G.722 would have filled is Opus’s (M-13), and the rest of the stack has always agreed — Codec::from_payload_type(9) returns None and an offer of G.722 alone is refused.

Resampling is now explicit and supported (M-43). PcmFormat names unsigned 8-bit or signed 16-bit mono PCM and a rate from 1 through 384,000 Hz; LinearResampler converts that stream to another stated rate without guessing either fact from a buffer. The diagnostic CLI uses this same boundary for WAV and device audio rather than maintaining a private resampler.

RFC 4733 DTMF is not here either, and never was: telephone-events are an RTP payload format rather than audio samples, and they live in sipx-rtp.

scripts/check-audio-claims.py holds the summary above, the package description and the website’s crate table to what this crate implements, so the next codec named here has to exist before the gate goes green.

§Stability

sipx is pre-1.0, so neither word below means frozen. 1.0.0 is what freezes an API, and its predicates are in docs/roadmap.md. Until then:

  • Supported — meant to be depended on. Breaking changes get a CHANGELOG.md entry saying what to do instead. New enum variants and new struct fields may still appear in a minor release, so a downstream match should carry a _ arm.
  • Experimental — may change shape or be removed without a migration note. Depend on it only if you are prepared to follow it.

Supported. G.711 and L16 both ways, linear PCM conversion/resampling, mixing and WAV. Opus is behind the off-by-default opus feature and remains Experimental at this crate boundary. sipx-call and an Opus-enabled diagnostic CLI can select it, but no default shipped application enables its native dependency. Cargo’s normalized package manifests are checked with the feature off and on, including a clean packaged CLI build and run. M-39 supplies rate-correct bidirectional CLI audio and independent-peer evidence in both SIP roles. Optional RFC 7587 fmtp controls are not implemented.

Re-exports§

pub use g711::alaw_decode;
pub use g711::alaw_encode;
pub use g711::ulaw_decode;
pub use g711::ulaw_encode;
pub use mix::mix_excluding;
pub use mix::mix_into;
pub use pcm::LinearResampler;
pub use pcm::Pcm;
pub use pcm::PcmEncoding;
pub use pcm::PcmError;
pub use pcm::PcmFormat;
pub use pcm::PcmSamples;
pub use pcm::resample_i16;
pub use wav::Wav;
pub use wav::read_wav;
pub use wav::write_wav;

Modules§

g711
G.711 µ-law and A-law (ITU-T G.711).
l16
L16 linear 16-bit RTP audio (RFC 3551 §4.5.11).
mix
Adding audio streams together.
opus
Opus (RFC 6716), behind the opus feature.
pcm
Explicit linear-PCM formats and streaming rate conversion.
wav
WAV files, for the narrow case the tests need: 8 kHz 16-bit mono PCM.