6 ms·
I've been trying to build something like this last month or so. I was studying the source code of beepbox: https://github.com/johnnesky/beepbox https://github.c
by gnulinux 6y ago
I've been trying to build something like this last month or so. I was studying the source code of beepbox: https://github.com/johnnesky/beepbox https://github.com/johnnesky/beepbox
Does anyone know if there is an easier, higher level abstraction library for audio backend? The approach in beepbox is rather low level and you can make really interesting sounds, with the trade-off being your backend being really complex (literal sound waves).
I searched for MIDI output on web with sound font support but couldn't find anything helpful.
- sova 6y agoMaybe tone.js will be helpful. https://tonejs.github.io/ https://tonejs.github.io/
- hctaw 6y agoYou’ll need to leave the browser to do useful audio and MIDI work.
- gnulinux 6y agoThat's the entire point though, I was trying to do this in browser. I already know how to do it on linux.
- hctaw 6y agoThe browser can't do everything. Not yet at least. It's an inappropriate platform for real time software, like audio.
- fenomas 6y agoYou can do all sorts of realtime audio in the browser! Especially now that audio worklets are a thing.
- gnulinux 6y agoWhat are you trying to say? It's definitely possible, I even gave a link: https://www.beepbox.co https://www.beepbox.co The problem is can we do this using a higher level library instead of sending sound waves to sound driver.
- hctaw 6y agoI mean you can do trivial little toys in the browser sure, but low-latency, real-time audio rendering can't be done in a garbage collected environment (unless the GC is running concurrently and guaranteed not to stall the audio rendering thread). Which the browser does not provide you. You can get away with it because the complexity is low. When you begin dealing with higher complexities (like even a modest amount of polyphony in a decent synthesizer) you will push up against the limits of what the browser is capable of. That's what I'm trying to say. There are products like bandlab that do incredibly things in the browser, but their competitors do far more with less just by leaving it. As for higher level APIs... sure you can do it. There are things like WebAudio, Supercollider, Max/MSP, Pure Data, the new SOUL language posted recently, etc. But ultimately what every app needs is an API where they pick which samples to fill a buffer with (what you're calling "sound waves to the sound driver" I think). Mostly because the high level APIs sound bad and you will eventually need non-naive DSP. Look - everyone knows low level APIs and languages kinda suck to program against. But it's not for lack of trying that serious audio software isn't running in the browser or in managed languages.
- deleted 6y ago[deleted]
- fenomas 6y ago> Which the browser does not provide you. WebAudio does indeed provide it. The audio data doesn't live in the JS VM, and isn't GC'ed like regular JS.
- fenomas 6y agoYou might try `wasgen` (which I maintain). Basically you pass it an object that describes your audio graph, and a frequency/duration/volume, and it creates/disposes all the audio nodes. https://github.com/andyhall/wasgen https://github.com/andyhall/wasgen Making the sound program objects isn't trivial if you're unfamiliar with low-level audio, but the live demo has examples for all MIDI instruments: https://andyhall.github.io/wasgen/ https://andyhall.github.io/wasgen/