Importing Custom Sounds
Thanks in advance!
- First, get the sound that you want. If the sound is already a .wav file and has a rate of 44100 HZ, skip to step 4.
- Load the sound in audacity (free program, download here http://audacity.sourceforge.net/download/ ) and change rate to 44100 HZ.
- Export as a .wav file.
- Open up your portal 2 directory, go to sounds, and then make a folder called "custom" without the quotes, (or whatever name you want.) Stick the sound file in there.
- Open hammer editor, open your map, and make an ambient_generic with a trigger to make it play the sound.
- Go to the ambient generic, sound name property, and then it's either under raw or game sounds, (I can't remember.) Set the filter to "custom" without the quotes, (or whatever you called the folder,) and hit refresh sounds.
- Select your sound, listen to it to make sure it works and is the right one, and apply the changes. Compile your map.
- Launch Portal 2.
- Launch your map.
- Type in console "snd_rebuildsoundcache" without the quotes. Every time you add a new sound to Portal 2, you must do this. (So if you're planning on adding a bunch of sounds, put them all into the sounds folder, then run this command, instead of doing it for every single sound. It takes a few minutes.)
- Wait for it to complete.
- Your map will restart, and you custom sound should work!
I'm not a pro mapper, so if anyone finds something wrong with this tutorial, please say so. It should work though. Tell me how it turns out!
If you would use the snd_rebuildsoundcache, you would have to do it every time again for a new sound and it wouldn't help if you want to share the map, because others won't have a rebuilded cache.
Use VPKs instead.
Read this: http://developer.valvesoftware.com/wiki ... rtal_2_Map
Now just pack your custom sounds into the VPK, keep the folder structure, and put your VPK to portal 2\portal2\addons\
If any new sound file is in a VPK, the game won't need any cache rebuilding and you can give anyone this VPK (in the final version with your map included) and everyone will hear the sounds by just starting the map
Anyhow, thanks Skotty for offering a better way to do it. I'll look forward to hearing your beautiful voice TripleG10!
I thought anyone here agreed that .vpks were broken in Portal 2 since the appearance of DLC1. So it is impossible to get it to work, isn't it?
I have no experience with implementing custom sounds, but I was gonna do this, and I thought the only possibility would be to use pakrat to pak them into your map and then command "snd_updateaudiocache" instead of "snd_rebuildsoundcache".
What you can do is create a portal 2/portal2_dlc3, name your vpk pak01_dir.vpk and put it in there.
Note it needs to be this folder and this file name.
Basically you're telling the game that there's new dlc 
Brainstone wrote:
Wait, wait, wait!I thought anyone here agreed that .vpks were broken in Portal 2 since the appearance of DLC1. So it is impossible to get it to work, isn't it?
I have no experience with implementing custom sounds, but I was gonna do this, and I thought the only possibility would be to use pakrat to pak them into your map and then command "snd_updateaudiocache" instead of "snd_rebuildsoundcache".
Note that this is a post from august 2011, before the dlc came out.
@Fracture:
The problem is with sounds in a bsp you need to rebuild the audio cache, if you would have read the previous posts you would've known.
Ps: Why are you bumping a thread from august 2011?
Lpfreaky90 wrote:
The problem is with sounds in a bsp you need to rebuild the audio cache
Well, I must say something has changed.
In my last map Hard Light I used some Portal 1 glados lines. May be there is a better way, but I used it as custom
sounds (extracted .waw files from portal 1 .gcf, placed them in portal2/sound/hard_light). Hammer finds and
playes them ok, but in game I couldn't hear them until I packed them into .bsp with Pakrat. So I didn't rebuiled
sound cash (I just didn't know I should) and I don't think anyone who played the map did it, but the lines played for them allright.
But I never tested this.
greykarel wrote:
Lpfreaky90 wrote:The problem is with sounds in a bsp you need to rebuild the audio cache
Well, I must say something has changed.
In my last map Hard Light I used some Portal 1 glados lines. May be there is a better way, but I used it as custom
sounds (extracted .waw files from portal 1 .gcf, placed them in portal2/sound/hard_light). Hammer finds and
playes them ok, but in game I couldn't hear them until I packed them into .bsp with Pakrat. So I didn't rebuiled
sound cash (I just didn't know I should) and I don't think anyone who played the map did it, but the lines played for them allright.
I'm not entirely sure what the cache does, but if it says "this file is a song" it will still find the file, because it's still in the same (overwritten) location. If you add a new sound the cache needs to know which files are sounds again so you will need to re-build the cache.
I dont even know how to use VPK
https://developer.valvesoftware.com/wik ... ng_the_VPK
I dont understand what they want to me to do on number 2
Fracture wrote:
https://developer.valvesoftware.com/wiki/Releasing_A_Portal_2_Map#Creating_the_VPK
I dont understand what they want to me to do on number 2
simple if you want a texture, you place them in portal 2/portal2/materials/<>
If you want them in a vpk:
create a materials folder and then put the texture in the correct location
example:
portal 2/portal2/materials/lp/test.vmf should also go into
materials/lp/test.vmf in the vpk.
same for sounds
sounds/lp/test.wav should go to sounds/lp/test.wav in the vpk too.
&
pack it in the bsp. using pakrat or bspzip.