https://github.com/matteospanio/torchfx
A GPU accelerated and torch based audio DSP library
https://github.com/matteospanio/torchfx
audio dsp filters gpu gpu-acceleration torch
Last synced: 24 days ago
JSON representation
A GPU accelerated and torch based audio DSP library
- Host: GitHub
- URL: https://github.com/matteospanio/torchfx
- Owner: matteospanio
- License: gpl-3.0
- Created: 2025-03-30T19:01:34.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2026-05-03T19:35:07.000Z (about 2 months ago)
- Last Synced: 2026-05-03T20:36:46.104Z (about 2 months ago)
- Topics: audio, dsp, filters, gpu, gpu-acceleration, torch
- Language: Python
- Homepage: https://matteospanio.github.io/torchfx/
- Size: 11.6 MB
- Stars: 130
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
# TorchFX
### GPU-Accelerated Audio DSP with PyTorch
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://arxiv.org/abs/2504.08624)
[](https://badge.fury.io/py/torchfx)

[](https://deepwiki.com/matteospanio/torchfx)
**[Documentation](https://matteospanio.github.io/torchfx/)** | **[Getting Started](https://matteospanio.github.io/torchfx/guides/getting-started/getting_started.html)** | **[API Reference](https://matteospanio.github.io/torchfx/api/index.html)** | **[Blog](https://matteospanio.github.io/torchfx/blog/index.html)**
---
TorchFX is a modern Python library for **high-performance digital signal processing** in audio, leveraging PyTorch and GPU acceleration. Built for researchers, engineers, and developers who need fast, flexible, and differentiable audio processing.
## β¨ Key Features
- β‘ **GPU Acceleration** - Built on PyTorch for high-performance audio processing on CUDA-enabled devices
- π **Composable Pipelines** - Chain filters with the pipe operator (`|`) for sequential processing
- β **Parallel Processing** - Combine filters with the add operator (`+`) for parallel filter combination
- π§ **PyTorch Native** - All filters are `torch.nn.Module` subclasses, enabling gradient-based optimization
- π― **Simple & Intuitive** - Clean, object-oriented API designed for ease of use
- βοΈ **Highly Extensible** - Create custom filters and effects by extending base classes
- π **Performance Optimized** - Substantial performance gains over SciPy for long and multichannel signals
## π Quick Start
### Installation
```bash
pip install torchfx
```
Or install from source:
```bash
git clone https://github.com/matteospanio/torchfx
cd torchfx
pip install -e .
```
### Basic Example
```python
import torch
from torchfx import Wave
from torchfx.filter import LoButterworth, ParametricEQ
# Load audio
wave = Wave.from_file("audio.wav")
# Create filters
lowpass = LoButterworth(cutoff=5000, order=4, fs=wave.fs)
eq = ParametricEQ(frequency=1000, q=2.0, gain=3.0, fs=wave.fs)
# Sequential processing with pipe operator (|)
processed = wave | lowpass | eq
# Parallel processing with add operator (+)
stereo_enhancer = lowpass + eq
enhanced = wave | stereo_enhancer
# Save result
processed.save("output.wav")
```
## π Documentation
- **[Full Documentation](https://matteospanio.github.io/torchfx/)** - Complete guides and API reference
- **[Getting Started](https://matteospanio.github.io/torchfx/guides/getting-started/getting_started.html)** - Installation and first steps
- **[Tutorials](https://matteospanio.github.io/torchfx/guides/tutorials/index.html)** - Practical examples and use cases
- **[API Reference](https://matteospanio.github.io/torchfx/api/index.html)** - Detailed API documentation
- **[Blog](https://matteospanio.github.io/torchfx/blog/index.html)** - Updates, releases, and insights
## π οΈ Development
- **[Contributing Guide](CONTRIBUTING.md)** - How to contribute to TorchFX
- **[Style Guide](https://matteospanio.github.io/torchfx/guides/developer/style_guide.html)** - Coding standards and conventions
- **[Roadmap](https://matteospanio.github.io/torchfx/guides/developer/roadmap.html)** - Future plans and priorities
We welcome contributions from everyone! Please read our [Contributing Guide](CONTRIBUTING.md) to get started.
## π Citation
If you use TorchFX in your research, please cite our paper:
```bibtex
@conference{Spanio2025torchfx,
author = {Spanio, Matteo and RodΓ , Antonio},
title = {TORCHFX: A MODERN APPROACH TO AUDIO DSP WITH PYTORCH AND GPU ACCELERATION},
year = {2025},
journal = {Proceedings of the International Conference on Digital Audio Effects, DAFx},
pages = {390 β 395},
url = {https://www.scopus.com/inward/record.uri?eid=2-s2.0-105028935688&partnerID=40&md5=552e54afc1a074cbd1b7e8ed4ad1c010},
type = {Conference paper},
}
```
## License
This project is licensed under the terms of the GNU General Public License v3.0. See the [LICENSE](LICENSE) file for details.
## Third-Party Acknowledgments
This project uses the following third-party libraries:
- [PyTorch](https://pytorch.org/) β BSD-style license
- [NumPy](https://numpy.org/) β BSD 3-Clause License
- [SoundFile](https://python-soundfile.readthedocs.io/) β BSD 3-Clause License
Their respective license texts are included in the `licenses/` directory.