Skip to main content

Python bindings for blip25-mbe — P25 MBE/IMBE/AMBE+2 vocoder family

Project description

blip25-mbe (Python)

Python bindings for blip25-mbe, a research-grade Rust implementation of the MBE / IMBE / AMBE+2 vocoder family for P25 Phase 1 and Phase 2 pipelines.

Patents. AMBE+2 is covered by US 8,359,197 until 2028-05-20. See PATENT_NOTICE.md.

Install

pip install blip25-mbe

Wheels are published for Linux (manylinux 2_28), macOS (x86_64 + arm64), and Windows for Python 3.9+.

Quick start

import numpy as np
import blip25_mbe

# One-shot frame round-trip
vc = blip25_mbe.Vocoder(blip25_mbe.Rate.IMBE_7200X4400)
pcm_in = np.zeros(vc.frame_samples, dtype=np.int16)   # 160 samples = 20 ms
bits = vc.encode_pcm(pcm_in)                          # 18-byte FEC frame
pcm_out = vc.decode_bits(bits)                        # back to np.int16

# Streaming over arbitrary-sized chunks
enc = blip25_mbe.LiveEncoder(blip25_mbe.Rate.AMBEPLUS2_3600X2450)
for chunk in pcm_chunks:                              # any size, any rate
    for frame in enc.push(chunk):
        socket.send(frame)                            # 9 bytes each

# Wire-format bridge (Phase 1 IMBE ⇄ Phase 2 AMBE+2)
tc = blip25_mbe.Transcoder(
    blip25_mbe.Rate.IMBE_7200X4400,
    blip25_mbe.Rate.AMBEPLUS2_3600X2450,
)
out_bits = tc.transcode(in_bits)

encode_pcm accepts any np.int16 array; decode_bits returns a fresh np.int16 array. Length must match vc.frame_samples / vc.fec_frame_bytes.

Rates

Python Codec Wire size Bitrate
Rate.IMBE_7200X4400 IMBE 18 bytes 7 200 bps
Rate.IMBE_4400X4400 IMBE no-FEC 11 bytes 4 400 bps
Rate.AMBEPLUS2_3600X2450 AMBE+2 9 bytes 3 600 bps
Rate.AMBEPLUS2_2450X2450 AMBE+2 no-FEC 7 bytes 2 450 bps

Encoder tuning (blip25-mbe 0.2.0)

Vocoder exposes the upstream encode-quality and denoiser levers. The AMBE+2 production encode-quality stack (octave-escape pitch guard, parabolic sub-sample pitch, M(ξ) voicing relaxation) is on by default for AMBE+2 rates; full-rate IMBE stays bit-for-bit spec-faithful. The denoiser front-ends are opt-in (default off).

vc = blip25_mbe.Vocoder(blip25_mbe.Rate.AMBEPLUS2_3600X2450)

# Encode-quality stack (per-lever opt-out)
vc.pitch_decide_escape          # -> True   (set_pitch_decide_escape)
vc.pitch_subsample              # -> True   (set_pitch_subsample)
vc.vuv_mxi_grade                # -> True   (set_vuv_mxi_grade)
vc.pitch_refine                 # -> False  §0.4 refine bypassed by the stack
vc.set_vuv_pitch_coef(0.0)      # write-only loudness/shape levers
vc.set_level_scale(True)

# Pre-analysis denoiser front-ends (opt-in 'exceed' levers for noisy audio)
vc.set_denoise(True)                              # log-MMSE STFT denoiser
vc.set_denoise_kind(blip25_mbe.DenoiseKind.WIENER)  # or LOG_MMSE / SPEC_SUB
vc.set_hum_notch(True)                            # 60/120 Hz (US) mains notch
vc.set_hum_notch_mains(50.0)                      # 50/100 Hz (EU)

Note. As of 0.2.0, input-side spectral_subtraction defaults off (was on in 0.1.x); enable it with set_spectral_subtraction(True). The post-decode EnhancementMode.CLASSICAL chain remains on by default.

DVSI soft-decision packets

blip25_mbe.dvsi_soft_decision provides the 4-bit soft-decision (LLR) packet format for soft-FEC interchange with DVSI AMBE-2000/2020/3000 hardware: pack_channel_bits / unpack_packet, the raw USB-3000 nibble stream (pack_nibble_stream / unpack_nibble_stream), SdPacketHeader, and the verified P25 rate-control vectors.

