{"id":1916,"library":"audioop-lts","title":"audioop-lts","description":"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.","status":"active","version":"0.2.2","language":"en","source_language":"en","source_url":"https://github.com/AbstractUmbra/audioop","tags":["audio","sound","signal processing","lts","python3.13"],"install":[{"cmd":"pip install audioop-lts","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Requires Python 3.13 or greater, as it ports a module removed in that version.","package":"python","optional":false}],"imports":[{"note":"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.","wrong":"from audioop_lts import audioop","symbol":"audioop","correct":"import audioop"}],"quickstart":{"code":"import audioop\n\n# Simulate a 16-bit mono audio fragment (2 bytes per sample)\n# For a real scenario, this would come from an audio file or stream\n# Example: two samples, value 1000 and -500\nfragment = b'\\xe8\\x03\\x0c\\xfe' # Little-endian for 1000 and -500 (approx)\nwidth = 2 # 2 bytes per sample (16-bit)\n\n# Calculate the RMS (Root Mean Square) of the audio fragment\nrms_value = audioop.rms(fragment, width)\nprint(f\"RMS value: {rms_value}\")\n\n# Add two fragments (requires them to be of the same length and width)\nfragment1 = b'\\x01\\x00\\x02\\x00'\nfragment2 = b'\\x05\\x00\\x06\\x00'\nsum_fragment = audioop.add(fragment1, fragment2, width)\nprint(f\"Sum fragment: {sum_fragment.hex()}\")\n\n# Convert to u-LAW encoding (8-bit output, input width still matters)\nu_law_fragment = audioop.lin2ulaw(fragment, width)\nprint(f\"u-LAW fragment: {u_law_fragment.hex()}\")","lang":"python","description":"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."},"warnings":[{"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.","message":"This 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.","severity":"breaking","affected_versions":"<3.13"},{"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`.","message":"When 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}