Oh man. Huge flashback to downloading FastTracker 2 back in '93, excitedly hitting "play" on e.g. Chillzone.xm by Norfair (edit, actually that tune wasn't released yet in '93, but there were so many great tunes) and seeing 32 waveforms going at the same time, sending amazing sounds through the Pro Audio Spectrum 16 I had gently installed in my ZEOS 486 DX/2 66 MHz.
Amazing to see it all there in JS today...wow. Thanks for sharing the article.
Of course it is. It's actually a lot easier, as there are no envelopes and just one sample per instrument. Firehawk/TDA wrote this excellent player a while back: http://mod.haxor.fi/Purple_Motion/2nd_pm.s3m
I always wished I knew how to work ST3. I ended up instead mailing away for a copy of Modedit shortly before the really user-friendly FT2 was released.
(Is ScriptProcessorNode here to stay, though? Mozilla's documentation marked the feature as deprecated for quite some time now [1], suggesting the use of Audio Workers instead; in turn, the same documentation states that these are not yet implemented in any browser. At some point I got very confused about the one true way of generating audio using Javascript.)
It got renamed from JavaScriptNode to ScriptProcessor when it switched from webkitAudioContext to AudioContext, and it seems to be the best-supported way to do it. I don't see why not. But of course IE doesn't support it at all and I don't think iOS Safari does either (it's a big question mark on mozilla.org anyway)
The issue on mobile is you can only start playback of sounds in a user gesture event and I think on iOS the first sound can't be a ScriptProcessorNode (maybe that bug was fixed). I just play an oscillator for a moment to get things started. Once the first note is played it just all works.
I'd be surprised if they removed it at this point. Many many pages use it. Many many native->emscripten apps use it. I think just no one has updated MDN in a while. Unity->HTML5 uses it. Unreal->HTML5 uses it. Pico8->HTML5 uses it. Voxatron->HTML5 uses it.
edit: THANK YOU! That was the issue; I had to make a dummy oscillator. And, separately, there was a CSS issue which made the buttons black on black. Now it works on iOS.
On second thought you're probably right; this API will probably break in a couple years and my player won't work anymore, just like everything else that tried to use createJavaScriptNode in the past is now broken.
Hopefully the web workers transition is the last...
I definitely won't be implementing the tracker code anytime in the immediate future. Maybe in a month?
Andy Herbert started a ripscrip interpreter that renders to canvas, but it isn't finished and definitely isn' reliable for artscene files. He doesn't intend to finish it, last I heard. https://github.com/andyherbert/ripscript.js
There are a lot of libraries to do this. I use ansilove.js[0], which renders to canvas, so I save on the expense of keeping 10G of rendered images online (at the expense of my users compute times).
Ansilove.js is a variant of Ansilove, which was originally written in PHP [1], but has been ported to other languages [2], too.
There are a bunch of other renderers too like piece [3] and Pablo [4].
Oh wow I spent so many nights playing and making MODs and chatting with my other nerd friends on BBSes of the day trying to share knowledge. This is truly a much-appreciated work of art! On another note, I think the people commenting in this thread would be really great together in a room somewhere with beer and computers. It's a very specific cross-section of both a skillset and a point in time.
Amazing to see it all there in JS today...wow. Thanks for sharing the article.
(Wait...where is Nibbles?)