A module for trainable encoder/decoder filterbanks with auditory bias.
Project description
HybrA-Filterbanks
HybrA-Filterbanks is a PyTorch package for auditory-inspired filterbanks in audio machine learning.
It includes:
ISAC: invertible and stable auditory filterbank with customizable kernelsHybrA: ISAC extended with learnable channel-wise filtersISACSpec: ISAC-based spectrogram features with temporal averagingISACCC: cepstral coefficients built on top ofISACSpec
Related papers:
- ISAC (arXiv:2505.07709)
- HybrA (arXiv:2408.17358)
Installation
pip install hybra
Quick Start
import torch
import torchaudio
from hybra import ISAC
audio, fs = torchaudio.load("your_audio.wav")
audio = audio.to(torch.float32)
if audio.shape[0] > 1:
audio = audio.mean(dim=0, keepdim=True)
fb = ISAC(
fs=fs,
L=audio.shape[-1],
kernel_size=1024,
num_channels=128,
scale="mel",
)
coeff = fb(audio)
recon = fb.decoder(coeff)
print(f"coeff shape: {tuple(coeff.shape)}")
print(f"recon shape: {tuple(recon.shape)}")
Typical Usage
HybrA with learnable filters
from hybra import HybrA
hybra = HybrA(
fs=fs,
L=audio.shape[-1],
kernel_size=1024,
learned_kernel_size=23,
num_channels=128,
tighten=True,
)
coeff = hybra(audio)
recon = hybra.decoder(coeff)
print(f"condition number: {hybra.condition_number:.3f}")
ISAC spectrogram and cepstral coefficients
from hybra import ISACCC, ISACSpec
spec = ISACSpec(
fs=fs,
L=audio.shape[-1],
num_channels=40,
power=2.0,
is_log=True,
)
cc = ISACCC(
fs=fs,
L=audio.shape[-1],
num_channels=40,
num_cc=13,
)
spec_coeff = spec(audio)
cc_coeff = cc(audio)
print(spec_coeff.shape, cc_coeff.shape)
Use in a neural network
import torch
import torch.nn as nn
from hybra import HybrA
class Model(nn.Module):
def __init__(self, fs: int, L: int):
super().__init__()
self.fb = HybrA(fs=fs, L=L, num_channels=40)
self.net = nn.Sequential(
nn.Conv1d(40, 128, kernel_size=1),
nn.ReLU(),
nn.Conv1d(128, 40, kernel_size=1),
nn.Sigmoid(),
)
def forward(self, x: torch.Tensor) -> torch.Tensor:
coeff = self.fb(x)
mask = self.net(torch.log10(torch.clamp(coeff.abs() ** 2, min=1e-8)))
return self.fb.decoder(coeff * mask)
Visualizations
ISAC frequency response:
HybrA frequency response:
Documentation
API docs: https://danedane-haider.github.io/HybrA-Filterbanks/main/
Development
Run tests from the project root:
uv run pytest
Citation
@inproceedings{haider2024holdmetight,
author = {Haider, Daniel and Perfler, Felix and Lostanlen, Vincent and Ehler, Martin and Balazs, Peter},
title = {Hold me tight: Stable encoder/decoder design for speech enhancement},
booktitle = {Annual Conference of the International Speech Communication Association (Interspeech)},
year = {2024}
}
@inproceedings{haider2025isac,
author = {Haider, Daniel and Perfler, Felix and Balazs, Peter and Hollomey, Clara and Holighaus, Nicki},
title = {{ISAC}: An Invertible and Stable Auditory Filter Bank with Customizable Kernels for ML Integration},
booktitle = {International Conference on Sampling Theory and Applications (SampTA)},
year = {2025}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hybra-2026.2.1.tar.gz.
File metadata
- Download URL: hybra-2026.2.1.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09b59cccfd2755ec606db5e1982899b138cbebf565e694aaf657620a20314bd7
|
|
| MD5 |
6b86fef40e9723e6def91bcc485a53fb
|
|
| BLAKE2b-256 |
de007df86697acbb1f742a745a53f29b6a9dc11dec0940650da38c301c8c3bbc
|
Provenance
The following attestation bundles were made for hybra-2026.2.1.tar.gz:
Publisher:
publish-to-pypi.yml on danedane-haider/HybrA-Filterbanks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hybra-2026.2.1.tar.gz -
Subject digest:
09b59cccfd2755ec606db5e1982899b138cbebf565e694aaf657620a20314bd7 - Sigstore transparency entry: 956337937
- Sigstore integration time:
-
Permalink:
danedane-haider/HybrA-Filterbanks@8d05666e488f48def3c6d93082c8d87a9e7d5019 -
Branch / Tag:
refs/tags/2026.02.1 - Owner: https://github.com/danedane-haider
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@8d05666e488f48def3c6d93082c8d87a9e7d5019 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hybra-2026.2.1-py3-none-any.whl.
File metadata
- Download URL: hybra-2026.2.1-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09d51e7762cbccfe01756c7766f17371881aa8a376b65b291792a52797b488f7
|
|
| MD5 |
9e6fb519d6aa0d13b75845655538eca4
|
|
| BLAKE2b-256 |
6a2b060c4196899b3db00a9e43045bb2f24369bf98e0ed34d71e829a0de29d63
|
Provenance
The following attestation bundles were made for hybra-2026.2.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on danedane-haider/HybrA-Filterbanks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hybra-2026.2.1-py3-none-any.whl -
Subject digest:
09d51e7762cbccfe01756c7766f17371881aa8a376b65b291792a52797b488f7 - Sigstore transparency entry: 956337939
- Sigstore integration time:
-
Permalink:
danedane-haider/HybrA-Filterbanks@8d05666e488f48def3c6d93082c8d87a9e7d5019 -
Branch / Tag:
refs/tags/2026.02.1 - Owner: https://github.com/danedane-haider
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@8d05666e488f48def3c6d93082c8d87a9e7d5019 -
Trigger Event:
push
-
Statement type: