Python Glossary Русский

all Python 3until 3.13Removed from the standard libraryterm

audioop

removed modules

Operations on raw audio samples: volume, mixing, codecs. Removed in Python 3.13 with no stdlib replacement — use the audioop-lts package.

Syntax

import audioop  # до 3.13

audioop treated audio bytes as an array of samples: max() and rms() measured loudness, mul() and add() changed volume and mixed tracks, lin2ulaw() and ratecv() converted encodings. PEP 594 dropped it as a barely maintained C module. There is no stdlib replacement. Simple cases are ported with array: array('h', data) turns 16-bit audio into numbers, and max(map(abs, samples)) replaces audioop.max(data, 2). For real processing use numpy or pydub. The audioop-lts package on PyPI brings the whole module back; pydub depends on it on 3.13.

Examples

# Python 3.13+
try:
    import audioop
except ModuleNotFoundError as e:
    print(type(e).__name__)  # → ModuleNotFoundError
# Python 3.13+
from array import array
data = array('h', [100, -3000, 250]).tobytes()
samples = array('h', data)
print(max(map(abs, samples)))  # → 3000
import audioop
from array import array
data = array('h', [100, -3000, 250]).tobytes()
print(audioop.max(data, 2))  # → 3000

See also

Common errors

Open in the full glossarydocs.python.orgReport an inaccuracy