Registry / analytics / g711
library1.6.5pypypiunverified

A small library for A-Law and mu-Law audio coding (G.711 standard). Current version 1.6.5, updated on PyPI. Maintained sporadically.

pip install g711
INSTALL
IMPORT
SIG · G711
G
g711
analyticspythonv1.6.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

alaw2linear
from g711 import alaw2linear
import g711; g711.alaw2linear(...)
Module-level function; no class wrapper.
ulaw2linear
from g711 import ulaw2linear
from g711 import ulaw; g711.ulaw.ulaw2linear(...)
No submodules; functions are flat.
G711Exception
from g711 import G711Exception
import g711.exceptions
Exception class is top-level, not in a submodule.

Encode and decode 16-bit linear PCM samples to/from 8-bit G.711 A-Law/u-Law bytes.

from g711 import alaw2linear, linear2alaw, ulaw2linear, linear2ulaw # u-Law encode/decode sample_linear = 1234 ulaw_byte = linear2ulaw(sample_linear) # returns int 0-255 restored = ulaw2linear(ulaw_byte) # A-Law encode/decode alaw_byte = linear2alaw(sample_linear) restored_alaw = alaw2linear(alaw_byte) print(f"u-Law: {ulaw_byte} -> {restored}") print(f"A-Law: {alaw_byte} -> {restored_alaw}")
Debug
Known issues
gotchaFunctions expect 16-bit signed integer input (-32768 to 32767). Out-of-range values may produce undefined behavior or silently wrap.
fix
Always clamp your input to the valid range before passing to linear2alaw/linear2ulaw.
affects: all
gotchaThe library returns integer values (0-255) for encoded bytes, not bytes objects. To write to a file, you must pack them with struct.pack or bytes().
fix
Use `encoded_bytes = bytes([linear2ulaw(sample) for sample in samples])` to write as raw bytes.
affects: all
deprecatedNo official deprecations. Older versions (pre-1.6) had different function names (e.g., ulaw_encode instead of linear2ulaw).
fix
Use current function names: linear2ulaw, ulaw2linear, linear2alaw, alaw2linear.
affects: <1.6.0
Upgrade
Version history
1.6.5latest on PyPI · released Mar 8, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
g711 — pip install g711 · libregistry