Actions

Sonic & Knuckles Collection/Technical information/Music and sound effects

From Sonic Retro

Back to: Sonic & Knuckles Collection/Technical information.
SCHG: Sonic the Hedgehog 3 & Knuckles
Main Article
Art Editing
Editing Art
Uncompressed Art
Nemesis Format Art
Kosinski Format Art
Palette Editing
Palette Locations
Pattern Load Requests
Object Editing
Editing Objects
Object Pointers
Object Pointer List #1
Object Pointer List #2
Objects not in either list
Sprite Mappings
Dynamic PLCs
Level Editing
Editing Levels
Object Placement
Ring Placement
Level Layout
16x16 Block Mappings
128x128 Block Mappings
Music Editing
Editing Music
Pointer Format
Header Format
DAC Samples
Universal Voice Bank
Music Pointers (Sonic & Knuckles)
Music Pointers (Sonic 3)
RAM Editing
Editing RAM
Main System Memory Locations
Object Status Table Format
Sonic & Knuckles Collection
Sonic & Knuckles Collection
Music and sound effects

Note: All data is little endian unless stated otherwise.

Music

Music playback is handled by the external DLL MIDIOUT.DLL. Music tracks are stored in the DLL as "CMP" resources. These can be converted to and from standard MIDI files using SKC-Midi.

API

GetMidiInterface returns a pointer to a MidiInterfaceClass class. This class provides the following methods:

Function Description
BOOL init(HWND hwnd) Initialise the playback code. If playback reaches the end of a non-looping track, an application-defined message with an identifier of 0x464 is posted to the HWND supplied to this function.
BOOL loadSong(short id, unsigned int bgmmode) Loads the specified song into memory. Valid values for bgmmode are:
  • 0 = FM Synthesizer
  • 1 = General MIDI
BOOL playSong() Starts playback of the currently loaded song.
BOOL stopSong() Stops playback of the currently loaded song.
BOOL pauseSong() Pauses playback of the currently loaded song.
BOOL resumeSong() Resumes playback of the currently loaded song.
BOOL setTempo(unsigned int pct) Changes the tempo of the currently loaded song. The default tempo is 100.


Compression

Sonicretro-round.svg This short section needs expansion. You can help Sonic Retro by adding to it.


Format

Once decompressed, tracks are stored using the following format:

Offset Type Description
0 4 bytes Time Division.
4 4 bytes Number of events.
8 4 bytes Unknown.
12 4 bytes Unknown.
16 8 * (number of events) bytes Array of MIDI events (8 bytes each)
Offset Type Description
0 4 bytes Event delta time.
4 3 bytes Event data. The purpose depends on the event type.
7 1 byte Event type. Can be one of the following values:
$00 MIDI Channel Event. The event data contains the numeric value and parameters.
$01 Tempo Event. The event data contains the sequence tempo in terms of microseconds per quarter-note.
$02 Loop Start/End. The event data is unused.


Sound effects

Sound effects are stored in the SONIC3K.DS2 file, in 8-bit unsigned Mono at 22kHz. This can be edited using SKCsnd.

The file format consists of a 32-bit integer containing the number of sound effects, followed by an array of 32-bit integers containing the length of each sound effect in bytes. After this is the sound data as raw PCM for each sound effect stored sequentially until the end of the file.


References


Sonic & Knuckles Collection
SKC Title.png

Main page | Credits | Hidden content | Magazine articles | Video coverage | Reception | Technical information


Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information