Difference between revisions of "Adding custom sounds and music"

From Serious Sam's Bogus Detour
Jump to: navigation, search
(Created page with "Adding in custom sounds and music to your scenarios requires the usage of '''.sbnk''' files. While your computer likely doesn't recognize this file type, it is really a glorif...")
(No difference)

Revision as of 14:08, 15 June 2017

Adding in custom sounds and music to your scenarios requires the usage of .sbnk files. While your computer likely doesn't recognize this file type, it is really a glorified text file and can be opened with any simple text editor, such as Notepad++.

The sound files themselves must be presented in the .ogg format. An audio editing program such as Audacity can convert most common audio filetypes into the .ogg format.

Exporting sound files to .ogg

If your sound file is not already in the .ogg format, follow these steps to do so. Using Audacity, drag the sound file of your choice into the gray area. If successful, you will see the audio channel appear. You may now edit the sound file if you wish, otherwise, click the "File" tab and then the "Export" button. As file type, select "Ogg Vorbis" and export it to anywhere in your scenario folder, preferablly a dedicated folder called "sound". Continue to do this for all the sound files you need.

Creating the .sbnk file

With all the .ogg files ready, you must now create an .sbnk file at which you can configure some parameters. Simply open a text editor like Notepad++, then copy this example code:

<soundbank>
	<sound category="sound" name="" volume="" is3d="" looping="">
		<source res="sound/MySound.ogg" />
	</sound>
</soundbank>

You can edit the following parameters:

- name: The name that the sound will appear in while using the editor.

- volume: The volume of the sound file. 1 is the standard volume, but you can only make it quieter.

- is3d: boolean. If set to true, the sound will only play in an area around the PlaySound WorldScript that it is assigned to. If false, it will play across the entire level.

- looping: boolean. If set to true, the sound file will keep playing everytime it finishes. If false, it will only play once.

If you wish to add in more sound files, simply copy and paste the <sound> parameters and edit them accordingly. You can use as many as needed. When done, save the file as .sbnk.

Using the sound files in the editor

Open up a level, and navigate to the WorldScripts tab. Spawn in a PlaySound WorldScript. Select it, then in the "Sound" parameter, type in the name of your .sbnk file, or the name you gave the sound, and it will show up.

You can do the same for the PlayMusic WorldScript.