deskjet / chiptune2.js

much like chiptune.js - but newer and neater
375 stars 52 forks source link

Would love a real chiptune player #3

Closed nyov closed 9 years ago

nyov commented 9 years ago

(This isn't an issue with chiptune.js, and I'm sorry for this form abuse.)

There are amazingly a lot of javascript tracker libraries out there already, but I have searched in vain for even a rudimentary chip emulator which could play Atari snd or sc68 formats, or even C64 sid's.

Though there are great programs out there on linux, sc68 (@sf) for Atari/Amiga and sidplayfp for C64, trying to make one of them work myself using emscripten failed horrendously.

Since you seem to have skill with emscripten's pipeline (and you called this project "chiptune.js", not tracker.js), maybe I could interest youd in giving these chiptune players a try? Especially libsc68 would be very amazing. I'd be very grateful for even trying.

Tunes for testing could be found at http://sndh.atari.org/ (sndh) and http://www.hvsc.de/ (sid).

nyov commented 9 years ago

Actually I just found it! http://www.wothke.ch/webaudio68/ (wtf, yeeaaha) I wonder if I just didn't search enough for sidplay, yet.

deskjet commented 9 years ago

I'm happy that you found, what you were looking for. Anyway, having support for true chip formats inside chiptune.js sounds like a great idea. I'll keep it in mind.

nyov commented 9 years ago

Thanks, btw I found the author has done several other ports since my earlier post, also a libxmp-based one, which I'm sorry to say runs a bit smoother than your chiptune.js ;)

Here are the links in case someone else has been searching as desperately as me: xmp, tinyrsid, uade, sc68 Unfortunately the porter seems to keep them close to heart, no build setup instructions, and in several cases placing them under a CC license (which I believe is in violation with the GPL projects he's been porting). So I wouldn't mind seeing another effort on this.

deskjet commented 9 years ago

I consider chiptune.js more or less discontinued. Getting libxmp to work with WebAudio API needed some extra wrapping and sample conversion. Libopenmpt (chiptune2.js) in contrast compiles flawlessly with emscripten and has a directly usable API. So I prefer working with libopenmpt and chiptune2.js. Nevertheless everyone is still invited to improve chiptune,js.

Please note that the chiptune2.js demo page is not up to date (I'll fix that soon). The WebAudioAPI code received a rewrite by one of the libopenmpt devs (manx). Check out the master branch or manx fork to get the latest version using a ScriptProcessorNode instead of my custom hackish AudioBuffer scheduling. But since you did some work (thanks!) on the project, you probably already used the smoother ScriptProcessorNode version.

nyov commented 9 years ago

Right, I tested the master branch locally. Being a minimalist here, the only issue I have is that libopenmpt.js clocks in at ~2.2mb, while libxmp.js is "only" ~1.2mb. My reason for looking for JS trackers and chip emulators is that I consider "scripted music" superior for the web than "waveforms". Mostly for size constraints.

So if the music player itself already takes 2mb download size, the module maybe another one, why go for tracked music, I might aswell load a converted mp3?

That argument is a bit bogus when talking about a whole tracklist, but if the library could be compressed somehow (maybe different file formats compiled as extra JS modules?) that might be nice anyway.

For comparison, the size for the sc68 chip emu there: 450Kb minified. A tune takes about the same size. The sid player is even more awesome: 108Kb. Now that's pretty instant sound in a page.

P.S> but another reason for scripted music: If you ever played Unreal... They used a pretty sleek concept of modules with multiple sequences/subroutines for different "moods" of the same tune. Then the game seamlessly switched "tracks" depending on the action ingame. (More amazing seamlessness than crossfading some waveforms.) Now, taking that concept to the web... That'll be like image sprites for music ;)