Skip to main content

Simple Python audio limiter implemented in Rust (pyo3, operates on numpy array).

Project description

numpy-audio-limiter

A simple Python library for dynamic range compression of audio. Made for integration with audiomentations. Based on cylimiter (C++) by pzelasko, but has a few extras for fast delay compensation. The main motivation for porting it to Rust was that cylimiter appeared to be unmaintained and did not install well on Python 3.12 anymore. As audiomentations maintainer, I aim to keep it easy to install for relevant Python versions and operating systems, without fiddling with compilers and special environment variables. An extra bonus with this port is that it is ~30% faster than cylimiter (in the context of audiomentations).

Installation

PyPI version python 3.9, 3.10, 3.11, 3.12, 3.13 os: Linux, macOS, Windows

$ pip install numpy-audio-limiter

Code example

import numpy as np
import numpy_audio_limiter

x = np.random.randn(1800).astype(np.float32)
y = numpy_audio_limiter.limit(
    signal=x.reshape((1, -1)),
    attack_coeff=0.99,
    release_coeff=0.99,
    delay=527,
    threshold=0.5,
)
assert y.shape == (1, 1800)

Features

  • The output is aligned with the input.
  • Supports mono and multichannel audio. Mono audio is represented as a 2D-array with 1 in the first dimension.
  • Adjustable threshold, which determines the audio level above which the limiter kicks in.
  • Adjustable attack time, which denotes how quickly the limiter kicks in once the audio signal starts exceeding the threshold.
  • Adjustable release time, which determines how quickly the limiter stops working after the signal drops below the threshold.

Changelog

[0.1.0] - 2025-07-02

Initial release

For the complete changelog, go to CHANGELOG.md

Development setup

  • conda create --name numpy-audio-limiter python=3.11
  • conda activate numpy-audio-limiter
  • pip install -r dev_requirements.txt
  • maturin develop
  • pytest

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

numpy_audio_limiter-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

numpy_audio_limiter-0.1.0-cp39-abi3-win_amd64.whl (156.5 kB view details)

Uploaded CPython 3.9+Windows x86-64

numpy_audio_limiter-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl (458.7 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

numpy_audio_limiter-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl (464.5 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

numpy_audio_limiter-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (287.7 kB view details)

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

numpy_audio_limiter-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (285.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

numpy_audio_limiter-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (251.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file numpy_audio_limiter-0.1.0.tar.gz.

File metadata

  • Download URL: numpy_audio_limiter-0.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for numpy_audio_limiter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c10151cb2063ac5bc199ced326d8f0aeeaca324b3a4f23db06839ad1b3a9ce39
MD5 4e4ad78df4f3eb7a535e4f9dc42253e8
BLAKE2b-256 7c0f3d50bf466e42781e8d1a637dd78443e78779040ffbd25a1b5f685c9e5e20

See more details on using hashes here.

File details

Details for the file numpy_audio_limiter-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for numpy_audio_limiter-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a7ea1e217a92c8a39e76e5bbcd3c3033e7434163fc5cd6c38c9231d66a349bfc
MD5 34faa812d243a6f95a34d38fa8423a7d
BLAKE2b-256 2c7aea0be689a2e1184dc061d0aa8d545c0abdd32f99f572331d8bbb58d78d5a

See more details on using hashes here.

File details

Details for the file numpy_audio_limiter-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for numpy_audio_limiter-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e899a284e8b2fc316d2af3a0bcc285b5bf379b9d6a8f18fe4ce7a535608f59c9
MD5 423aec4167dfb7b72f44b7b938daea1a
BLAKE2b-256 0a8bd3cdf491fb9feef002c374fabecce47d8f636feb9c7e5f1c7c05af733ea7

See more details on using hashes here.

File details

Details for the file numpy_audio_limiter-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for numpy_audio_limiter-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 fc1451c58482ed9da41ed43827c4e68a65baffa215a970cfbca2d2719d360e3e
MD5 3b4d29f2ad987ecdc74f64699493a503
BLAKE2b-256 14cdbc8f306ea49ec8ae4a0d847d59fb26758c27a084b71ee817ba907dda3151

See more details on using hashes here.

File details

Details for the file numpy_audio_limiter-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for numpy_audio_limiter-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a9d173a29a8bf473d93ae60e24b6d643d91106abbfa7385cf7cad8d00941bd3d
MD5 3a4e9a5756587b072563be676e27bb38
BLAKE2b-256 c0f560d99334c6936b7a96437e888111754fd7da3cec77a040ada35bdbbc6cb1

See more details on using hashes here.

File details

Details for the file numpy_audio_limiter-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for numpy_audio_limiter-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f5e756e48ac5e84ca025ce34ca23258c57f717da1a81d4494864a5752ffebc4a
MD5 90749273d9287ff9f0138d6da735c260
BLAKE2b-256 17ea32b631d97c910a5b4d08da6edb82e1bae57990296b391b00ef7750baa2cc

See more details on using hashes here.

File details

Details for the file numpy_audio_limiter-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for numpy_audio_limiter-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 32a28aef27122c151b2429c1580372948546a08797839c0d05490ac21bc8a2ca
MD5 1e4decfbcb08f462fcace508ec329d7f
BLAKE2b-256 50b342f16aa658b7c88a65731c3f4224d6c2adc13533e2eb18c69bfe35cad335

See more details on using hashes here.

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