Javascript Advanced Music Engine (libJAME)


An advanced music and audio engine written in JS

Posted: 2023-06-09
Est. Reading Time: 3 minutes
Author: Brady O'Leary

Demo Source Code on Github: https://github.com/mboleary/BOrk

LibJAME, or the Advanced Music Engine, was a project that was born out of the development of the Js Game Engine. I wanted to build a library capable of playing back multiple audio tracks at one with the ability to gate a playback loop, as well as having an excuse to learn more about the Web Audio API, including generating sounds using oscillators, sequencing midi loops on top of the playback audio, and interfacing with MIDI Devices. While I did not get around to fully implementing the features I wanted, I did end up with a cool demo, which can be found in the links above.

Project Inspiration and Motivation

Inspiration was taken from software like Pure Data, where there were graphical nodes that could be connected to each other. I ended up building an interface that would sit in front of the parameters of AudioNodes, abstracting away some of the rough edges of the Web Audio API (though some of this ended up not being as necessary as I originally thought).

In addition, there were plans to have a way to serialize the nodes and their connection matrix to JSON, allowing the possibility of creating the setup in a separate webapp, exporting the serialized JSON data, and then using it in another application to construct the audio setup there.

Web Demo

BOrk, or Browser Orchestra, is a demo of this library using React. The demo visualizes connections between nodes, and allows the user to connect up these nodes in order to control where the sound goes, in addition to directly controlling some of the parameters of these nodes, such as the frequency and the start/stop playback.

The React Webapp demo
The React Webapp demo

Use in the Game Engine

This audio engine was originally designed as a Game Engine module (see the module export here), but evolved into something that would likely be useful elsewhere as well.

Current State

The library is functional, but not fully-featured, and the web demo could certainly be extended.

Future

Given that other libraries exist to accomplish similar goals to mine, such as tone.js, I'm probably not going to develop this much further until I find some reason that existing libraries won't meet my current needs, or I develop something new using WASM, given that it will probably be able to directly interface with those APIs in the future.


 ______________________________ 
< I mount my soul at /dev/null >
 ------------------------------ 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||