Saturday, October 19, 2013

UDK Sound

UDK Sound

September 19th, 2013

There are 3 types of sound in UDK:
1. Area sound effects
2. Sound effects that are a result of something the player does
3. Ambient Music

In this tutorial I will cover all three of these and explain how to implement them (I am learning as I go here).


The first thing you need to do is to convert your sound into something UDK can use.

Here are the recommended specs:
1. 16 bit
2. 44100 Hz.
3. wav file

You can find a ton of detail on that here:

There are a lot of solutions to convert sounds. Since I don't plan to make any money for the time being on what I am building I will use wavepad to covert sound files. It doesn't come with any crapware in the install which is a plus in my book.

1. Install & Open wavepad. You don't need any of the extras.

2. Open the batch converter by selecting Tools : Batch Converter...

3. Add your files/folders

4. I'm not positive this is necessary but I picked "Convert Sample Rate" and make sure it was 44100Hz.

5. Select "convert to file format" and pick ".wav". Then in the format options pick "Custom" and select "44100 Hz, 16bits, Stereo".
6. If you don't want to overwrite the original sound files pick a different folder.
7. Press "Next" and you are done.


This is really simple. Just right click in the content browser in UDK and import the sound. You probably want a folder dedicated to sounds within the content browser.


This type of sound is placed in your level and has a radius. You can control the radius, volume and drop off. You just need to drag the sound into your level and then you can adjust it.

For my level a part of it takes place 20+ stories in the air. I wanted the ambient sound of wind blowing at the top 5 stories. This required me to place multiple instances of the wind effect at the top so that no matter where the player went at the top of the level they would hear wind.


If you want a different sound based on where the player is walking the solution requires a bit more effort. There are several parts to doing this right:
1. changing your game type so you can actually hear sound from meshes you walk on
2. hiding the gun & hud (unless you want that stuff)
3. mapping a physical material with mapped sound to your UV material

Special thanks to this forum entry. It covered the gun/hud disable perfectly.

Changing your game type:
You need to switch your game type to utgame making it an unreal tournament game. This causes surfaces to generate sound when a player steps on them. 

1. Go to "View : World Properties".

 2. Within "Game Type" change the "Default Game Type" to utgame.

hiding the gun
To hide the gun you give the player no inventory. To hide the hud you need to do a bit of kismet.

1. Go to "View : World Properties" (see above)
2. Within "World Info" check "No Default Inventory For Player"

hiding the hud
1. Open UnrealKismet (the green K icon at the top on UDK)
2. Right click in kismet workspace
3. Select "New Event : Level Loaded".
4. Right click in kismet workspace
5. Select "New Action : Toggle : Toggle HUD"
6. Drag a wire from "Level Loaded : Beginning of Level" to "Toggle HUD : Hide"
7. Right click in kismet workspace
8. Select "New Variable : Player : Player"
9. Drag a wire from "Toggle HUD : Target (bottom)" to "Player"
When you are done it should look like this:

Mapping a physical material with mapped sound to your UV material
Finally, we need to associate a sound emitting physical material with your texture material that is on your mesh. This was a revelation to me. I had no idea there was such a thing as a physical material. This is a material that works with Unreal's PhysX physics engine. In this case the material is recognized by the game to produce a sound.

1. Open your texture material
2. Open the Physical Material section (see below)

3. Find an existing Physical Material for demonstration purposes
To keep things simple lets use a physical material that already exists: ph_metal. Open the content browser, select the UDKGame package and search for metal. Scroll down until you find PM_Metal. Note the PM prefix. This is telling you it is a Physical Material. Select the material

4. Click the Green Arrow to the right of the "Phys Material" property and voila. You have a texture material that will emit a metal sound when you walk on it.

Stay tuned for more...

No comments:

Post a Comment