import numpy as np
from blip25_mbe import dvsi_soft_decision as dsd

llrs = np.array(channel_soft_bits, dtype=np.int8)   # one i8 LLR per bit
header = dsd.SdPacketHeader()       # rate_info words are chip-/rate-specific
packet = dsd.pack_channel_bits(llrs, header)        # uint16[60]
wire = dsd.packet_to_bytes(packet)                  # 120 big-endian bytes

DVSI_P25_FULLRATE_FEC / DVSI_P25_FULLRATE_NOFEC are the 6-word chip -r rate-control vectors — a different framing from the packet's 5-word rate_info field; don't cross-assign them.

Building from source

pip install maturin
maturin develop --release       # editable install into current venv
pytest                          # smoke tests

Sibling packages

blip25-mbe is the vocoder wrapper. Future blip25 components (decoder / SDR layer) will ship as separate PyPI packages with their own blip25_* import names — they don't share a namespace with this one.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blip25_mbe-0.2.0.tar.gz (19.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

blip25_mbe-0.2.0-cp39-abi3-win_amd64.whl (657.6 kB view details)

Uploaded CPython 3.9+Windows x86-64

blip25_mbe-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl (808.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64

blip25_mbe-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl (661.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

blip25_mbe-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (613.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

blip25_mbe-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl (722.5 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file blip25_mbe-0.2.0.tar.gz.

File metadata

  • Download URL: blip25_mbe-0.2.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blip25_mbe-0.2.0.tar.gz
Algorithm Hash digest
SHA256 09c26339d5518b9ed3d90bd40413e116bbec2355512dc9d981b8d2a87782c9cc
MD5 fabe4c496737039f2cac213a94a04bed
BLAKE2b-256 51ddf57ff009c041030797881c1c8cdd80a3713ab3ffdda1da14fbab4b8dedb8

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.0.tar.gz:

Publisher: wheels.yml on OpenBLIP25/blip25-mbe-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blip25_mbe-0.2.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: blip25_mbe-0.2.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 657.6 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blip25_mbe-0.2.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4a4ca74b4fb1fed66ac309375523fbbf5e0674aa727a8822053a8e187db6f308
MD5 f001e18841364fb88347fa6cb792d1c7
BLAKE2b-256 b1588cee6e30b7408648f38461fb804d8062f5743944207e4d06f8d26c1de8f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.0-cp39-abi3-win_amd64.whl:

Publisher: wheels.yml on OpenBLIP25/blip25-mbe-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blip25_mbe-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blip25_mbe-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f60d9b911b423e2d7d98406aa002b9bf3fce5a37be4922b2153b23de2da7c72b
MD5 892ed8047231c8eb6d9d6140d83d005d
BLAKE2b-256 c58d10a5058f12991865456d105cb2b5542cf3915b322360ff039f38710194b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.0-cp39-abi3-manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on OpenBLIP25/blip25-mbe-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blip25_mbe-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for blip25_mbe-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a90a7e6363d3b74dd3ed094c2cef738ff7040a4258c0c24f243c63c1533ef8fd
MD5 b2123f1a699a64eba0b52ad9e03f7c00
BLAKE2b-256 c3248f570193f21a87b352aaae921a80a686b75202eee22a73bc87ccd7b9397d

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.0-cp39-abi3-manylinux_2_28_aarch64.whl:

Publisher: wheels.yml on OpenBLIP25/blip25-mbe-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blip25_mbe-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blip25_mbe-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4a8396e2f1253c0e2dea415e6d8e7dc6b2819c82e4096af2ba4836d1ffbe384
MD5 1316558994fd88ef97e6d9b1ac51cfc6
BLAKE2b-256 8d9f61dde47a2c2109acebcc719ab25ad32fe3e295387cfaeeafeb5e7838de08

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: wheels.yml on OpenBLIP25/blip25-mbe-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blip25_mbe-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for blip25_mbe-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ec7b81db46b641d2aae13644290a01be25d6a04a5cc9763a5ec139326c1ee644
MD5 32da85a814a1c74819637562cc077284
BLAKE2b-256 1ea757a98d78d4cc00f37b3908b31c41eecbc42dbf4a5ec12cd2f5f811648864

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: wheels.yml on OpenBLIP25/blip25-mbe-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page