Registry / data / audioop-lts

audioop-lts

JSON →
library0.2.2pypypi✓ verified 24d ago

audioop-lts is an LTS (Long Term Support) port of Python's built-in `audioop` module, which was deprecated in Python 3.11 and completely removed in Python 3.13. This project aims to maintain the functionality of the `audioop` module for future Python versions, specifically targeting Python 3.13 and greater. It provides operations for manipulating raw audio data, such as adding, averaging, and calculating RMS of sound fragments. The current version is 0.2.2. The library sees releases as needed for maintenance and compatibility with newer Python versions, indicating active maintenance rather than a strict release cadence.

pip install audioop-lts
INSTALL
IMPORT
SIG · AUDIOOP-LTS
A
audioop-lts
datapythonv0.2.2
Install
1.5s avg
Import
Disk
12MB
Pass rate
2/ 10
Env Coverage2 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✕ build_error
✕ build_error
py 3.12
✕ build_error
✕ build_error
py 3.13
✓ —
✓ 1.5s
py 3.9
✕ build_error
✕ build_error
12MB installed
● package 12MB
Code
Verified usage

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

audioop
import audioop
from audioop_lts import audioop
The library is designed to replace the built-in module, so it should be imported directly as 'audioop'. The package name 'audioop-lts' is for installation, not import.

This quickstart demonstrates basic operations using the `audioop-lts` library, which directly replaces the functionality of the removed `audioop` built-in module. It simulates a raw audio fragment and performs RMS calculation, fragment addition, and conversion to u-LAW encoding. Ensure your Python environment is 3.13 or newer.

import audioop # Simulate a 16-bit mono audio fragment (2 bytes per sample) # For a real scenario, this would come from an audio file or stream # Example: two samples, value 1000 and -500 fragment = b'\xe8\x03\x0c\xfe' # Little-endian for 1000 and -500 (approx) width = 2 # 2 bytes per sample (16-bit) # Calculate the RMS (Root Mean Square) of the audio fragment rms_value = audioop.rms(fragment, width) print(f"RMS value: {rms_value}") # Add two fragments (requires them to be of the same length and width) fragment1 = b'\x01\x00\x02\x00' fragment2 = b'\x05\x00\x06\x00' sum_fragment = audioop.add(fragment1, fragment2, width) print(f"Sum fragment: {sum_fragment.hex()}") # Convert to u-LAW encoding (8-bit output, input width still matters) u_law_fragment = audioop.lin2ulaw(fragment, width) print(f"u-LAW fragment: {u_law_fragment.hex()}")
Debug
Known issues
breakingThis library is designed for Python 3.13 and newer. Attempting to install or use `audioop-lts` on Python versions older than 3.13 will result in dependency resolution failures or runtime errors, as the original `audioop` module was only removed in Python 3.13.
fix
Ensure your project's `requires_python` is set to `>=3.13` and that your development and deployment environments use Python 3.13 or a newer compatible version. For older Python versions, the original built-in `audioop` module would be available (up to 3.10) or alternatives like `pydub` might be used.
affects: <3.13
gotchaWhen working with `audioop` functions, ensure that the `width` parameter (sample width in bytes) correctly matches the actual sample size of your audio data. Incorrect `width` values can lead to `audioop.error` exceptions or corrupted audio manipulation results. Typical widths are 1, 2, 3, or 4 bytes for 8, 16, 24, or 32-bit samples, respectively.
fix
Always verify the sample width of your audio fragments and pass the corresponding byte-width to `audioop` functions. For example, 16-bit audio uses `width=2`.
affects: All versions
Upgrade
Version history
0.2.2latest on PyPI · released Aug 5, 2025
Audit
Dependencies
pythonrequiredRequires Python 3.13 or greater, as it ports a module removed in that version.
Agent activity
70 hits · last 30 days
node
62
OpenAI (training)
1
Resources
audioop-lts — pip install audioop-lts · libregistry