Synthesizing Music in JavaScript

audio, javascript

Solution

I would imagine you can. In fact, one submission to the JS1k contest was a JavaScript speech synthesizer. I think this pretty much proves that music is possible as well (though I'll not define music here). A breakdown of the project can be found here: http://www.p01.org/releases/JS1K_Speech_Synthesizer/.

You might also find riffwave.js to be of interest: http://codebase.es/riffwave/. It has some pretty impressive examples on the demo page.

Jasmid is a MIDI file synthesiser which has been shown to create some horrendous retro MIDI files that take us all back to the days of Geocities and `bgsound`. You can view it on Github at https://github.com/gasman/jasmid, and hear a couple demos at http://jsspeccy.zxdemo.org/jasmid/.

Problem

Is it possible to synthesize (not just play *.wav / *.mp3) files in JavaScript? I.e. to write javascript code that (1) produces some PCM waveform and (2) pipes it to the speaker? Thanks!

Original source