Difference between revisions of "Adding Sound Support"

From SCI Wiki
Jump to navigationJump to search
 
(25 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
'''''Note:''' various tools for working with sound for SCI games can be found on the [[SCI_Sound_Utilities|SCI Sound Utilities Page]]''
 
'''''Note:''' various tools for working with sound for SCI games can be found on the [[SCI_Sound_Utilities|SCI Sound Utilities Page]]''
  
 
+
 
  
 
'''By Brandon Blume'''
 
'''By Brandon Blume'''
 +
 +
==<br />  Introduction ==
  
 
What I've learned so far I've seen from opening up sound resources from Sierra games in [[SCI_Sound_Utilities#SoundBox|SoundBox]]. A proper MIDI file engineered to run through SoundBox to create an SCI0 sound resource will not sound correct when played through a MIDI player because there are multiple copies of instruments on different channels to playback through the different sound drivers (ADL.DRV, STD.DRV, MT32.DRV, etc). Here are some guidelines I've learned.
 
What I've learned so far I've seen from opening up sound resources from Sierra games in [[SCI_Sound_Utilities#SoundBox|SoundBox]]. A proper MIDI file engineered to run through SoundBox to create an SCI0 sound resource will not sound correct when played through a MIDI player because there are multiple copies of instruments on different channels to playback through the different sound drivers (ADL.DRV, STD.DRV, MT32.DRV, etc). Here are some guidelines I've learned.
  
&nbsp;
+
==<br /> Standard General MIDI Support ==
 +
 
 +
This is the MIDI support used in Jummybummy. ''NOTE: You cannot have digital sound effects with this method''
 +
 
 +
You can completely ignore the huge guidelines list above if you go this method. It's actually very very simple. If you just want to run a General MIDI file through SoundBox you can do that instead and have it support General MIDI rather than PC Speaker, Adlib, Tandy, MT-32, etc.
 +
 
 +
* Import a regular MIDI file into SoundBox.
 +
* Flag every channel as "New GM", and use [http://www.sierrahelp.com/Utilities/SoundUtilities/RavisSoundDrivers.html#mpumidi Ravi's General MIDI SCI0 MPU MIDI Driver].
 +
 
 +
<blockquote>
 +
=== Notes ===
 +
 
 +
You just need to make sure, however you play the game, that you're going to have a General MIDI device (whether physical or virtual) connected to the appropriate system MIDI output to be able to hear anything. So that's probably not going to work with Command Prompt in Win2k, XP, Vista, or 7. If you're using DOSBox you'd have to set up your DOSBox settings to point to the correct MIDI device on your system (or the MIDI Mapper). Your sound resource won't be compatible with Adlib, MT-32, PC Speaker, etc if you go with this method.
 +
</blockquote>
  
==&nbsp;<br />Classic Adlib/MT-32/PC Speaker/Tandy 3-voice Support==
+
==<br /> Classic Adlib/MT-32/PC Speaker/Tandy 3-voice Support ==
 
You can use the ADDWave.EXE program included in [[SCI_Sound_Utilities#Ravi.27s_Sound_Utilities|Ravi's Sound Utilities]] to append a digital sound file to a sound resource with this method and if you're using SNDBLAST.DRV or MTBLAST.DRV you will hear it in-game instead of the MIDI sound.
 
You can use the ADDWave.EXE program included in [[SCI_Sound_Utilities#Ravi.27s_Sound_Utilities|Ravi's Sound Utilities]] to append a digital sound file to a sound resource with this method and if you're using SNDBLAST.DRV or MTBLAST.DRV you will hear it in-game instead of the MIDI sound.
  
* You can use one channel for multiple outputs (MT-32, Adlib, Tandy, etc) as long as that channel follows the rules for each output.
+
 
* You can use any channel for any output except the MT-32, which can only be on channels 2-9 (9 being the drum channel I think).
+
=== Common Details ===
* The PC Speaker channel can be any channel (usually channel 1) but cannot have more than one note playing at a time.
+
 
* The PC Speaker channel should carry the fundamental of the theme of the sound file. The lead instrument, if you will. Because the PC Speaker driver is only one channel anyway, it should contain everything that makes the theme recognizable. You can make this an alternate channel (not the same channel as an Adlib or MT-32 channel) and rework it so it efficiently contains both lead and melody elements. Think how SCUMM games sound in PC Speaker where there's never more than 1 note playing at a time but you can hear lead and melodic elements playing quickly taking turns, if that makes sense.
+
 
* The PC Speaker channel is also one of the three Tandy 3-voice channels, to save on file size. The other two being whatever other channels you want, but they can each only have 1 note playing at a time.
+
* You can use a single channel for multiple device outputs (MT-32, Adlib, Tandy, etc) and it will work on each device as long as the channel follows the rules for each device.
* I'm not sure if there is a limit to how many Adlib channels you can have, but most Sierra sound resources only have 5. These are also Yamaha and Casio channels usually. I don't have either the Yamaha or Casio hardware to hear what it would actually sound like, though.
+
* Most of the time the Adlib/FB-01/IMFC (and sometimes CMS) channels are the same as the MT-32 channels in Sierra games but there are exceptions. One being if an MT-32 channel has too many voices/notes playing at once for the FM devices. This means you'll have to either trim down the complexity of your MT-32 channels or you can duplicate that instrument in another channel and designate it as Adlib/FB-01/IMFC-only and engineer it to use less voices to stay under those devices' polyphony limits.
* Most of the time the Adlib channels are the same as the MT-32 channels with a few exceptions, one being if an MT-32 channel has too many voices playing at once requiring a new alternate channel composed slightly differently to meet the requirements of the Adlib polyphony voice count.
+
* You can use any channel to output to any music device except the MT-32 (see below) and except for channel 16. Channel 16 is reserved for the SCI interpreter to read specific sound resource controller data from such as cues (for triggering scripted sequences) and loop points.
* Adlib does not have a drum channel because of the way it processes its instruments. So channel 10, while usually being the standard drum channel of almost any MIDI device, is a melodic channel and not actually a drum channel in an SCI0 sound resource.
+
* The Initial Voices field in SoundBox's Channel Properties dialogue window is meant only for FM devices (Adlib/FB-01/IMFC). It is ignored by all other devices.
* An Adlib channel cannot be on channel 9 for the above reason because channel 9 is the MT-32's drum channel.
+
* Nobody is quite sure why, but channel 10 always has an Initial Voices setting of 128 in Sierra's sound resources. I recommend keeping it this way in all sound resources just in case it matters somewhere. Soundbox will also set this automatically when importing a standard MIDI file.
* The Initial Voices field in SoundBox in Channel Properties is meant only for Adlib channels. It doesn't affect PC Speaker, Tandy, or MT-32 output at all.
+
 
* As a whole, a sound resource cannot have more than 7 or 8 Adlib voices at a time (I can't remember exactly which, 8 makes more sense, though, but you can experiment). So you have to compose your Adlib channels in such a way that there are never more than 8 notes playing at any one time across all Adlib channels. And an Adlib channel will never play more voices than the number specified in the Initial Voices field of that channel. So you can have one Adlib channel with 8 Initial Voices or 5 Adlib channels with an Initial Voices sum of 8.
+
 
* The above Adlib rules only apply to the ADL.DRV which is a mono Adlib driver. If you use the SCI0 SNDBLAST.DRV instead you have a much higher polyphony limit which is unaffected by the Initial Voices field, and it's also in stereo.
+
=== MT-32 ===
* I'm not sure how vital this is, but channel 10 (channel 9 in SoundBox) always has an Initial Voices setting of 128. I'm not sure why but I've kept it this way in all my sound resources just in case it's important.
+
 
 +
 
 +
* All MT-32 MIDI data ''must'' be on channels 2-10 (10 being the drum channel).
 +
* The MT-32 has a technical timbre/voice polyphony limit of 32. But in practice, it's more like ~18-22. This is because many instruments use more voice polyphony in their timbres than others. Nevertheless, the MT-32 has the highest polyphony of any of the default supported music devices and you probably won't run into it. Though, it's not as a high as something that's General MIDI (a Sound Canvas, soundfont, or VSTi,  for instance).
 +
* Channel 10 will always playback on the MT-32 regardless of whether it is set for it or not.
 +
 
 +
 
 +
=== FM Devices ===
 +
''(Adlib/Sound Blaster & Yamaha FB-01/IMFC)''
 +
 
 +
* In SCI, Adlib does not have rhythm/drum voices (even though Adlib does support it) because of the way Sierra chose to implement it. So channel 10, while usually being the standard drum channel of most MIDI devices, is a melodic channel for Adlib and not actually a drum channel. As a result, it's not recommended to set channel 10 as an Adlib channel because that's the MT-32's drum channel, and as pointed out above, anything on channel 10 will playback on the MT-32 regardless of the device designation set by the user.
 +
* Adlib and Yamaha each have a maximum limit of 8 voices in SCI. For Adlib that means 8 notes at a time. But for Yamaha that can be more complex as multiple voices can be used for one instrument. This doesn't just work out of the box like the non-FM devices, though. Each Adlib  and Yamaha channel must have their Initial Voices fields set in the Channel Properties dialogue window or no sound will be heard at all in-game. You can change the number of voices at any point in the song by adding voice control changes in the same dialogue by inputting the number of ticks the command is to take place and the value (number of voices). But it must add up to 8 in total at any one time across all channels. So you have to compose those channels in such a way that there are never more than 8 voices playing at the same time otherwise notes will be cut off by the most recent notes if the limit is reached. This can make for a very sub-par listening experience.
 +
* In Adlib's case, the above rules only apply when using the ADL driver which was designed for the OPL2 chip (which is also mono). If you use the SCI0 SNDBLAST driver instead which is designed for the superior OPL3 chip you will have a much higher voice limit (16 instead of 8!) and it ignores the "initial voices" and voice controller data. Instead it simply plays as many voices as it can, prioritizing the most recent notes if necessary. It will also respect panning and thus you'll get stereo Adlib!
 +
* OPL2 actually natively supports 9 voices (as well, OPL3 supports 18) but in SCI it only supports 8. I surmise that this must be somehow due to the fact that Adlib support is limited to melodic instruments as opposed to rhythm/percussion. Usually in Adlib 6 voices are reserved for melodic and 3 for rhythm.
 +
 
 +
 
 +
=== CMS/Game Blaster ===
 +
 
 +
 
 +
* The CMS/Game Blaster device can generate a maximum of 12 voices at a time, but will likely never use more than 8. This is because CMS can only use the same channels designated for Adlib and just plays as many voices as it can. There is no way to designate channels for CMS independent of Adlib in SCI0. SCI1 can, but that's a different animal altogether.
 +
* '''''OUTDATED:''' Currently there's no way to create CMS instrument patch banks. Its patch file (PATCH.101) is the least complex of the supported devices and is likely easy to reverse engineer. So that might be possible to target as a supported device in the future!''
 +
* '''UPDATED:''' With some help by NewRisingSun pointing me in the right direction, I've determined that the PATCH.101 instrument file for CMS is actually in the same format as the PRESET.PST file that is generated by DEFINST.COM (located on the "Master" floppy disk that comes with the CMS/Game Blaster) except that PRESET.PST contains only 32 instrument definitions and PATCH.101 contains 96 (3 sets of a full PRESET.PST instrument definition bank, if you will). The only other difference is that PATCH.101's first 32 bytes are reserved for SCI resource header information:
 +
# 2 bytes: SCI resource type identifier (89h 00h)
 +
# 2 bytes: The characters "CT" (43h 54h) - I don't know what this means yet, if anything.
 +
# 28 bytes: Game title, usually in all caps - I'm not sure what this is for either as it is not displayed anywhere when loaded in-game that I'm aware of. Perhaps it was useful for the composer or programmer for organizing instrument banks for different games. Not sure why other SCI patch resources don't contain the game title though (besides the MT-32, which displays text on its LCD display).
 +
* Because of the above, we can easily create CMS patch banks for SCI by utilizing the pre-existing DEFINST.COM program from the CMS's "Master" floppy disk. One need only use it 3 times to define instruments, renaming PRESET.PST to another filename each time. Then a hex editor can be used to combine the files into one along with the necessary SCI header information at the start of the file. It would be trivial to write a CLI program to accomplish this and I plan to do so in the near future.
 +
* Stereo is supported but with only 3 settings of panning: Center, 100% left, or 100% right. I believe the panning output is determined by the average of whatever the channel's panning is set to (ie- 0-50% panned right = Ctr, 51%-100% panned right == hard pan R).
  
  
===Adlib/MT-32/PC Speaker/Tandy Notes===
+
=== Tandy 3-Voice ===
  
All the channels I've listed here are the proper MIDI channel designations (1-16). SoundBox numbers them from 0-15 instead, so just be aware of that when you're creating your MIDI file and running it through SoundBox.
 
  
&nbsp;
+
* Like the PC Speaker, Tandy channels can only have one voice playing at a time. Doubled up notes in the same channel will be cut off by the most recent notes if the limit is reached.
 +
* A good trick is setting one of the three Tandy channels to double as PC Speaker to save on channel consumption. The other two channels can be any you want (but channel 10 is not recommended for the same reason as Adlib/Yamaha).
 +
* Though it does not have a corresponding PATCH resource, Tandy "instruments" can indeed be defined. The SN76489/SN76496 chip that the Tandy uses is basically just a tone generator. But each channel does have a volume control that can be manipulated over time. This can be utilized by a driver to set volume envelopes for each channel (think of chip trackers like Furnace and how it defines instruments for the SN76489 chip). BUILDTDY is one of the leaked Sierra tools in the past few years and is designed to create these envelopes. It then allows you to load in a Tandy driver and builds the envelopes you've defined into the driver itself like instrument patches. This may only work for SCI1 game drivers though. I've found that at least one of the older Tandy drivers for SCI0 (including JR.DRV, for the near identical IBM PCjr sound device) is not compatible with BUILDTDY. Further experimentation is warranted here.
 +
* Tandy 3-voice actually supports a sort of 4th channel in the form of a 3-pitch (low, mid, and high) noise channel which also can have a volume envelope (and a different one for each pitch!). AGI uses this extensively in its sounds such as the crashing waves in KQ2, the Arcada doors in SQ1, or the gunshots in the intro of PQ1. But sadly SCI does not. :(
  
==Standard General MIDI Support==
 
  
This is the MIDI support in Jummybummy. ''NOTE: You cannot have digital sound effects with this method''
+
=== PC Speaker ===
  
You can completely ignore the huge guidelines list above if you go this method. It's actually very very simple. If you just want to run a General MIDI file through SoundBox you can do that instead and have it support just General MIDI rather than PC Speaker, Adlib, Tandy, MT-32, etc.
 
  
* Import a regular MIDI file into SoundBox.
+
* The PC Speaker channel cannot have more than one note playing at a time. Overlapping notes will be cut off by the most recent note.
* Flag every channel as "New GM", and use [http://www.sierrahelp.com/Utilities/SoundUtilities/RavisSoundDrivers.html#mpumidi Ravi's General MIDI SCI0 MPU MIDI Driver].
+
* Musically speaking, the PC Speaker channel should carry the fundamental of the theme of the sound file. The lead melody, if you will. Ideally it would contain everything that makes the theme recognizable. You can make this an alternate channel (instead of doubling up with an Adlib or MT-32 channel, for instance) and rework it so it efficiently contains both lead and accompanying melodic (and even sometimes percussive) notes. Think of how SCUMM games sound in PC Speaker where there's never more than 1 note playing at a time but you can hear lead and melodic elements both playing (what seems to be) "simultaneously". Though difficult, it's possible to match this type of sound with some savvy knowhow and technical arranging of the MIDI notes in a sequencer or DAW. However, it can certainly be a difficult process to master and requires a lot of careful planning, skill, and patience.
  
&nbsp;
 
===Standard General MIDI Notes===
 
  
You just need to make sure that however you play the game you're going to have a General MIDI device to hear anything. So that's probably not going to work with Command Prompt in Win2k, XP, Vista, or 7. If you're using DOSBox you'd have to set up your DOSBox settings to point to your Windows MIDI Mapper. Your sound resource won't be compatible with Adlib, MT-32, PC Speaker, etc if you choose this method.
+
<blockquote>
 +
=== Notes ===
  
 +
All the channels I've referenced here are the proper MIDI channel designations (1-16). SoundBox numbers them from 0-15 instead as a programmer would, so just be aware of that when you're creating your MIDI file and running it through SoundBox.
 +
</blockquote>
 
&nbsp;
 
&nbsp;
  
==Adding the Music/SoundFX Resource==
+
==<br /> Adding the Music/SoundFX Resource ==
  
 
'''''<span style="color:red">Note: this part is a stub. If you can help, please expand it.</span>'''''<br />
 
'''''<span style="color:red">Note: this part is a stub. If you can help, please expand it.</span>'''''<br />
Line 61: Line 103:
  
 
This does not take into account anything like loop points etc.
 
This does not take into account anything like loop points etc.
 +
 +
==<br /> Digital Sounds ==
 +
 +
Early SCI0 games did not make use of digital sounds. All sound effects were generated by MIDI. But as time went on Sierra started adding digital sounds to the SCI sound resources. Initially, these were appended onto a SOUND resource and played with the [[SoundBlaster]] driver. There is also a MTBLAST driver that will play both the MT-32 music as normal but also the appended PCM sample (if it exists) through the SB. Examples of the embedded PCM samples can be found in [[Space Quest III]] (Roger's "Where am I") and in later games such as [[King's Quest I SCI]] (castle gates closing) and [[Quest for Glory II]] (genie's laugh in the intro). Later on in SCI's life, digital sound became their own resource separate from the MIDI sound resources entirely and were stored in the RESOURCE.AUD file (or RESOURCE.SFX for CD games that had full speech).
 +
 +
<blockquote>
 +
=== AddWav ===
 +
 +
The [[SCI Audio Utilities#SCI Sound Tools Pack|AddWav]] utility can embed a digital sample in a SOUND resource to include in an SCI0 game. This method has some limitations. The WAV file must be 8-bit mono and the resulting sound resource must be no bigger than 65536 bytes. Also, the  game's configuration file (RESOURCE.CFG) must be set to either SNDBLAST.DRV or MTBLAST.DRV drivers for the digital sound to be played.
 +
 +
The [[SCI Audio Utilities#SCI Sound Utilities|SCI Sound Utilities]] includes a GUI interface for AddWav to simplify appending a PCM sample to a SOUND resource. It uses an empty SOUND file and will automatically downsample your WAV file to be small enough to embed. It can also do bulk processing of multiple PCM WAV files.
  
 
&nbsp;
 
&nbsp;
  
== See also ==
+
=== sciAudio ===
 +
 
 +
An add-on utility made by [[Gumby]] makes use of the Google app Narrate and SCI0's ability to output text to a file to be able to use external audio resources controlled by your SCI scripts. The [[SCI Audio Utilities#sciAudio|sciAudio]] app makes it easy to use a range of audio formats.
 +
</blockquote>
 +
 
 +
==<br /> See also ==
  
 
* [[How to keep your gTheSoundFX from interupting gTheMusic]]
 
* [[How to keep your gTheSoundFX from interupting gTheMusic]]
 
* [[SCI Specifications: Chapter 4 - The Sound subsystem|The SCI Sound Subsystem]]
 
* [[SCI Specifications: Chapter 4 - The Sound subsystem|The SCI Sound Subsystem]]
 
* [[SCI Audio Utilities]]
 
* [[SCI Audio Utilities]]
 +
* [[Music Devices]]
  
 
&nbsp;
 
&nbsp;
Line 75: Line 134:
 
<span style="float: right">[[SCI_Tutorials|Back to Tutorials Index &gt;]]</span>
 
<span style="float: right">[[SCI_Tutorials|Back to Tutorials Index &gt;]]</span>
  
&nbsp;
+
[[Category:Stub Pages]]
 
 
 
[[Category:Audio]]
 
[[Category:Audio]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Latest revision as of 15:50, 23 April 2024

Note: various tools for working with sound for SCI games can be found on the SCI Sound Utilities Page


By Brandon Blume


Introduction

What I've learned so far I've seen from opening up sound resources from Sierra games in SoundBox. A proper MIDI file engineered to run through SoundBox to create an SCI0 sound resource will not sound correct when played through a MIDI player because there are multiple copies of instruments on different channels to playback through the different sound drivers (ADL.DRV, STD.DRV, MT32.DRV, etc). Here are some guidelines I've learned.


Standard General MIDI Support

This is the MIDI support used in Jummybummy. NOTE: You cannot have digital sound effects with this method

You can completely ignore the huge guidelines list above if you go this method. It's actually very very simple. If you just want to run a General MIDI file through SoundBox you can do that instead and have it support General MIDI rather than PC Speaker, Adlib, Tandy, MT-32, etc.

Notes

You just need to make sure, however you play the game, that you're going to have a General MIDI device (whether physical or virtual) connected to the appropriate system MIDI output to be able to hear anything. So that's probably not going to work with Command Prompt in Win2k, XP, Vista, or 7. If you're using DOSBox you'd have to set up your DOSBox settings to point to the correct MIDI device on your system (or the MIDI Mapper). Your sound resource won't be compatible with Adlib, MT-32, PC Speaker, etc if you go with this method.


Classic Adlib/MT-32/PC Speaker/Tandy 3-voice Support

You can use the ADDWave.EXE program included in Ravi's Sound Utilities to append a digital sound file to a sound resource with this method and if you're using SNDBLAST.DRV or MTBLAST.DRV you will hear it in-game instead of the MIDI sound.


Common Details

  • You can use a single channel for multiple device outputs (MT-32, Adlib, Tandy, etc) and it will work on each device as long as the channel follows the rules for each device.
  • Most of the time the Adlib/FB-01/IMFC (and sometimes CMS) channels are the same as the MT-32 channels in Sierra games but there are exceptions. One being if an MT-32 channel has too many voices/notes playing at once for the FM devices. This means you'll have to either trim down the complexity of your MT-32 channels or you can duplicate that instrument in another channel and designate it as Adlib/FB-01/IMFC-only and engineer it to use less voices to stay under those devices' polyphony limits.
  • You can use any channel to output to any music device except the MT-32 (see below) and except for channel 16. Channel 16 is reserved for the SCI interpreter to read specific sound resource controller data from such as cues (for triggering scripted sequences) and loop points.
  • The Initial Voices field in SoundBox's Channel Properties dialogue window is meant only for FM devices (Adlib/FB-01/IMFC). It is ignored by all other devices.
  • Nobody is quite sure why, but channel 10 always has an Initial Voices setting of 128 in Sierra's sound resources. I recommend keeping it this way in all sound resources just in case it matters somewhere. Soundbox will also set this automatically when importing a standard MIDI file.


MT-32

  • All MT-32 MIDI data must be on channels 2-10 (10 being the drum channel).
  • The MT-32 has a technical timbre/voice polyphony limit of 32. But in practice, it's more like ~18-22. This is because many instruments use more voice polyphony in their timbres than others. Nevertheless, the MT-32 has the highest polyphony of any of the default supported music devices and you probably won't run into it. Though, it's not as a high as something that's General MIDI (a Sound Canvas, soundfont, or VSTi, for instance).
  • Channel 10 will always playback on the MT-32 regardless of whether it is set for it or not.


FM Devices

(Adlib/Sound Blaster & Yamaha FB-01/IMFC)

  • In SCI, Adlib does not have rhythm/drum voices (even though Adlib does support it) because of the way Sierra chose to implement it. So channel 10, while usually being the standard drum channel of most MIDI devices, is a melodic channel for Adlib and not actually a drum channel. As a result, it's not recommended to set channel 10 as an Adlib channel because that's the MT-32's drum channel, and as pointed out above, anything on channel 10 will playback on the MT-32 regardless of the device designation set by the user.
  • Adlib and Yamaha each have a maximum limit of 8 voices in SCI. For Adlib that means 8 notes at a time. But for Yamaha that can be more complex as multiple voices can be used for one instrument. This doesn't just work out of the box like the non-FM devices, though. Each Adlib and Yamaha channel must have their Initial Voices fields set in the Channel Properties dialogue window or no sound will be heard at all in-game. You can change the number of voices at any point in the song by adding voice control changes in the same dialogue by inputting the number of ticks the command is to take place and the value (number of voices). But it must add up to 8 in total at any one time across all channels. So you have to compose those channels in such a way that there are never more than 8 voices playing at the same time otherwise notes will be cut off by the most recent notes if the limit is reached. This can make for a very sub-par listening experience.
  • In Adlib's case, the above rules only apply when using the ADL driver which was designed for the OPL2 chip (which is also mono). If you use the SCI0 SNDBLAST driver instead which is designed for the superior OPL3 chip you will have a much higher voice limit (16 instead of 8!) and it ignores the "initial voices" and voice controller data. Instead it simply plays as many voices as it can, prioritizing the most recent notes if necessary. It will also respect panning and thus you'll get stereo Adlib!
  • OPL2 actually natively supports 9 voices (as well, OPL3 supports 18) but in SCI it only supports 8. I surmise that this must be somehow due to the fact that Adlib support is limited to melodic instruments as opposed to rhythm/percussion. Usually in Adlib 6 voices are reserved for melodic and 3 for rhythm.


CMS/Game Blaster

  • The CMS/Game Blaster device can generate a maximum of 12 voices at a time, but will likely never use more than 8. This is because CMS can only use the same channels designated for Adlib and just plays as many voices as it can. There is no way to designate channels for CMS independent of Adlib in SCI0. SCI1 can, but that's a different animal altogether.
  • OUTDATED: Currently there's no way to create CMS instrument patch banks. Its patch file (PATCH.101) is the least complex of the supported devices and is likely easy to reverse engineer. So that might be possible to target as a supported device in the future!
  • UPDATED: With some help by NewRisingSun pointing me in the right direction, I've determined that the PATCH.101 instrument file for CMS is actually in the same format as the PRESET.PST file that is generated by DEFINST.COM (located on the "Master" floppy disk that comes with the CMS/Game Blaster) except that PRESET.PST contains only 32 instrument definitions and PATCH.101 contains 96 (3 sets of a full PRESET.PST instrument definition bank, if you will). The only other difference is that PATCH.101's first 32 bytes are reserved for SCI resource header information:
  1. 2 bytes: SCI resource type identifier (89h 00h)
  2. 2 bytes: The characters "CT" (43h 54h) - I don't know what this means yet, if anything.
  3. 28 bytes: Game title, usually in all caps - I'm not sure what this is for either as it is not displayed anywhere when loaded in-game that I'm aware of. Perhaps it was useful for the composer or programmer for organizing instrument banks for different games. Not sure why other SCI patch resources don't contain the game title though (besides the MT-32, which displays text on its LCD display).
  • Because of the above, we can easily create CMS patch banks for SCI by utilizing the pre-existing DEFINST.COM program from the CMS's "Master" floppy disk. One need only use it 3 times to define instruments, renaming PRESET.PST to another filename each time. Then a hex editor can be used to combine the files into one along with the necessary SCI header information at the start of the file. It would be trivial to write a CLI program to accomplish this and I plan to do so in the near future.
  • Stereo is supported but with only 3 settings of panning: Center, 100% left, or 100% right. I believe the panning output is determined by the average of whatever the channel's panning is set to (ie- 0-50% panned right = Ctr, 51%-100% panned right == hard pan R).


Tandy 3-Voice

  • Like the PC Speaker, Tandy channels can only have one voice playing at a time. Doubled up notes in the same channel will be cut off by the most recent notes if the limit is reached.
  • A good trick is setting one of the three Tandy channels to double as PC Speaker to save on channel consumption. The other two channels can be any you want (but channel 10 is not recommended for the same reason as Adlib/Yamaha).
  • Though it does not have a corresponding PATCH resource, Tandy "instruments" can indeed be defined. The SN76489/SN76496 chip that the Tandy uses is basically just a tone generator. But each channel does have a volume control that can be manipulated over time. This can be utilized by a driver to set volume envelopes for each channel (think of chip trackers like Furnace and how it defines instruments for the SN76489 chip). BUILDTDY is one of the leaked Sierra tools in the past few years and is designed to create these envelopes. It then allows you to load in a Tandy driver and builds the envelopes you've defined into the driver itself like instrument patches. This may only work for SCI1 game drivers though. I've found that at least one of the older Tandy drivers for SCI0 (including JR.DRV, for the near identical IBM PCjr sound device) is not compatible with BUILDTDY. Further experimentation is warranted here.
  • Tandy 3-voice actually supports a sort of 4th channel in the form of a 3-pitch (low, mid, and high) noise channel which also can have a volume envelope (and a different one for each pitch!). AGI uses this extensively in its sounds such as the crashing waves in KQ2, the Arcada doors in SQ1, or the gunshots in the intro of PQ1. But sadly SCI does not. :(


PC Speaker

  • The PC Speaker channel cannot have more than one note playing at a time. Overlapping notes will be cut off by the most recent note.
  • Musically speaking, the PC Speaker channel should carry the fundamental of the theme of the sound file. The lead melody, if you will. Ideally it would contain everything that makes the theme recognizable. You can make this an alternate channel (instead of doubling up with an Adlib or MT-32 channel, for instance) and rework it so it efficiently contains both lead and accompanying melodic (and even sometimes percussive) notes. Think of how SCUMM games sound in PC Speaker where there's never more than 1 note playing at a time but you can hear lead and melodic elements both playing (what seems to be) "simultaneously". Though difficult, it's possible to match this type of sound with some savvy knowhow and technical arranging of the MIDI notes in a sequencer or DAW. However, it can certainly be a difficult process to master and requires a lot of careful planning, skill, and patience.


Notes

All the channels I've referenced here are the proper MIDI channel designations (1-16). SoundBox numbers them from 0-15 instead as a programmer would, so just be aware of that when you're creating your MIDI file and running it through SoundBox.

 


Adding the Music/SoundFX Resource

Note: this part is a stub. If you can help, please expand it.
 

To insert/import a sound resource into a game and utilize it after creating it and after you have your midi and ran it through Soundbox, you should have a SOUND.000 file. Using either Studio or Companion use the "Add resource" and select the new resource. Save the resource as whatever number you want. Use it in your game with gTheMusic, gTheSoundFX, or a sound instance of your own creation.

Code:
(send gTheSoundFX:number(XXX)loop(1)play())


This does not take into account anything like loop points etc.


Digital Sounds

Early SCI0 games did not make use of digital sounds. All sound effects were generated by MIDI. But as time went on Sierra started adding digital sounds to the SCI sound resources. Initially, these were appended onto a SOUND resource and played with the SoundBlaster driver. There is also a MTBLAST driver that will play both the MT-32 music as normal but also the appended PCM sample (if it exists) through the SB. Examples of the embedded PCM samples can be found in Space Quest III (Roger's "Where am I") and in later games such as King's Quest I SCI (castle gates closing) and Quest for Glory II (genie's laugh in the intro). Later on in SCI's life, digital sound became their own resource separate from the MIDI sound resources entirely and were stored in the RESOURCE.AUD file (or RESOURCE.SFX for CD games that had full speech).

AddWav

The AddWav utility can embed a digital sample in a SOUND resource to include in an SCI0 game. This method has some limitations. The WAV file must be 8-bit mono and the resulting sound resource must be no bigger than 65536 bytes. Also, the game's configuration file (RESOURCE.CFG) must be set to either SNDBLAST.DRV or MTBLAST.DRV drivers for the digital sound to be played.

The SCI Sound Utilities includes a GUI interface for AddWav to simplify appending a PCM sample to a SOUND resource. It uses an empty SOUND file and will automatically downsample your WAV file to be small enough to embed. It can also do bulk processing of multiple PCM WAV files.

 

sciAudio

An add-on utility made by Gumby makes use of the Google app Narrate and SCI0's ability to output text to a file to be able to use external audio resources controlled by your SCI scripts. The sciAudio app makes it easy to use a range of audio formats.


See also

 

< Previous: Cloudee1's SCI Point and Click Tutorial Back to Tutorials Index >