The Windows version of AGS supports all DirectX-compatible sound cards. The DOS version of AGS supports Adlib, Sound Blaster and General MIDI for background music, and it supports the Sound Blaster and ESS Audiodrive for sound effects.
For background music, AGS can use MP3, MIDI, WAV, MOD, XM, and S3M music files. For sound effects, you can use MP3, WAV and VOC files. When AGS needs to play music number X, it will search for the files in the following order. The first file it finds, it plays: MUSICx.MP3, MUSICx.WAV, MUSICx,MID, MUSICx.MOD, MUSICx.XM, MUSICx.S3M.
When the game loads, music 0 will be played if it exists in the game directory. You can change the music later by setting "Play music on room load" in a room, by using the PlayMusic text script command, or by using the "Play sound" interaction command. If you use the interaction command, you must add 1000 to the music number so that AGS recognises it as music and not a sound effect. For example, to play music 23, use "Play sound 1023".
To play a sound effect during the game, you can use the PlaySound text script command, or the "Play sound" interaction command. The game will search for SOUNDx.MP3, SOUNDx.WAV and SOUNDx.VOC, where X is the sound number.
NOTE: MP3 music files are not included in the game EXE, but can be bundled seperately as a single data file. See here for more information.
NOTE: The Adlib sound card only supports MIDI music. It cannot play sound effects, or MOD, XM or MP3 music.
ego: "Hi! How are you?" david: "I'm fine."Normally this would display the words in the speech text above the characters heads. However, you can add the special character '&' to symbolise that a voice file should also be played. The file name is made up of the first four letters of the character's script name, then an ID number. For example,
ego: &10 "Hi! How are you?" david: &7 "I'm fine."This would play EGO10.WAV with the first line, and DAVI7.WAV with the second. When a line of text has a voice linked to it, the text on the screen will not be removed until the voice file has finished playing. If the player interrupts it by clicking the mouse or pressing a key, the text and voice will be stopped.
You can also use speech with DisplaySpeech text script function.
DisplaySpeech (EGO, "&10 Hi! How are you?"); DisplaySpeech (DAVID, "&7 I'm fine.");NOTE: WAV and MP3 format files can be used for speech.
If you add or update any voice files, you need to click the "Rebuild VOX files" option on the Game menu of the AGS Editor, which will combine them into the speech file used in the game. This file is called SPEECH.VOX and is seperate from the rest of your game data so that you can offer it as an optional extra download to the player. The game will function correctly if the file is not present.
SeeAlso: SetVoiceMode text script function.