Procedural audio

Is there any way to create procedural audio in babylon.js?

There is WebAudio that is built into the browser. If you can build an audio buffer in code (btw that is amazing tough to do. better to start with samples in .mp4 or .wav), you can make a graph to cause it to come out. There is some direct integration to replay sound files in BJS, but this is a browser question, not a framework / webgl issue.

1 Like

Ah okay, so WebAudio can be used in anything browser-based including BJS but is not part of BJS itself? Is the purpose of building an audio buffer to avoid processing delays? Uploading sound files is fine but deeper levels of sonic interaction can be achieved using procedural audio, plus it’s theoretically computationally cheaper - sounds like it might be a pain to implement though?

It’s not to hard to make simple bleeps and bloops, but anything more advance is tedious.

1 Like

WebAudio is separate API available in most browsers. It is queue based. It is designed to do the actual processing of the queue off of the UI thread, so it can be very accurate.

Unless you are very familiar with Fast Fourier Transform(FFT), I would stick with something that has been recorded. You might look at

While it is primary for music. There are also instrument fonts which are more like sound effects. BJS can also just play any sound file for you, in a number of options. This is implemented in WebAudio though, and not doing anything it cannot.


Thanks so much for the explanation and links!