Published June 28, 2022 | Version v1
Conference paper Open

Dynamic Per-Sample Processing with WebAssembly

  • 1. Worcester Polytechnic Institute

Description

While various audio libraries for the web have been compiled to WebAssembly from other languages, few have been written directly in WebAssembly itself. Writing DSP algorithms directly in WebAssembly enables precise control and opportunities for optimization that are perhaps difficult to achieve when a using a higher-level language coupled with a compiler; conversely, higher-level languages are often optimized for abstraction, readability, and speed of development. Despite the advantages higher-level languages provide, we hypothesized that writing a low-level signal processing library directly in WebAssembly is both appropriate to the capabilities of the language while also providing for finer control over optimization.
Accordingly, we ported a low-level library we had previously developed in JavaScript, genish.js, to WebAssembly. In our initial investigation we focused on entirely dynamic audio graphs with per-sample processing; our prior work also used per-sample processing but required recompilation of the audio graph after any significant changes were made. While our dynamic WebAssembly library possesses a number of notable advantages over our prior work, we ultimately decided that it is too computationally inefficient with larger audio graphs to be used for constructing higherlevel libraries and tools for music creation. Despite this, we do feel it is appropriate for specific uses, such as live coding and enabling end-user signal processing without requiring compilation. To address the performance limitations of our engine, we built a WebAssembly compiler that outputs optimized representations of larger, interconnected audio graphs. Testing shows that compiling and optimizing audio graphs created using this library yields highly performant unit generators. We believe the combination of a fully dynamic graph with precompiled higher-level signal processing functions will work well for the future construction of music creation tools.

Files

WAC_2022_paper_56.pdf

Files (200.0 kB)

Name Size Download all
md5:2a25e555e5bfcbb820466f99508329c2
200.0 kB Preview Download