Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/archinetai/cqt-pytorch
An invertible and differentiable implementation of the Constant-Q Transform (CQT).
https://github.com/archinetai/cqt-pytorch
audio cqt deep-learning pytorch
Last synced: about 2 months ago
JSON representation
An invertible and differentiable implementation of the Constant-Q Transform (CQT).
- Host: GitHub
- URL: https://github.com/archinetai/cqt-pytorch
- Owner: archinetai
- License: mit
- Created: 2022-11-08T09:29:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-09T09:11:49.000Z (about 2 years ago)
- Last Synced: 2024-10-06T17:08:50.511Z (3 months ago)
- Topics: audio, cqt, deep-learning, pytorch
- Language: Python
- Homepage:
- Size: 1.08 MB
- Stars: 52
- Watchers: 6
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CQT - PyTorch
An invertible and differentiable implementation of the Constant-Q Transform (CQT) using Non-stationary Gabor Transform (NSGT), in PyTorch.
```bash
pip install cqt-pytorch
```
[![PyPI - Python Version](https://img.shields.io/pypi/v/cqt-pytorch?style=flat&colorA=black&colorB=black)](https://pypi.org/project/cqt-pytorch/)## Usage
```python
from cqt_pytorch import CQTtransform = CQT(
num_octaves = 8,
num_bins_per_octave = 64,
sample_rate = 48000,
block_length = 2 ** 18
)# (Random) audio waveform tensor x
x = torch.randn(1, 2, 2**18) # [1, 1, 262144] = [batch_size, channels, timesteps]
z = transform.encode(x) # [1, 2, 512, 2839] = [batch_size, channels, frequencies, time]
y = transform.decode(z) # [1, 1, 262144]
```### Example CQT Magnitude Spectrogram (z)
## TODO
* [x] Power of 2 length (with `power_of_2_length` constructor arg).
* [x] Understand why/if inverse window is necessary (it is necessary for perfect inversion).
* [x] Allow variable audio lengths by chunking (now input can be a multiple of `block_length`)## Appreciation
Special thanks to [Eloi Moliner](https://github.com/eloimoliner) for taking the time to help me understand how CQT works. Check out his own implementation with interesting features at [eloimoliner/CQT_pytorch](https://github.com/eloimoliner/CQT_pytorch).## Citations
```bibtex
@article{1210.0084,
Author = {Nicki Holighaus and Monika Dörfler and Gino Angelo Velasco and Thomas Grill},
Title = {A framework for invertible, real-time constant-Q transforms},
Year = {2012},
Eprint = {arXiv:1210.0084},
Doi = {10.1109/TASL.2012.2234114},
}
```