OpenMusic.Gallery

Game Dev


Adding music and sounds to your game is easy with OpenMusic.Gallery. Just add a few lines of code.

In your HTML:

     <script src="https://openmusic.gallery/omg.js"></script>

When the game is loading:

     var music = new OMusicPlayer()
     music.prepareSongFromURL("http://openmusic.gallery/data/1333")
     var laserSound = music.getSound("SFX", "laser")

When the game starts:

     music.play()

When the laser is fired:

     laserSound.play()

Increase BPM and key when difficulty increases:

     music.beatParams.bpm += 20

     music.keyParams.rootNote += 1
     music.rescaleSong()

When a boss character shows up:

    // boss enters
    music.mutePart("Boss", false);
    
    // boss exits
    music.mutePart("Boss", true);

When the game ends:

     music.stop()