kbmonkey

Support for tracked module formats

20 posts in this topic

Hello,

 

I make my game music in Milkytracker. Tracked music has always been the mainstay for games, with it's 8-bit sound and extremely tiny file size, who can argue.

 

I was wondering what support there is for playing module formats in JavaScript, and experiences anybody has had with these?

 

So far this is what I have found:

 

Chiptune.js - A port based on the libxmp C library.

  • The JavaScript wrapper make it easy to use.
  • The results sound pleasing enough, if unfiltered via post-processing.
  • Supports most module formats.
  • Playback seems best in Chrome based browsers, where Firefox based ones sound more jagged. Then again the Web Audio API only reached the Mozilla base 3 months ago, so fixes 
  • Some noise artifacts are present in playback.
  • Also playback stutters when switching away from the tab or minimizing the window (not a major issue if one pauses playback along with the game).
  • Stereo playback needs to be implemented.

JSModPlayer - A Javascript .MOD music player.

  • Uses the The Mozilla Audio Data API, which is now is deprecated.

 

mod.haxor.fi - amiga protracker module player for web audio api.

  • Protracker .MOD support only (unsubstantiated)

 

FlodJS - JavaScript Amiga Tracker Player (SoundTracker, ProTracker and lots more formats).

  • Can't seem to get this working, perhaps an oversight on my part.

 

Any experience with these or other players and provide insight?

 

Thanks :)

 

Share this post


Link to post
Share on other sites

You could also try the mod player that is part of codef (which is basically a re-worked Flod).

 

Also Weasel JavaScript Audio Lib - which looks insanely comprehensive and equally complex: http://weaselaudiolib.sourceforge.net/

 

And not a tracker in the classic sense, but SoundBox is neat: http://sb.bitsnbites.eu/

 

Personally I use either Flod or the Firehawk one.

Share this post


Link to post
Share on other sites

Weasel Audio Lib seems pretty vast and very well supported. And SoundBox is pretty fun to play with, although I admit I still favor my Milkytracker :)

 

Thanks rich, I will spend some time with these!

Share this post


Link to post
Share on other sites

FlodJS looks really nice, but it doesn't seem to be working on Firefox still, even though Firefox has support for WebAudio now. Anybody have any idea why?

Share this post


Link to post
Share on other sites

I had to sign up on this board after stumbling over this thread in a Google search for "Web Audio API xm play".

 

I too had found chiptune.js, jsmodplayer and FloodJS.

 

But the weasel one is really impressive indeed. Didn't know about that one. Strange why it doesn't show up in a search.

 

Anyway, I know that the author of Milkytracker is also working on a player these days, with a mate of his. It'll be interesting to see what the result will be.

It's on github, but still in very very early development: https://github.com/junghans-schneider/ModPlayer.js

 

 

At IndieGameMusic.com you can find MOD and XM music to use.

As a musician, my passion is the MOD and XM music, so I would love to see more game-developers use those formats. :-D

XM files is the only logical choice for game-music in my opinion, considering all the control it offers and low filesize. Change tempo on the fly, control game-elements with the music, smoothly jump to another variation in the music e.g. when the player enters a certain screen. Why would anyone want to use any other format? :-)

Share this post


Link to post
Share on other sites

IT > XM 4ever ;)

 

There's a lot of personal preference involved when it comes to tracker formats, and defining which one is better also depends a lot on what you're focusing on. :)

 

I must admit that I've never looked into the IT format myself. I never liked the Scream Tracker GUI. But I understand IT offers some effects that the XM format doesn't. The echo / reverb one being the most used one, I think.

It's not difficult manually creating the same effect with the XM format. It just requires more tracks in the patterns. The result is of course that the IT composer will be able to create his track faster than the XM composer, but playback of the two tracks will require somewhat the same amount of CPU - except on a few platforms that actually has hardware acceleration for the IT effects, like Nintendo DS (afaik).

 

There are also more modern trackers available, like Renoise and FL Studio, offering huge advantages over any of the oldschool formats. But it'll require quite a lot of CPU power playing their formats, leaving very little for the actual game loop. And the number of platforms that has player libraries for these formats are virtually none.

 

While some formats may be superioer that the XM format, I'm fairly sure that the XM format is the most widely supported and used format, also considering availability of player libraries on all the different platforms out there in the world. This means, that if I put an XM on IndieGameMusic.com, I'll have a bigger chance of selling it, than if I put an IT file on display. This makes the XM format the "strongest" in the eyes of the composer at least.

 

The IT format probably comes in on a 2nd place, when it comes to popularity and use of tracker formats.

Share this post


Link to post
Share on other sites

My personal GUI preferences aside, IT is notoriously hard to replay correctly – some of my old files don't sound right in anything but the real IT. And with tools like MadTracker or ModPlug Tracker (or even ReViSiT) it's easy enough to create XMs without having to use that dreadful FastTracker GUI :) 

 

I have to say, this is a part of my past that I don't miss all that much... I lived and breathed Impulse Tracker for more than five years, and loved it, but Buzz and later Ableton Live, and with them real synths and effects, were just so much more powerful that it's been hard to go back to "just" the tracker.

 

