Mod Archive Forums

Community => Project / Coder's Corner => Software Showcase => Topic started by: deskjet on September 03, 2013, 18:18:50

Title: Javascript Module Player
Post by: deskjet on September 03, 2013, 18:18:50
Hi,
I am the creator of chiptune.js, a javascript module player for the browser.
It is based libxmp, so it should play pretty much any format (mod, s3m, it, xm etc) just fine.
I used emscripten to compile the libraries C code into Javascript and built a JS Wrapper around it, so it can be used quite easily.
It uses the Web Audio API for sound output via the browser, which ist currently only supported in Google Chrome, but Firefox support ist about to come in Version 25.

I saw modarchive only has a Java based player, so my project could be an option.
Just have a look if you're interested.

You can try the player on the Demo page (http://deskjet.github.io/chiptune.js/). You can drop any module files on the page and hit the play button, when it's loaded. I hope you like it, let me know. :D

Or visit my Repository over at Github (https://github.com/deskjet/chiptune.js), to see the code. If you guys have ideas for improvement I would be happy to know. You can send me patches, too. Any help is appreciated.

I almost forgot: It is really pure Javascript, no browser plugins needed!
Title: Re: Javascript Module Player
Post by: raina on September 04, 2013, 14:24:45
Well, the volume envelope timing was off with the first .xm I threw at it but these efforts are greatly appreciated. I don't care about the playback accuracy of any old module but once the performance and browser support are there, a js mod player could be tasty for new thigns.
Title: Re: Javascript Module Player
Post by: deskjet on September 04, 2013, 15:54:44
That kind of playback errors seem to be related to libxmp, what I use for decoding.
Chiptune.js just takes the raw audio data and passes it to the browser for playback. So that is a problem, that might get fixed in a future version of libxmp, that I can adopt. libxmp is still under active development, so it's not to late to fix errors.

In terms of performace it's alerady pretty good. I'm not doing benchmarks but it still plays smoothly on slow systems. However I have not tried it on Smartphones, yet.

I'm waiting for Web Audio to be finally officially supported in Firefox. It is currently in developmet and also somewhat working, but the timing of audio buffers seems to be inaccurate. So I hope this will get fixed.
I don't know anything about Internet Explorer. Maybe I'll find some kind of flash fallback as a replacement for Web Audio. We'll see.
Title: Re: Javascript Module Player
Post by: Saga Musix on September 04, 2013, 16:22:23
Not that I want to hijack this thread or anything,but there are also plans to make an emscripten version of libopenmpt - as you seem to have some experience with that kind of stuff now, it might even be a nice idea to team up for that.
Title: Re: Javascript Module Player
Post by: deskjet on September 04, 2013, 17:16:48
OK. I just did some internet research on libopenmpt. Turns out that it is not the same thing as libmodplug, which is great. When starting with chiptune.js I first wanted to do it with libmodplug and failed because the code was a mess. It was much easier with libxmp.
I also found out that there is no release of libopenmpt yet and it's in developmet for quite a long time. To me  an emscripten port of libopenmpt sounds like a good idea but it's hard to do, when there is no stable release of the library, that is known to work.
I found nothing an an emscripten version of libopenmpt, so if I missed something just tell me.
Title: Re: Javascript Module Player
Post by: Saga Musix on September 04, 2013, 19:13:10
libopenmpt is "more or less" ready for productive use but I'm sure we will have a stable API very soon (read: most definitely before the end of the year).

Quote
I found nothing an an emscripten version of libopenmpt, so if I missed something just tell me.
You didn't miss anything, we just very recently played with that idea but nothing specific happened yet.
Title: Re: Javascript Module Player
Post by: claudio on November 11, 2013, 01:50:38
Hi, I'm interested in fixing the xm envelope problem in libxmp. Could you point me to a module where the problem is especially visible, such as raina's test module?
Title: Re: Javascript Module Player
Post by: DragShot on December 13, 2013, 03:46:17
Hey, nice web app you got there. And JavaScript? I never tried to build something like a media player using JavaScript before, considering AudioContext is not supported in most browsers, and I'm still not familiarized enough with such scripts :\ .

Anyway, good luck. That project already rocks :) .