Essentia.js: A JavaScript Library for Music and Audio Analysis on the Web

Albin Andrew Correya, Dmitry Bogdanov, Luis Joglar-Ongay, Xavier SerraISMIR 2020

Abstract

Essentia.js brings the power of the industry-standard Essentia C++ library to the web browser via WebAssembly (WASM). It provides a comprehensive, high-performance toolkit for both real-time and offline music information retrieval (MIR), allowing developers to run complex audio analysis—like beat tracking and melody extraction—directly on the client side with near-native efficiency.

Introduction

Traditionally, sophisticated audio analysis and Music Information Retrieval (MIR) have been the domain of native C++ or Python environments. While the Web Audio API has enabled basic audio synthesis and processing in browsers, it lacks an extensive reference library for high-level feature extraction. Existing JavaScript libraries, such as Meyda or JS-Xtract, offer a limited set of algorithms and often struggle with the performance overhead of Just-In-Time (JIT) compilation and garbage collection. These limitations frequently force developers to rely on server-side processing, which introduces latency and scalability challenges. Essentia.js addresses these issues by porting the robust Essentia C++ library to the web ecosystem.

Methods

The development of Essentia.js involved a multi-layered approach to bridge the gap between high-performance C++ and the flexible JavaScript environment.

The multi-layered architecture of Essentia.js, from the core C++ library to high-level JS modules.

The core of the library is a WebAssembly (WASM) Backend, generated using the Emscripten compiler to ensure near-native execution speeds. To manage the vast array of over 250 algorithms, the authors utilized automated Python scripts to generate C++/JS bindings via Embind. A High-Level API written in TypeScript wraps these raw bindings, providing a developer-friendly interface with sensible defaults and robust exception handling.

Furthermore, the library is designed for a Modular Ecosystem, allowing for "lean" builds where developers can select only necessary algorithms, reducing the footprint to as little as 2.5MB. For real-time applications, Essentia.js integrates with AudioWorklet, enabling audio processing on a dedicated thread to prevent UI glitches.

Evaluation and Results

The authors evaluated Essentia.js using a 5-second benchmark audio clip, comparing its performance against the native Python implementation of Essentia and the Meyda.js library across various environments.

Performance comparison of Essentia.js (a) and Meyda (b) across various platforms and algorithms.

Key findings include:

  • Performance Superiority: Essentia.js significantly outperformed Meyda in complex feature extraction tasks, particularly for computationally intensive algorithms.
  • Platform Variance: Significant performance differences were observed across browsers. Firefox on Linux emerged as the fastest environment for running Essentia.js.
  • Engine Maturity: Unexpectedly, Node.js and Chrome on Android showed slower performance than anticipated, likely due to the varying maturity of WASM implementations in different JavaScript engines at the time of testing.
  • Cross-Platform Utility: The library proved successful in diverse deployment scenarios, including mobile apps (React Native) and desktop applications (Electron).

Discussion and Future Work

While Essentia.js successfully brings high-performance MIR to the web, some limitations remain. Certain C++ algorithms with heavy third-party dependencies were excluded to maintain a lightweight library. Additionally, the full potential of WASM is yet to be realized as features like SIMD (Single Instruction, Multiple Data) and stable multi-threading support are still being standardized across browsers.

Future work focuses on closing the performance gap with native code by implementing these advanced WASM features and expanding the library to include more pre-trained deep learning models for tasks like audio tagging and classification.

Conclusion

Essentia.js represents a significant step forward for web-based audio analysis. By leveraging WebAssembly, it provides a performant, reproducible, and comprehensive toolkit that empowers developers to build sophisticated MIR applications directly in the browser, reducing reliance on server-side infrastructure.

Summary updated

BibTeX
@inproceedings{correya2020essentia,
  author = {Albin Andrew Correya and Dmitry Bogdanov and Luis Joglar-Ongay and Xavier Serra},
  title = {{Essentia.js: A JavaScript Library for Music and Audio Analysis on the Web}},
  booktitle = {ISMIR},
  year = {2020},
}
Figure