In this tutorial I will explain how to add a background music in your custom map.
- Step 1: Create new package and import your own music
Make sure your audio track is a .wav file:
Now open the Editor and then the Generic Browser.
At the top click "File > New..." and then fill the following fields as shown:
N.B.: "MyMusic; MyAudioPackage; etc" are only examples.
N.B.2: Make sure there aren't spaces or special characters in the fields or it will not work.
Find your new package in the generic browser and select.
As you can see you have a new element called SoundCue that will allow you to hear the music in the level.
Now you have to import your audio file.
So right click on your package "MyAudioPackage" (or Group if you have already created one, like in my case "MySounds") and choose "Import..."
Browse for your file and open.
You will see this window again:
Name the object how do you want, but I recommend to name it with the same name of the Cue to avoid mistakes.
Remember, no spaces or special characters.
If you did all right you will see this final result:
To switch from Unconverted to Stereo just double click or "right click > Play" "MyMusic" (dark blue) and then you will hear your music (this means that is alright) then "right click > Stop" to stop the sound.
- Step 2: Building the SoundCue
Right click on the "MyMusic" Cue (sky blue) and select "SoundCue Editor"
You will see a new window with a speaker on the left.
Right to it, right click and select "Attenuation" then go to Generic Browser (but don't close the SoundCue editor) and select (select only) the MyMusic sound (dark blue) and go back to SoundCue editor.
Right click again and you will see that a new option appears, the first one: "SoundNodeWave: MyMusic"
Now link "the speaker" to "Attenuation" and "Attenuation" to "MyMusic"
Your result will looks like this one:
Make sure the sound plays by double clicking the "MyMusic" SoundCue in the Generic Browser.
If it plays, you did it right.
- Step 3: Building the Kismet
Open the UnrealKismet and place this objects that I say:
Right click > New Event > Level Beginning
Right click > New Action > Sound > Play Sound
Left click "Play Sound" (it will appear with yellow edges) and you will see his properties on the bottom.
You have to assign to the "PlaySound" line the SoundCue you created in the step 2.
So, go to the Generic Browser without closing UnrealKismet and select the SoundCue, go back to Kismet and click the green arrow.
If you did it right, you will see this result:
The last thing you have to do is link "Level Beginning|Out" to "Play Sound|Play"
P.S.: If you want a loop you have to link "Play Sound|Finished" to "PlaySound|Play"
Test your level and enjoy :)
Warning: Don't forget to save your package to /Published/CookedPC or you will lose your data!
- S1y 13:34, July 20, 2010 (UTC)