The music tool of the opensnes-* family (The opensnes-* tools: conventions). Your composer writes in OpenMPT or Schism Tracker and exports .it; opensnes-music turns one or several modules into the soundbank the SNESMOD driver plays, tells you what each song costs in the SPC700's 64 KB, and writes a standalone .spc for a player. The converter is smconv's (SNESMOD, by Mukunda Johnson), so a soundbank from here is byte for byte what smconv wrote.
In: Impulse Tracker modules, uncompressed or IT 2.14/2.15 compressed samples, up to 8 channels (the SPC700 has eight voices).
Out: NAME.asm (the data, in ROM bank --bank, default 1 — the OpenSNES layout; bank 0 holds the code), NAME.h (one constant per module and per effect, prefixed NAME), NAME.bnk (the sample data). NAME defaults to the module's name for one input and to soundbank for several. A module that does not fit the SPC700's RAM is refused, named with what it needs and what the driver has, and nothing is written.
The bank as an asset. A soundbank has several sources, so its settings live in a file named after it (The opensnes-* tools: conventions):
opensnes-music bank music/soundbank.toml builds soundbank.asm, .h and .bnk beside the file; opensnes-music bank music/*.it --name soundbank --save writes that file from a command-line run.
The build runs opensnes-music bank for you; you list the modules in the Makefile:
It converts them (--name soundbank, --bank from SOUNDBANK_BANK, 1 by default) and links the soundbank; the HiROM build relocates its origin for you. A settings file is for running the tool by hand: the build links a soundbank only through SOUNDBANK_SRC. In C, the .h gives each module and effect a name:
examples/audio/snesmod_music (music and effects), and the games rooftop_run and blocks do this. The runtime side is Music with SNESMOD.
Nothing is written. The figure is the one that decides whether a song fits. The driver loads the module at $1A00 (its patterns, instruments and sample table) and the module's BRR samples right after it; the echo buffer sits under $FF00 and takes 2 KB per step of the module's echo delay (edl in its [[SNESMOD]] message): with echo it starts at page $FF - 8 * edl. So a module has 58 368 bytes without echo and 58 624 - 2 048 * edl with it: 29 952 for the edl 14 above. The MOD_<NAME>_SIZE constant of the soundbank's .h is another figure, kept as smconv wrote it (it counts the echo and leaves out the module's tables); the one that decides whether a song fits is this one. Samples shared between modules of one bank are stored once in the bank (BRR sources counts them); in the SPC700's RAM each module holds its own.
A 66 048-byte SPC file (the SPC700's RAM and registers with the driver and the module loaded), for an SPC player or for sharing a song outside the game.
0 done; 1 the input was refused (a file that is not an IT module, a module too big for the SPC700's RAM, a bank number outside 1..255); 2 usage; 3 the file system. --json puts the outputs, the modules and their SPC RAM figures on stdout as one object. The converter's diagnostics come out in the same shape (opensnes-music: file: message), on stderr; under --json the warnings are listed in a warnings array.