Difference between revisions of "SCUMM/Technical Reference/Sound resources"
Jestar jokin (talk | contribs) m (→Music: remove todo) |
Jestar jokin (talk | contribs) (→iMUSE: replace dead external link with ScummVM wiki link) |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
The redundant header is possibly due to building on a legacy implementation, or for easier identification in the table stored in the .000 index file. | The redundant header is possibly due to building on a legacy implementation, or for easier identification in the table stored in the .000 index file. | ||
The music block may contain any combination of ROL (Roland MT-32), ADL ( | The music block may contain any combination of ROL (Roland MT-32), ADL (AdLib/OPL FM), or SPK (PC speaker) blocks. They can also store a single SBL block for digitized sound (described in a later section). Aside from SBL, each of these blocks follow the same basic pattern. | ||
Block name 4 bytes ("ROL ", or "ADL ", or "SPK ") | Block name 4 bytes ("ROL ", or "ADL ", or "SPK ") | ||
Line 21: | Line 21: | ||
Every track is stored in MIDI format, in order to make use of the iMUSE technology through System Exclusive (SysEx) messages. | Every track is stored in MIDI format, in order to make use of the iMUSE technology through System Exclusive (SysEx) messages. | ||
Due to the predominance of the Sound Blaster and | Due to the predominance of the Sound Blaster and AdLib/OPL FM technology at the time, in at least MI2 every musical SOUN block contains an ADL block. | ||
==iMUSE== | ==iMUSE== | ||
From SCUMM v5 onwards, LucasArts games used a dynamic music playback system called iMUSE. This basically consists of standard MIDI data, with embedded System Exclusive (SysEx) messages that act as markers in the song. | From SCUMM v5 onwards, LucasArts games used a dynamic music playback system called iMUSE. This basically consists of standard MIDI data, with embedded System Exclusive (SysEx) messages that act as markers in the song. iMUSE allows operations like conditional jumping & looping, adjusting the volume of parts, turning parts on and off, changing instruments, and detuning parts. | ||
You can find the original patent document | You can find the original patent document [http://pat2pdf.org/pat2pdf/foo.pl?number=5315057 here], and some technical details [[SCUMM/Technical Reference/iMuse data|can be found here]]. | ||
==Mac0== | ==Mac0== | ||
Line 80: | Line 80: | ||
Block size 4 bytes | Block size 4 bytes | ||
Sound header 4 bytes ("AUhd" or "WVhd") | Sound header 4 bytes ("AUhd" or "WVhd") | ||
Block size 4 bytes | |||
Unknown 3 bytes (always 00 00 80) | Unknown 3 bytes (always 00 00 80) | ||
Data header 4 bytes ("AUdt" or "WVdt") | Data header 4 bytes ("AUdt" or "WVdt") | ||
Block size 4 bytes | |||
VOC data variable | VOC data variable | ||
AUhd and AUdt are used in Monkey Island, while WVhd and WVdt are used in the non-interactive demo of Sam & Max. The actual sound data is stored in the Creative VOC format, without the | AUhd and AUdt are used in Monkey Island, while WVhd and WVdt are used in the non-interactive demo of Sam & Max. The actual sound data is stored in the Creative VOC format, without the header information. The implied data offset is 0x1A, and the VOC version is 0x010A. | ||
==Early v5 - CD tracks== | ==Early v5 - CD tracks== | ||
Games that use CD tracks (Loom/CD, MI1/CD, Zak256/FM-TOWNS) are a bit different. For MI1/CD at least, the " | Games that use CD tracks (Loom/CD, MI1/CD, Zak256/FM-TOWNS) are a bit different. For MI1/CD at least, the "SOUN" block size is always 32 bytes and presumably points to the CD track to play. | ||
Here's some notes by cocomonk22: | |||
Values from offsets 0-23 (0x00-0x17) are all the same, so just copy data from an existing SOUN. | |||
At offset 24 (0x18) track number in hex format (for new music not in original start with track decimal 24 or hex 18). | |||
At offset 25 (0x19) seems to be loop, opening uses 01, scummbar uses ff. | |||
The six remaining values 26-31 (0x1a-0x1f) are all 00 if you want the music to start at the beginning of the track. | |||
An example of music not starting at the beginning: | |||
The scene at the lookout following the intro uses the same music as the opening, but starts at position 1 min 36 sec. Hex values are 01 23 30 00 00 00. 01 23 30 is equivalent to 1 35 48 in decimal. | |||
==v5-v6 - MONSTER.SOU== | ==v5-v6 - MONSTER.SOU== | ||
Line 101: | Line 112: | ||
Block name 4 bytes ("VCTL") | Block name 4 bytes ("VCTL") | ||
Block size 4 bytes | Block size 4 bytes | ||
Lip-sync tags variable | Lip-sync tags variable * 2 bytes LE | ||
Sound data variable ("Crea" block / VOC file) | Sound data variable ("Crea" block / VOC file) | ||
The lip-sync tags provide timing information. In v5 the number of tags is stored in the calling text, according to the formula | The lip-sync tags provide timing information, and are 16-bit LE values, representing positions in the speech file. Lip synching is basically just toggling the speaking animation on and off whenever the speech goes past the positions listed in the lip-synch tags. In v5 the number of tags is stored in the calling text, according to the formula (num_tags << 1) + 8. The "Crea" block is an entire Creative VOC file. | ||
===Compressed=== | ===Compressed=== | ||
Line 138: | Line 149: | ||
TOWS - FM Towns | TOWS - FM Towns | ||
SBL - Sound Blaster digitized sound (Creative VOC file) | SBL - Sound Blaster digitized sound (Creative VOC file) | ||
ADL - | ADL - AdLib (OPL FM) | ||
AMI - Amiga MOD | AMI - Amiga MOD | ||
ROL - Roland MT-32 | ROL - Roland MT-32 |
Latest revision as of 01:48, 3 September 2010
Music
Early v5
Going from Monkey Island 2 (MI2), music blocks are stored in LFLF blocks, outside of the ROOMs, so they can be accessed globally. The containing sound block looks like this:
Block name 4 bytes ("SOUN") Block size 4 bytes Block name 4 bytes ("SOU ") Block size 4 bytes Music block variable
The redundant header is possibly due to building on a legacy implementation, or for easier identification in the table stored in the .000 index file.
The music block may contain any combination of ROL (Roland MT-32), ADL (AdLib/OPL FM), or SPK (PC speaker) blocks. They can also store a single SBL block for digitized sound (described in a later section). Aside from SBL, each of these blocks follow the same basic pattern.
Block name 4 bytes ("ROL ", or "ADL ", or "SPK ") Block size 4 bytes MIDI data variable
Every track is stored in MIDI format, in order to make use of the iMUSE technology through System Exclusive (SysEx) messages.
Due to the predominance of the Sound Blaster and AdLib/OPL FM technology at the time, in at least MI2 every musical SOUN block contains an ADL block.
iMUSE
From SCUMM v5 onwards, LucasArts games used a dynamic music playback system called iMUSE. This basically consists of standard MIDI data, with embedded System Exclusive (SysEx) messages that act as markers in the song. iMUSE allows operations like conditional jumping & looping, adjusting the volume of parts, turning parts on and off, changing instruments, and detuning parts.
You can find the original patent document here, and some technical details can be found here.
Mac0
From Markus Magnuson (superqult) we got this information:
4 bytes - 'SOUN' BE 4 bytes - block length 4 bytes - 'Mac0' BE 4 bytes - (blockLength - 27) 28 bytes - ??? do this three times (once for each channel): 4 bytes - 'Chan' BE 4 bytes - channel length 4 bytes - instrument name (e.g. 'MARI') do this for ((chanLength-24)/4) times: 2 bytes - note duration 1 byte - note value 1 byte - note velocity 4 bytes - ??? 4 bytes - 'Loop'/'Done' 4 bytes - ??? 1 byte - 0x09
Instruments (and General Midi equivalent): "MARI" - Marimba (12) "PLUC" - Pizzicato Strings (45) "HARM" - Harmonica (22) "PIPE" - Church Organ? (19) or Flute? (73) or Bag Pipe (109) "TROM" - Trombone (57) "STRI" - String Ensemble (48 or 49) "HORN" - French Horn? (60) or English Horn? (69) "VIBE" - Vibraphone (11) "SHAK" - Shakuhachi? (77) "PANP" - Pan Flute (75) "WHIS" - Whistle (78) / Bottle (76) "ORGA" - Drawbar Organ (16; but could also be 17-20) "BONG" - Woodblock? (115) "BASS" - Bass (32-39)
Digitized Sounds
Early v5 - SBL blocks
Digitized sounds first appeared in Monkey Island 1 & 2. They are contained in the .001 resource files, and are sub-blocks of "SOUN" blocks (see the music section above).
Block name 4 bytes ("SBL ") Block size 4 bytes Sound header 4 bytes ("AUhd" or "WVhd") Block size 4 bytes Unknown 3 bytes (always 00 00 80) Data header 4 bytes ("AUdt" or "WVdt") Block size 4 bytes VOC data variable
AUhd and AUdt are used in Monkey Island, while WVhd and WVdt are used in the non-interactive demo of Sam & Max. The actual sound data is stored in the Creative VOC format, without the header information. The implied data offset is 0x1A, and the VOC version is 0x010A.
Early v5 - CD tracks
Games that use CD tracks (Loom/CD, MI1/CD, Zak256/FM-TOWNS) are a bit different. For MI1/CD at least, the "SOUN" block size is always 32 bytes and presumably points to the CD track to play.
Here's some notes by cocomonk22: Values from offsets 0-23 (0x00-0x17) are all the same, so just copy data from an existing SOUN. At offset 24 (0x18) track number in hex format (for new music not in original start with track decimal 24 or hex 18). At offset 25 (0x19) seems to be loop, opening uses 01, scummbar uses ff. The six remaining values 26-31 (0x1a-0x1f) are all 00 if you want the music to start at the beginning of the track.
An example of music not starting at the beginning: The scene at the lookout following the intro uses the same music as the opening, but starts at position 1 min 36 sec. Hex values are 01 23 30 00 00 00. 01 23 30 is equivalent to 1 35 48 in decimal.
v5-v6 - MONSTER.SOU
Original
From Indy 4 onwards, sound effects and speech are stored in a separate resource file called "MONSTER.SOU". The format is:
Block name 4 bytes ("SOU ") Block size 4 bytes One or more: Block name 4 bytes ("VCTL") Block size 4 bytes Lip-sync tags variable * 2 bytes LE Sound data variable ("Crea" block / VOC file)
The lip-sync tags provide timing information, and are 16-bit LE values, representing positions in the speech file. Lip synching is basically just toggling the speaking animation on and off whenever the speech goes past the positions listed in the lip-synch tags. In v5 the number of tags is stored in the calling text, according to the formula (num_tags << 1) + 8. The "Crea" block is an entire Creative VOC file.
Compressed
ScummVM can use compressed monster.sou files created with the tool "compress_scumm_sou.exe". Aside from using either MP3, OGG, or FLAC formats for the sound data, they contain a mapping table followed by the sound data, like so:
size_of_table : uint32 size_of_table / 16 times { orig_offset : uint32 actual_offset : uint32 num_tags : uint32 sound_size : unit32 } size_of_table / 16 times { num_tags times { tag : uint8 } sound : sound_size (sound file - MP3/OGG/FLAC) }
Each entry in the table has 4 items, each item is 4 bytes, so a table with one entry has a size of 16.
The original offset is what the game will try to play, the actual offset is taken from after the index table.
Each sound is directly preceded by its lip-synch tags.
Sound block types
This information is gleaned from the ScummVM source code. Any block name with only three characters has a space at the end.
MIDI \ Midi iMUS / SOU subtypes TOWS - FM Towns SBL - Sound Blaster digitized sound (Creative VOC file) ADL - AdLib (OPL FM) AMI - Amiga MOD ROL - Roland MT-32 GMD - General MIDI MAC - Macintosh (occurs in MI2, FOA) SPK - PC speaker Mac0 - Macintosh music type 0 Mac1 \ RIFF | TALK > Creative VOC file DIGI | Crea / HSHD - HE sound type without SOUN header FMUS - Used in 3DO versions of HE games