trick/mmutil

    Dark Mode
Search:
Group by:

↩ back to overview

Vars

mmutilPath: string

Path to mmutil executable.

You may wish to override this if you're not using devkitARM and mmutil is not in your system's PATH.

Procs

proc makeSoundbank(nimOutputPath, cOutputPath: string;
                   inputFiles: string | openArray[string]; nds = false)

Invoke the Maxmod utility program (mmutil), to convert music and sound effects into a soundbank. The output produced by mmutil is then converted into C and Nim code which can be used in your game.

Parameters:

nimOutputPath
Target Nim file to be imported and used in your game code.
cOutputPath
Target C file to contain read-only data, which will be linked into the final ROM.
inputFiles

Can be either a wildcard pattern, or an sequence/array of file names.
Valid file formats are: .mod, .s3m, .xm, .it, .wav

nds
This flag can be used if you want to produce a soundbank for Nintendo DS instead of GBA.

Example:

Conversion code:

import trick/mmutil

# create a soundbank from all files in the "audio" directory
makeSoundbank("source/soundbank.nim", "data/soundbank.c", "audio/*")

GBA game code:

import natu/maxmod
import soundbank

irqInit()
irqEnable(II_VBLANK)
irqAdd(II_VBLANK, maxmod.vblank)      # register vblank handler
maxmod.init(soundbankBin, 16)         # init with 16 channels, using our soundbank data
maxmod.start(modOcean, MM_PLAY_LOOP)  # play a song from the soundbank

# main loop
while true:
  maxmod.frame()
  VBlankIntrWait()