Skip to main content

A GPU accelerated library for audio DSP based on PyTorch

Project description

TorchFX

GPU-Accelerated Audio DSP with PyTorch

License: GPL v3 arXiv PyPI version PyPI - Status Ask DeepWiki

Documentation | Getting Started | API Reference | Blog


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

pip install torchfx

Or install from source:

git clone https://github.com/matteospanio/torchfx
cd torchfx
pip install -e .

Basic Example

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

🛠️ Development

We welcome contributions from everyone! Please read our Contributing Guide to get started.

📖 Citation

If you use TorchFX in your research, please cite our paper:

@misc{spanio2025torchfxmodernapproachaudio,
  title={TorchFX: A modern approach to Audio DSP with PyTorch and GPU acceleration},
  author={Matteo Spanio and Antonio Rodà},
  year={2025},
  eprint={2504.08624},
  archivePrefix={arXiv},
  primaryClass={eess.AS},
  url={https://arxiv.org/abs/2504.08624},
}

License

This project is licensed under the terms of the GNU General Public License v3.0. See the LICENSE file for details.

Third-Party Acknowledgments

This project uses the following third-party libraries:

Their respective license texts are included in the licenses/ directory.

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

torchfx-0.5.0.tar.gz (564.9 kB view details)

Uploaded Source

Built Distribution

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

torchfx-0.5.0-py3-none-any.whl (149.6 kB view details)

Uploaded Python 3

File details

Details for the file torchfx-0.5.0.tar.gz.

File metadata

  • Download URL: torchfx-0.5.0.tar.gz
  • Upload date:
  • Size: 564.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for torchfx-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2aa19e1fffa1da4c6e8c79a4241e77a68f8d054fd59b1f17bfb32ce07fe58e6d
MD5 fd8f91e4f9e9ac2f18438b1f6686162b
BLAKE2b-256 00a24fb23db7d6afbc1ff019f1770e23b9b3e3bd113f6a84b3c990947f0003b7

See more details on using hashes here.

File details

Details for the file torchfx-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: torchfx-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 149.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for torchfx-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 069446f7e8b5da393733f38b02113d2c3c7c8a91d034da4562b4d745bf71c9f8
MD5 787c8225eaa8423f11f5b0ea44aede79
BLAKE2b-256 baf724b0c339b490369dd03fde1016acea3e6d2fa8cef3c9d090186c448ce6d6

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