Got an example working in C2:
It's very basic and I've lost interest in extending it further. Also I won't be making a plugin version of it.
To use the js at the start of layout loads the js libraries needed and the "loaded" function is triggered when it's ready to play something.
Then to play a file use the execute js action of the browser plugin to run one of these three functions:
ex: "play(viper.js', 1);"
It loads a file and plays a track. Tracks start at 1.
It changes the playing track of the loaded file.
This unloads the file and stops playback. To play again you need to use the "play" function.
I just realized that the library used can play all kinds of video game music.
eg. nes, sega genisis, gameboy, super nintendo