Packing Soundscapes

Avatar
Tmast98
210 Posts
Posted Oct 14, 2013
Replied 53 minutes later

TheTobbell wrote:
Tmast98 wrote:

Scripts in general

Really? I thought Scripts are not packable, for example the scripts for the elevators, or are just some of them not working when the map is uploaded on the workshop?

I can guarantee they do work. It's just the dlc2 folder overwrites the other scripts if they share the same name (like the elevator script), so in some cases you have to save them under different names if they don't work. I use a script in a map I'm working on to change cube model's, but keep their properties for example.

Advertisement
Registered users don't see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted Oct 14, 2013
Replied 1 hour later
Specifically, any file in a VPK has highest priority. Most people consider this a bug, as it breaks the old way of using skins and model replacements and so forth, but there you have it. It used to be possible to distribute a VPK as an "addon", which Omni did for Retrospective (note the custom video_splitter.nut), but DLC1 broke that too.

Now the only ways to override files in a VPK are:
1) Make your own VPK, make it an addon, and hope that your players will know the fake-sourcemod workaround. Not many people have used this approach.
2) Make your own VPK and release it as dlc3. A few mods have used this approach, but only one will work at a time, so this is best for big mods (in between normal map packs and full sourcemods).

To make a VPK, drag and drop a folder onto /bin/vpk.exe or launch it from the command line.

Avatar
HMW
806 Posts
Posted Oct 15, 2013
Replied 12 hours later

Tmast98 wrote:
HMW wrote:

So can you pack soundscripts in a BSP? (As in, compatible with the workshop.) I have tried it in the past but could not get it to work... Maybe I missed something obvious.

Yup I did, do you set the search filter to all files when packing, and not all valid pak files?