I guess the real use for mods are now chiptunes again, few channels and small samples... Back to the basics. If history should repeat itself, JS mod players will be useful as long as download size is a concern and will then be superceded by mp3s again. But who knows? :) 

Share this post


Link to post
Share on other sites

My personal GUI preferences aside, IT is notoriously hard to replay correctly – some of my old files don't sound right in anything but the real IT. And with tools like MadTracker or ModPlug Tracker (or even ReViSiT) it's easy enough to create XMs without having to use that dreadful FastTracker GUI :)

 

I have to say, this is a part of my past that I don't miss all that much... I lived and breathed Impulse Tracker for more than five years, and loved it, but Buzz and later Ableton Live, and with them real synths and effects, were just so much more powerful that it's been hard to go back to "just" the tracker.

 

I guess the real use for mods are now chiptunes again, few channels and small samples... Back to the basics. If history should repeat itself, JS mod players will be useful as long as download size is a concern and will then be superceded by mp3s again. But who knows? :)

 

The problem with many of those trackers (as far as I've heard) is that they don't stick 100% to the XM specification.

And that of course opens up for errors when various player libraries tries to playback the files.

 

I know that the authors of Milkytracker had a lot of focus on sticking to the XM specification, which is one of the reasons I prefer that tracker.

 

Anyway, like you I also moved on to newer trackers. I bought Renoise, and have made some tracks with it.

But for me, I can't escape the fact that I just prefer creating files that can be used in its native format.

Whatever I create in Renoise will have to be rendered to mp3 or ogg to be usable. Playing back the RNS or XRNS formats simply require too much CPU.

But what I create in Milkytracker can be used in its XM format, and offers the game-developer so many options. And now with Web Audio API, it seems that XM playback will, in a sense, have hardware acceleration support too, just like mp3 and ogg playback has nowadays.

 

Chiptunes are popular sure. But you can easily do non-chiptunes too, while still only using 10-20% of the filesize the mp3 would require. [Example]

And of course you can create more spetacular sound in more modern music editors, but then you're stuck with mp3 or ogg.

 

I suppose it comes down to simple preference, both for the artist and the game-developer. :)

Share this post


Link to post
Share on other sites

Very impressive, jwothke!

Can't get them working on Chrome (37) though, but in Firefox it works great.

 

Is there a difference between the versions in terms of CPU-usage ?  

And would the amount of samples and number of simlutaneously played samples in the mod make a big difference in CPU usage?

Share this post


Link to post
Share on other sites

Very impressive, jwothke!

Can't get them working on Chrome (37) though, but in Firefox it works great.

 

Is there a difference between the versions in terms of CPU-usage ?  

And would the amount of samples and number of simlutaneously played samples in the mod make a big difference in CPU usage?

Running them here on Chrome (31) without any problem.. are you getting any error messages in the JavaScript console?

I did not make any direct comparison.. the mods that I played using XMP used between 20 and 40% of my old CPU.. whereas the ones I played using UADE all seemed to be closer to 40%.. I'd expect that it depends a lot on the specific mod-flavor because the respective player routines can be quite different. I would guess that it is not primarily the number of simultaneously played samples but the amount of transformation logic that is used to generate the final samples..

feel free to experiment.. you'll find the sources on GitHub: https://github.com/wothke

Share this post


Link to post
Share on other sites

Tried again on Chrome (after restarting my computer) and it works now. Don't know what was wrong...

 

20-40% CPU seems quite a lot,  so maybe playing mods in the background of actual gameplay would not be such a good idea...

Quite amazing that an Amiga 500 played these mods 25 years ago without any problems on a single-core cpu that's 1000x slower than my computer now...

 

Thanks for the sources, I'd already hacked your examples to try it out in my game :)

Share this post


Link to post
Share on other sites

40% certainly isn't a 'rule'. I've got WebXmp open right now, playing Unreal by Purple Motion and Chrome is struggling to use even 1% CPU on my PC from all of its tabs combined! (14 of them). My 8 physical cores are barely hitting 3% total, that's including everything currently running in Windows: Photoshop, Sublime, twitter, etc. 140 processes in total.

 

So yeah, 40% is far from an average. But YMMV.

Share this post


Link to post
Share on other sites

You might be interested in one of my WebAudio based chipmusic players.. (for mods it would probably be one of the first two..)

 

mods:     http://www.wothke.ch/webxmp/

Amiga:    http://www.wothke.ch/webuade/

Atari ST: http://www.wothke.ch/webaudio68/

C64:      http://www.wothke.ch/websid/

 

That's awesome!

 

I have added link to WebXmp in a "Format guide" I'm currently writing to game-developers for IndieGameMusic.com

(Any feedback / additional info you might have for this guide is most welcome in a PM or by e-mail).

 

I have a mate who's currently developing a little test-app for Android to show the CPU-usage difference between playing an XM version of a track and other versions of the same track.

 

I'd like to encourage someone to do the same for HTML5.

This track could be used as a test case, because the XM uses all 32 channels in all patterns.

It could be interesting to see how big a difference there is in CPU usage when playing the track

- as mp3

- as ogg

- as XM with WebXmp and maybe others

- as MIDI + soundfont(s) wtih MIDI.js and/or jasmid.js

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.