Sonic & Knuckles Collection/Technical information/Music and sound effects
From Sonic Retro
SCHG: Sonic the Hedgehog 3 & Knuckles |
---|
Main Article |
Art Editing |
Editing Art |
Object Editing |
Editing Objects |
Level Editing |
Editing Levels |
Music Editing |
Editing Music |
RAM Editing |
Editing RAM |
Sonic & Knuckles Collection |
Sonic & Knuckles Collection |
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:
|
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
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)
|
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 | |
---|---|
Main page | Credits | Hidden content | Magazine articles | Video coverage | Reception | Technical information
|