Tracker's music in game
I know that it's too early to write that, but I post about what I can.
So, some time ago I find two libraries for play tracker's music in browser. And here is result of my trying to use simplest of them. Library called "BassoonPlayer" and based on BassoonTracker - online tracker written on oldschool javascript. This library have just a few functions and can be used to play music in .xm and .mod formats.
https://www.stef.be/bassoontracker/ https://www.stef.be/bassoontracker/docs/?player
Bad moment - I didn't find a way to use library within microstudio. So, please, write me, if you know a way to add/embed files to project - files which have not standard extension for microstudio, because that must be used for add .xm and .mod files. For example, if you put .png or .jpg files in sprites, you can use them. But you can't put files in other formats in sprites. On desktop microstudio app you can do that, but microstudio trying to convert them to what application want use. Same moment with other "unsupported" file types. And, because of that, you can't just add files to project. And I think, microstudio must have some "other" folder for "other" files.
Good moment - this library still can be used with exported html game or rude in installed desktop app. But you must write some code after export. So, how it looks :
- You can "embed" library in microstudio. Copy code from "bassoonplayer-min.js" to new code file in microstudio. And in top of that file add
// javascript
for check this file as javascript
( you can't just add "bassoonplayer-min.js" to project, because microstudio don't understand that and, if you put that file directly to folder in desktop app, try to convert it )
in bottom of that file add
this.BassoonTracker = BassoonTracker;
It make something like export variable and add BassoonTracker to project context. After that you can use library functions as ordinary.
- But you can't play music just like that. Only after export, you can paste .xm and .mod files in project folder. After that you can see at bottom of "index.html" file your microstudio code -
init = function()
...
end
update = function()
...
end
and so on.
And here you can add code for playing tracker's music. For example, you can write in body of init function :
BassoonTracker.init(true)
BassoonTracker.load("filename.mod",true)
and music will play.
- You can use this way with desktop app. After installation, open folder with game. There open folder "resources", and next - folder "static". Here are your project files. Add here .xm or .mod files and made code like above. After that in your game will play tracker's music.
Of course it is not best way, but it works.