Hmmm... I definitely need to try that again. In a previous attempt at getting this to work, I only packed one of the manifest files. (I don't remember which one.) Maybe that was the problem.

Avatar
Tmast98
210 Posts
Posted Oct 15, 2013
Replied 1 hour later

HMW wrote:
Tmast98 wrote:

HMW wrote:

So can you pack soundscripts in a BSP? (As in, compatible with the workshop.) I have tried it in the past but could not get it to work... Maybe I missed something obvious.

Yup I did, do you set the search filter to all files when packing, and not all valid pak files?

Hmmm... I definitely need to try that again. In a previous attempt at getting this to work, I only packed one of the manifest files. (I don't remember which one.) Maybe that was the problem.

Did you update and pack both the one in Portal 2 and DLC1? Those are the two I packed (as well as my soundscript.txt) to get it working.

Avatar
HMW
806 Posts
Posted Oct 15, 2013
Replied 6 hours later
So I spent some more time horsing around with those manifest files, to no avail. I followed your advice of packing both the base and DLC1 files, but that didn't work either. (Wouldn't they get the same internal path inside the BSP anyway?)

As is often the case, the real problem turned out to be something completely different:

When using custom soundscripts, you do indeed need to pack both the script file itself and the manifest. (I took the one from DLC2 as it has the most entries, and added my stuff to the end.)

After the map starts, you then have to reset the sound system with this console command:

sv_soundemitter_flush

This can be done with a logic_auto and a point_servercommand. It causes the game to re-read the manifest file and reload all of the soundscripts. Since your map is now loaded, its custom version of game_sounds_manifest.txt is visible in the virtual file system, so it will load your custom sounds in addition to the normal ones.

I don't see this documented anywhere on the wiki, so this may be just as much of a WTF revellation to anyone as it is to me. Or, maybe this is completely old news to any of you who are used to working with the sound system, in which case can someone please tell me how hard I should be slamming my head into the desk....

Avatar
josepezdj
2,386 Posts
Posted Oct 16, 2013
Replied 14 hours later

HMW wrote:
After the map starts, you then have to reset the sound system with this console command:

sv_soundemitter_flush
This can be done with a logic_auto and a point_servercommand.

WOW, that was an awesome find!

@Tmast: are you completely sure you actually made this to work? did you remove the local files once you pakrated them, and restarted the game? (this is how it should be done to be completely sure).

Avatar
Tmast98
210 Posts
Posted Oct 16, 2013
Replied 10 hours later

josepezdj wrote:
HMW wrote:

After the map starts, you then have to reset the sound system with this console command:

sv_soundemitter_flush
This can be done with a logic_auto and a point_servercommand.

WOW, that was an awesome find!

@Tmast: are you completely sure you actually made this to work? did you remove the local files once you pakrated them, and restarted the game? (this is how it should be done to be completely sure).

Yeah, I'm referring to the one map you know I am . You can hear them in the map already.

What I did was add the new .txt file to both the dlc1 and the portal2 soundscript manifest, and packed both manifests and the new soundscript file into the .bsp via pakrat, and it works perfectly for me and other people who have played it .

Avatar
Gemarakup
1,183 Posts
Posted Oct 17, 2013
Replied 19 hours later
I tried that command, but I can't get my custom sound in my soundscape working.
Avatar
HMW
806 Posts
Posted Oct 19, 2013
Replied 1 day later

yishbarr wrote:
I tried that command, but I can't get my custom sound in my soundscape working.

Yeah we got a bit derailed; the above is about soundscripts, which are somewhat different from soundscapes. For the latter, you should name your soundscape file with a map-specific name, as ChickenMobile explained:

ChickenMobile wrote:
Soundscapes are one of things that will work when packed.

they should be under /scripts and be named relative to the name of your map.
e.g. scripts/soundscapes_mapname.txt

I know this because I used custom soundscapes for rattmann returns.

Tmast98 wrote:
Yeah, I'm referring to the one map you know I am . You can hear them in the map already.

What I did was add the new .txt file to both the dlc1 and the portal2 soundscript manifest, and packed both manifests and the new soundscript file into the .bsp via pakrat, and it works perfectly for me and other people who have played it .

Have you published that map yet? If not, can we see it please? I'm really curious how you managed to pack both manifest files and have the game read them.

Avatar
Tmast98
210 Posts
Posted Oct 19, 2013
Replied 2 hours later

HMW wrote:
yishbarr wrote:

I tried that command, but I can't get my custom sound in my soundscape working.

Yeah we got a bit derailed; the above is about soundscripts, which are somewhat different from soundscapes. For the latter, you should name your soundscape file with a map-specific name, as ChickenMobile explained:
ChickenMobile wrote:

Soundscapes are one of things that will work when packed.

they should be under /scripts and be named relative to the name of your map.
e.g. scripts/soundscapes_mapname.txt

I know this because I used custom soundscapes for rattmann returns.

Tmast98 wrote:

Yeah, I'm referring to the one map you know I am . You can hear them in the map already.

What I did was add the new .txt file to both the dlc1 and the portal2 soundscript manifest, and packed both manifests and the new soundscript file into the .bsp via pakrat, and it works perfectly for me and other people who have played it .

Have you published that map yet? If not, can we see it please? I'm really curious how you managed to pack both manifest files and have the game read them.

I was not planning on releasing any information on this map for another two weeks. If I release a teaser image of it now, you won't be to play it. Are you okay with that?

EDIT: If you want to see the exacts though send me a private message, I can better help you there so I don't spoil the map .

Avatar
HMW
806 Posts
Posted Oct 20, 2013
Replied 19 hours later
Oh, it's OK if you want to keep the map secret, I can respect that.

There's no hurry since I got a working solution right now (the console command mentioned above); I was just curious about the science behind your multi-manifest file method

I'll just be patient and wait until you release your map, and have a look at it then.

Avatar
Tmast98
210 Posts
Posted Oct 20, 2013
Replied 2 hours later

HMW wrote:
Oh, it's OK if you want to keep the map secret, I can respect that.

There's no hurry since I got a working solution right now (the console command mentioned above); I was just curious about the science behind your multi-manifest file method

I'll just be patient and wait until you release your map, and have a look at it then.

Alright, I think Jose was actually investigating why it works now anyways, looking at the custom files for the map .

Expect a teaser image really soon though....hopefully by the end of this week! To be honest some images are ready, I', just paranoid about sharing to early .

Avatar
Gemarakup
1,183 Posts
Posted Oct 20, 2013
Replied 51 minutes later
I changed the soundscape file to soundscapes_<mapname>.txt but the custom sound still doesn't work. The stock sound that's in it does though.
Avatar
Tmast98
210 Posts
Posted Oct 20, 2013
Replied 1 hour later

yishbarr wrote:
I changed the soundscape file to soundscapes_.txt but the custom sound still doesn't work. The stock sound that's in it does though.

Ok, so what you should do now is have a soundscape name in that file, for example it may look like:```
"sndsc_ct_spawn_01"
{
   "fadetime" "0.75"
   "dsp"   "1"

   "playlooping"
   {
      "volume"      ".4"
      "pitch"      "100"
      "wave"      "ambient\atmosphere\office_outside_tone_01.wav"
   }

   "playlooping"
   {
      "volume"      ".1"
      "pitch"      "100"
      "wave"      "ambient\atmosphere\mountain_wind_lp_01.wav"
   }

   "playrandom"
   {
      "time"      "21,35"
      "volume"   "0.05,0.1"
      "pitch"      "95,100"
      "position"   "random"

"rndwave"
      {
         "wave"   "ambient\animal\hawk_01.wav"
         "wave"   "ambient\animal\hawk_02.wav"
         "wave"   "ambient\animal\hawk_03.wav"
         "wave"   "ambient\animal\hawk_04.wav"
         "wave"   "ambient\animal\hawk_05.wav"
         "wave"   "ambient\animal\hawk_06.wav"
      }
   }

   "playrandom"
   {
      "time"      "5,13"
      "volume"   "0.05,0.15"
      "pitch"      "95,100"
      "position"   "random"

"rndwave"
      {
         "wave"   "ambient\wind\css15_wind_01.wav"
         "wave"   "ambient\wind\css15_wind_02.wav"
         "wave"   "ambient\wind\css15_wind_03.wav"
         "wave"   "ambient\wind\css15_wind_04.wav"
         "wave"   "ambient\wind\css15_wind_05.wav"
         "wave"   "ambient\wind\css15_wind_06.wav"
         "wave"   "ambient\wind\css15_wind_07.wav"
         "wave"   "ambient\wind\css15_wind_08.wav"
         "wave"   "ambient\wind\css15_wind_09.wav"
         "wave"   "ambient\wind\css15_wind_10.wav"
      }
   }
}
```

Where sndsc_ct_spawn_01 is the name of the soundscape you would put in the map. Then add the name of the actual file, not the soundscape name, into the manifest for soundscapes in portal2/scripts and dlc1/scripts.

Hope that helps you out!

Avatar
Gemarakup
1,183 Posts
Posted Oct 20, 2013
Replied 56 minutes later
Yeah, that's what I originally did. But the custom sound won't play, and the STOCK sound DOES play. I already tried rebuilding audio cache countless times.
Avatar
Tmast98
210 Posts
Posted Oct 20, 2013
Replied 1 minutes later

yishbarr wrote:
Yeah, that's what I originally did. But the custom sound won't play, and the STOCK sound DOES play. I already tried rebuilding audio cache countless times.

Can you give the path of your custom sound? My custom ones were under sound/ambient

Avatar
Gemarakup
1,183 Posts
Posted Oct 21, 2013
Replied 11 hours later
My custom sound is in sound/ambient/water.
Avatar
Tmast98
210 Posts
Posted Oct 21, 2013
Replied 19 minutes later

yishbarr wrote:
My custom sound is in sound/ambient/water.

Ah okay, they're in the right place then. Are they in a format that Portal 2 recognizes. I don't know it exactly but I heard it was so many hertz.....

Avatar
Gemarakup
1,183 Posts
Posted Oct 21, 2013
Replied 47 minutes later
Another thing is that in Portal 2, when I entered the soundscape, the sound worked but I forgot to loop it so it worked for a few seconds. Now that I looped it with a program, it doesn't work.
Advertisement
Registered users don't see ads! Register now!
Avatar
FelixGriffin
2,680 Posts
Posted Oct 21, 2013
Replied 4 hours later

Tmast98 wrote:
yishbarr wrote:

My custom sound is in sound/ambient/water.

Ah okay, they're in the right place then. Are they in a format that Portal 2 recognizes. I don't know it exactly but I heard it was so many hertz.....

44100 Hz (44.1KHz), the same sampling rate as a CD.