Sound in MegaZeux
Major Supported Formats
Playing Background Music
The simplest way to add music to a game is through the world editor. The Alt+N editor command allows you to set the default music for a particular board. The default music will loop for as long as the player remains on the board. If two or more boards share the same song, and the game swaps between them, MegaZeux will not reload the song. You can also use Shift+8 or the Numpad * to set the board's default music to a wildcard, which essentially tells MegaZeux to continue playing the current music (if any).
The other way to add music to a game is through Robotic. The MOD "file" command set's the current board's music to the chosen file. You can also set the board's default music to a wildcard by using MOD "*", which does exactly what it does while in edit mode.
Adjusting The Background Music
There are also a number of commands that can be used to control the volume of the board music. The VOLUME # command allows you to directly set the volume of the playing song, from 0 (silent) to 255. MOD FADE # # allows you to fade the volume to a given value within a given number of cycles. Lastly, instead of calling MOD "file" (which plays the sound file at the default volume) you can dynamically fade songs in and out with MOD FADE IN "file" and MOD FADE OUT. You can figure out when MOD FADE OUT has finished fading out the current board music with WAIT MOD FADE, which forces the robot to wait until MOD FADE OUT completes.
Finally, you can use the END MOD command to terminate the current background song.
No game can really be considered complete without a decent assortment of sound effects. There are two distinct ways you can insert sound effects into MegaZeux.