TorchFX: A Modern Approach to Audio DSP with PyTorch and GPU Acceleration
2025
Read TorchFX: A Modern Approach to Audio DSP with PyTorch and GPU Acceleration (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-08624.txt.
Introduction
Matteo Spanio and Antonio Roda present TorchFX, a software library for audio work, in a twenty twenty-five paper. Audio signal processing today faces heavy real-time demands, and classic libraries do not use graphics chips well. They also blend poorly with AI models.
TorchFX is built on PyTorch, so it runs on GPUs and sits well beside AI code. It offers filters of both main kinds, FIR and IIR, with a focus on multi-channel audio. A pipe operator lets users chain filters in a clean way. Benchmarks show clear speed gains over SciPy, above all with many channels. The library is free on GitHub for others to use and extend.
Catalog record
| YEAR | 2025 |
|---|---|
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 24 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2504-08624
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
TorchFX: A Modern Approach to Audio DSP with PyTorch and GPU Acceleration Abstract The burgeoning complexity and real-time processing demands of audio signals necessitate optimized algorithms that harness the computational prowess of Graphics Processing Units (GPUs). Existing Digital Signal Processing (DSP) libraries often fall short in delivering the requisite efficiency and flexibility, particularly in integrating Artificial Intelligence (AI) models. In response, we introduce TorchFX: a GPU-accelerated Python library for DSP, specifically engineered to facilitate sophisticated audio signal processing. Built atop the PyTorch framework, TorchFX offers an Object-Oriented interface that emulates the usability of torchaudio, enhancing functionality with a novel pipe operator for intuitive filter chaining. This library provides a comprehensive suite of Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) filters, with a focus on multichannel audio files, thus facilitating the integration of DSP and AI-based approaches. Our benchmarking results demonstrate significant efficiency gains over traditional libraries like SciPy, particularly in multichannel contexts. Despite current limitations in GPU compatibility, ongoing developments promise broader support and real-time processing capabilities. TorchFX aims to become a useful tool for the community, contributing to innovation and progress in DSP with GPU acceleration. TorchFX is publicly available on GitHub at https://github.com/matteospanio/torchfx . 1 Introduction As the applications of DSP to fields such as telecommunications, multimedia, and artificial intelligence (AI) become more complex and the demand for real-time processing intensifies, the necessity for optimized algorithms that harness the computational prowess of Graphics Processing Units (GPUs) becomes paramount. Despite the strides made in GPU technology, existing DSP libraries frequently fall short in delivering the requisite efficiency and flexibility demanded by contemporary applications. These libraries, while operational, often possess design constraints that impede the full exploitation of GPU capabilities [ 1 , 2 ] . Moreover, the integration of AI models into DSP workflows necessitates a seamless and intuitive interface capable of accommodating the complexities inherent in both domains. The absence of such a library creates a void within the ecosystem, compelling researchers and practitioners to navigate cumbersome interfaces or develop bespoke solutions that may not fully leverage GPU acceleration when developing complex AI systems. In response to this critical need, we present TorchFX, an innovative Python library constructed atop the PyTorch framework, specifically engineered to facilitate GPU-accelerated DSP for audio signals. This library is designed to provide an Object-Oriented interface that emulates the usability of torchaudio, ensuring compatibility while enhancing functionality. By prioritizing user experience, TorchFX incorporates operator overloading, enabling the intuitive chaining of filters through the use of the bitwise OR (|) operator. This design choice not only simplifies the construction of complex audio processing pipelines but also aligns with the burgeoning trend of modularity in software design, as exemplified by frameworks like Langchain [ 3 ] in natural language processing (NLP). TorchFX offers a comprehensive suite of filters, including both Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) filters, to address the diverse requirements of audio manipulation, with a particular focus on multichannel audio files. This capability is indispensable in today’s multimedia environment, where audio content frequently spans multiple channels and necessitates precise processing to achieve the desired output. By bridging the gap between DSP and AI, TorchFX aims to empower researchers and developers by facilitating the implementation of advanced audio processing techniques. The structure of this paper is organized to provide an understanding of TorchFX and its contributions to the DSP landscape. Section 2 presents a comprehensive survey of the background, highlighting the evolution of GPU-accelerated libraries and existing DSP solutions. In Section 3 , we delve into the design principles and core features of TorchFX, elucidating how it addresses the limitations of current libraries. Section 4 provides a thorough evaluation of the library, demonstrating the efficiency of TorchFX and showcasing its capabilities through real-world examples. Finally, Section 5 concludes the paper by summarizing our findings and outlining potential directions for future research and development. 2 Background and related works In the realm of Digital Signal Processing (DSP) for audio, the introduction of a new tool into the already diverse landscape of Python libraries presents both challenges and opportunities. Existing solutions, while varied, often fail to comprehensively address all potential use cases, particularly in terms of functionality and tool design. To elucidate the current state of the art and identify gaps, we conducted a literature review focusing on Python libraries for audio DSP. The primary aim of this review was to assess the landscape of available tools and their capabilities, particularly concerning GPU acceleration, which is increasingly important for handling complex audio processing tasks. The research questions guiding our investigation were meticulously crafted to provide a comprehensive understanding of the current offerings: • How many GPU-accelerated libraries have been released for Python? • What functionalities do these libraries offer? • How is their interface designed? Figure 1: Scientific Literature on DSP Software (2008—2024) To address these questions, we utilized the Scopus search engine to perform a systematic literature review. The inclusion criteria were defined using the search query: TITLE-ABS-KEY ( ( ( signal AND processing ) OR dsp ) AND ( library OR package OR software ) AND ( audio OR sound OR music ) ) AND PUBYEAR > 2007 AND PUBYEAR < 2025. The starting point of 2008 was chosen to coincide with the first stable release of Python 3.0, marking a significant evolution in Python’s capabilities, while 2025 was excluded as it is yet to conclude. The inclusion of terms such as “library,” “package,” and “software” was strategic, ensuring a focus on software tool implementations and excluding generic DSP processes without a designated interface for further development by other programmers. Our search yielded 2431 papers on digital signal processing libraries for audio published between 2008 and 2024. Of these, 119 were available in Python, with only 10 primarily focusing on GPU acceleration [ 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 ] . This indicates a relatively limited focus on leveraging GPU capabilities within the Python DSP community. Subsequently, we refined our selection by excluding articles not directly related to audio DSP or the specific development of libraries, whether GPU or CPU-based. The final selection comprised papers associated with the most widely used libraries in the audio domain, as summarized in Table 1 . The table provides a detailed overview of the libraries, their associated papers and authors, and key characteristics such as GPU acceleration, the level of the API (high or low), the availability of explicit filter implementations, and the capability for signal analysis. Table 1: Overview and Features of Major Audio Libraries. Authors Paper Library Filters API Signal Analysis GPU Cheuk et al. [ 7 ] nnAudio no low-level no yes Yang et al. [ 5 , 12 ] torchaudio yes low-level yes yes McFee et al. [ 13 ] librosa no low-level yes no Virtanen et al. [ 1 ] scipy yes high-level yes no The analysis of this survey reveals a notable lack of interest within the scientific community in releasing efficient libraries for signal processing, with a tendency to develop ad-hoc solutions that are not adequately shared or valorized. Considering the substantial body of research related to DSP, it would be prudent to systematically collect and share such