Convolution Reverb
A Python package for applying convolution reverb to audio files using PyTorch. This package provides an efficient implementation of convolution reverb using FFT-based convolution.
Installation
Install the package using pip:
pip install convolution-reverb
Requirements
- Python >= 3.8
- PyTorch >= 2.0.0
- torchaudio >= 2.0.0
See requirements.txt.
Usage
Basic Usage
from convolution_reverb import apply_reverb
import torchaudio
# Load audio files
audio_path = "path/to/your/audio.wav"
ir_path = "path/to/your/impulse_response.wav"
output_path = "output.wav"
# Apply reverb
original, convolved, sample_rate = apply_reverb(
audio_path=audio_path,
ir_path=ir_path,
output_path=output_path,
)
Working with Tensors Directly
If you're already working with audio tensors in PyTorch:
import torch
import torchaudio
from convolution_reverb import apply_reverb
# Load a sample audio, impulse response
audio_wav, audio_wav_sr = torchaudio.load("path/to/your/audio.wav")
ir_tensor, ir_sr = torchaudio.load("path/to/your/impulse_response.wav")
# Apply reverb
original, convolved, sr = apply_reverb(
audio_wav=audio_tensor,
audio_wav_sr=audio_wav_sr,
ir_wav=ir_tensor,
ir_wav_sr=ir_sr,
output_path=output_path,
)
API Reference
apply_reverb
apply_reverb(
audio_path: Union[str, None] = None,
audio_wav: Union[torch.Tensor, None] = None,
audio_wav_sr: Union[int, None] = None,
ir_path: Union[str, None] = None,
ir_wav: Union[torch.Tensor, None] = None,
ir_wav_sr: Union[int, None] = None,
output_path: Union[str, None] = None,
use_partitioned: bool = True,
block_size: Optional[int] = None,
normalize: bool = False
) -> Tuple[torch.Tensor, torch.Tensor, int]
Parameters:
audio_path: Path to the input audio fileaudio_wav: Input audio as a torch.Tensor (n_channels, n_samples)audio_wav_sr: Sampling rate of the input audio tensorir_path: Path to the impulse response fileir_wav: Impulse response as a torch.Tensor (n_channels, n_samples)ir_wav_sr: Sampling rate of the impulse response tensoroutput_path: Path where the output audio will be saveduse_partitioned: If True, uses partitioned convolution (overlap‑add) to avoid potential numerical precision issues with large FFT blocks. Recommended for long audio signals.block_size: Block size (in samples) for partitioned convolution. If not provided and use_partitioned is True, defaults to 10 seconds of audio.normalize: Whether to normalize the output audio
Returns:
- Tuple containing:
- Original audio waveform (torch.Tensor)
- Convolved audio waveform (torch.Tensor)
- Sample rate (int)
Metadata
Release files for convolution-reverb 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| convolution_reverb-0.1.6.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| convolution_reverb-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.4 kB
Release files / convolution_reverb-0.1.6.tar.gz
| Download URL | convolution_reverb-0.1.6.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9ebeefebdd4ea37e48575b716359576bfa4b48a9a0e985a08ef6cf4518edede
|
|
BLAKE2b-256 checksum How to use checksums |
1181d2b1864763775677a992e111a7ce654238356a7a7085a9c7b64c81fb2e69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Release files / convolution_reverb-0.1.6-py3-none-any.whl
| Download URL | convolution_reverb-0.1.6-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e773370edf3b1425351a1e517cd9579c41c114f2b543aff7c53db4ea4b74268
|
|
BLAKE2b-256 checksum How to use checksums |
4ab0829e2db622dcfed4b7530189ca5eb980fe197bbb80371ec0697053d29e80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|