Cette page a au moins 11 ans !
This page is at least 11 years old !
Untitled Document

Sötplayer is a tiny music and sound effects player for the Gameboy ("söt" means "cute" in Swedish). It also comes with a converter for MIDI files with track and instruments mapping/editing with exporting to WLA-DX asm.

Usage and requirements
  1. .include "sotplayer.s"
  2. .include "music1.s"
  3. Initialisation:
    ld     hl,music1
    call   setupmusic
  4. In VBlank:
  5. call   stepmusic

Source code (Version 1.1) Assembled size: 465 bytes.
Dubmood test ROM.
VB6 converter (to come).

Technical specifications

Maximum number of tracks: 4.
Number of instruments: 127.
Number of notes: MIDI notes 1 to 127.
Effects supported: None for now !
Video lines consumption: from 3 (one note step) to 16 (all instruments change).

Track format:

Delta, A, (B), Delta..., 0

Delta is the number of frames to wait before stepping to the next command, its encoding is the same as the one used in MIDI files:

  • If bit 7 of Delta is not set, Delta is one byte (0 to 127).
  • If bit 7 of Delta is set, Delta is two bytes: First byte is the 7 MSBs, second byte is the 8 LSBs.

Delta can therefor be any value between 0 and $7FFF (15 bits) included.

The presence of the B byte depends on the A byte:

  • If bit 7 of A is not set, play note A.
  • If bit 7 of A is set, change instrument to A & $7F, and play note B.

Instrument 0 is used to mute the track (stop the note).
Note 0 indicates the end of the track.

Example track data:

Note on $24, instrument 5
Wait 16 steps
Note off
Wait 16 steps
Note on $25, instrument 5
Wait 140 steps
Note on $20, instrument 6
Wait 32 steps
Note off

00,85,24    Delta=0   InstrumentChange=5 Note=24
10,80,00    Delta=10  Note off
10,25       Delta=10  Note=25
80,8C,86,20 Delta=8C  InstrumentChange=6 Note=20
20,80,00    Delta=20  Note off

Sot format: 15 bytes, MIDI format: 21 bytes.

  • Make track mute not specify an useless note number after instrument code $80.
  • Set number of tracks used.
  • FX player on one track.
  • Support loop point.
  • Support volume change.
  • Support arpeggios.


symbol symbol symbol symbol symbol