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

AMBEPLUS2_2450X2450 byte order. The 7-byte no-FEC frame packs the 49 info bits in DVSI r34 column-interleave order (byte-exact with DVSI's chip rate-index 34 no-FEC stream), not naive MSB-first sequential. Consumers expecting natural / "AMBE_d" order (mbelib, IDAS/NXDN over-the-air) must de-interleave first.

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.1.tar.gz (19.7 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.1-cp39-abi3-win_amd64.whl (658.4 kB view details)

Uploaded CPython 3.9+Windows x86-64

blip25_mbe-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl (809.9 kB view details)

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

blip25_mbe-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl (662.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

blip25_mbe-0.2.1-cp39-abi3-macosx_11_0_arm64.whl (614.5 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

blip25_mbe-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl (723.0 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: blip25_mbe-0.2.1.tar.gz
  • Upload date:
  • Size: 19.7 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.1.tar.gz
Algorithm Hash digest
SHA256 4b25de4d9419d10583dea6803f72a70bb6b9a7feb86902c8eb52cdab2744e6c3
MD5 0ada162f3b3d84dcd6b82e21d71d0c45
BLAKE2b-256 617d25b5b85f4206d8338afc8c01e2f8f36940d9f38b49c3d312538935a62323

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.1.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.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: blip25_mbe-0.2.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 658.4 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.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 78412d22206213a4e0fa65367bd60c60d5e4fe955ae8b435e14b977bd55b0c26
MD5 4f3ead1d611b51d1d9af8cccd6f2bfe3
BLAKE2b-256 f233b55b85847ba96f5d32abc01ba43678b0309971b00bf2b9f922bfa3387c16

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.1-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.1-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for blip25_mbe-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a9f1fe48255224ec329cb29c5620a05c84be51385fbafc0ba4cbbd167233a4ca
MD5 67a0ee52d6d12f7c30ce6778a939b61f
BLAKE2b-256 434427565e6a819f4897a5c5bdec5016b65a220574f8993c6fb10b4f0a5799c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.1-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.1-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for blip25_mbe-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ed972f8cccd94ae8d3a0bb29975b21f79646769d3e3b194bc635fc0fae107c3d
MD5 d1efe21739163d435b1632588c666740
BLAKE2b-256 cb9b5124bcb052851a50ee603699ee667fc22e0c50e82edede1dc5855feb6f1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.1-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.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blip25_mbe-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8044053f00da700ccdadf687d12dd3c0cb239e036b6cec6ada0bfd7b2770c26b
MD5 f4f86943294ecc6c82be3e1b06fb3892
BLAKE2b-256 57aa9c223e7bc79a9d578a86ae028a33f70905b0e09a73ce788e68c380cb03eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.1-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.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for blip25_mbe-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d84aef20e57b264a0be92f264b1a21ec30b5b881b5bca0fa39b0ff30db7dc562
MD5 4e0551caf82e80818141229ce25fee93
BLAKE2b-256 beaef5d5fbe6176c12d0efb51f53c80a40966e6e19d5bd351e1524a46b863a47

See more details on using hashes here.

Provenance

The following attestation bundles were made for blip25_mbe-0.2.1-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