custom sounds in portal 2

Avatar
blackdynamite
2 Posts
Posted Mar 16, 2013
when trying to get my sound files into the game i can listen to them in the preview but once ingame the won't start any idea why?
Advertisement
Registered users don’t see ads! Register now!
Avatar
CamBen
973 Posts
Posted Mar 16, 2013
Replied 34 minutes later
You need to type snd_rebuildaudiocache into the console, then the sounds should play.
Avatar
blackdynamite
2 Posts
Posted Mar 16, 2013
Replied 1 hour later
thanks for the quick response and thanks for the help.
Avatar
zivi7
649 Posts
Posted Mar 16, 2013
Replied 2 hours later
But this is a bad solution for the final map. You would need to have a client command execute the rebuild for the player - with the bad downside that this can appearantly break the menu. At least that's what happened when I tried it this way: people couldn't use the menu anymore, thus the only way to close the game was CTRL+ALT+DEL.

Instead, use a MP3 with 44100 khz and 128 bit (as Damagepy described here). They might not work in Hammer and they won't work ingame unless you pack them into the .bsp - but they are small and don't require the cache rebuild.

Avatar
CamBen
973 Posts
Posted Mar 17, 2013
Replied 5 hours later
I've found that maps with custom sound packed as wavs tend to automatically update my soundcache as soon as they are downloaded from the workshop,but that may not be universal in portal2 I guess...

Well, that solution sounds like it works well anyway.

Avatar
Lpfreaky90
2,842 Posts
Posted Mar 17, 2013
Replied 1 hour later

CamBen wrote:
I've found that maps with custom sound packed as wavs tend to automatically update my soundcache as soon as they are downloaded from the workshop,but that may not be universal in portal2 I guess...

Well, that solution sounds like it works well anyway.

The biggest problem is coop maps. Zivi and I messed around with this a lot whilst testing with Aperture Valentine. It often caused disconnections and other stuff. I even managed to disconnect from myself in a splitscreen game because I had to rebuild it twice. Just putting in an mp3 to the bsp (with the proper properties) is much easier and reliable for the players!

Avatar
greykarel
225 Posts
Posted Mar 17, 2013
Replied 6 hours later

zivi7 wrote:
use a MP3 with 44100 khz and 128 bit

As far as I know MP3 files don't support cue points and therefore cannot be looped automaticly. Or am I wrong?

Avatar
zivi7
649 Posts
Posted Mar 17, 2013
Replied 5 hours later

greykarel wrote:
As far as I know MP3 files don't support cue points and therefore cannot be looped automaticly. Or am I wrong?

I didn't try it myself, but I've read everywhere that looping mp3s won't work for that reason indeed.

For a work-around you could try having a logic_timer retrigger the mp3 after it has been played.

Avatar
greykarel
225 Posts
Posted Mar 18, 2013
Replied 13 hours later
I've spent much time making my custom background music work properly. I don't feel like using a timer for looping the sound and therefore prefer looped .wav files. To reduce file size some audio editors let you save your .wav file with different codec though some of them may not work in game. I used GoldWave to set cue points for looping and with different codecs managed to keep a reasonable file size (about 8-10MB instead of original 40-50MB). The only condition is 44100 khz.
Now if you pack your files into .bsp no one will have to update audio cash to hear sound in game. I can say it for sure for single player at least.
Avatar
CamBen
973 Posts
Posted Mar 19, 2013
Replied 18 hours later

greykarel wrote:
Now if you pack your files into .bsp no one will have to update audio cash to hear sound in game. I can say it for sure for single player at least.

Yes, this is what I was saying. I've packed custom sound effects into maps before, and they seem to work.

Advertisement
Registered users don’t see ads! Register now!
Avatar
Naulziator
104 Posts
Posted Mar 19, 2013
Replied 19 hours later
I tried something like this before, but it's too long for me to remember any of it. Looping sounds can be a pain since you're limited to cheaper sound editors. A few of my songs from Portal 1 played nicely in MP3 format, but I think even I had a hard time with them on Portal 2. I really want to get back into some new songs as of late, and some looping ones would work great here.

I'm using Studio One now, but I still have my almighty Korg Extreme...