Soundscapes Part 3 - Play Random

Tutorial collection, comprehensive listings on main site.

Soundscapes Part 3 - Play Random

Postby Tutorial on Wed Mar 30, 2005 9:40 pm

category
General Half-Life 2/Sound

description
This one has a look at the Play Random function.

keywords
sounds, sound, ambient, soundscape, soundscapes, env_soundscape, scape.

Play random

This tutorial assumes you have read part 1 and 2 of the soundscapes tutorials.

With the “playlooping” soundscape your chosen sounds will play from the moment it’s triggered and carry on until a new soundscape is triggered. With “playrandom” when the soundscape is triggered random sounds are played from a list you define. The sounds will vary in volume pitch and the length in time it takes for each sound to be triggered. The advantage of this is a more realistic ambience but at the same time sounds you want to play all the way through wont, so it’s best to combine an playrandom and a playlooping in your soundscape.

Making a playrandom soundscape is exactly the same as making a playlooping soundscape there are just different keys.

The available keys for play random are:

Time - Time interval of the random event.

Volume - Random volume interval (0-1).

Pitch - Random pitch interval (50-250).

Attenuation - Random attenuation of sound.

Rndwave - A list of random wave files to choose from.

Position - Position to use, if spatialized (0-7).



Taken from http://www.valve-erc.com/srcsdk/Sound/soundscapes.html

Definition of Attenuation is “The reduction in intensity of a sound signal.”

I will talk further about Position later on.

Open up your soundscapes.txt document and define your playrandom soundscape.

My playrandom soundscape looks like this:

Code: Select all
 "soundscapes.playrandom"
{
   "dsp"   "1"
   "playrandom"
   {
      "time"         "0.1,1.5"
      "volume"       "0.5,1"
      "pitch"          "100"
      "rndwave"
      {
         "wave"   "ambient/atmosphere/town_ambience.wav"
      }
   }
}


Time to exaplain it.

"soundscapes.playrandom" – This is the name of the soundscape it can be anything you want.

"dsp" "1" – This is the DSP effect of the soundscape 0 turns dsp off, 1 makes the engine choose the best one. You can set your own dsp effect if you really want but it’s advised just to use 1. The dsp numbers go from 0 – 28.

"playrandom" – Plays the random sounds when triggered.

"Time" "0.1,1.5" – This mean that the individual sounds will be played randomly between 0.1 seconds and 1.5 seconds.

"volume" "0.5,1" – This means That the induvudual sounds will be played at random volumes.

"pitch" "100" – You can have varying pitches but for the tutorial I just kept it at one pitch. The pitch can vary from 50 – 250. To have different pitches put something like this in "pitch" "50,120".

"rndwave"
{
"wave" "ambient/atmosphere/town_ambience.wav"
}

- This defines wavs that you want to be played randomly.

Save you new soundscape.

Okay so now we have created our soundscape its time to get it working in game. Place an “env_soundscape” entity in your map.

Select the entity, and then bring up the “Object Properties” window:

Image

In the key “soundscape” you need to define the name of the soundscape you want to use. Earlier I created a soundscape called "soundscapes.playrandom " in the txt document, so im going to use that one. To do this you simply put soundscapes.playrandom in the space provided:

Image

And that’s the playrandom subscape sorted.

The next section will be on subsoundscapes.

Happy Mapping

Signy
Last edited by Tutorial on Sun Dec 07, 2008 4:29 pm, edited 1 time in total.
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Postby JakeParlay on Mon Apr 04, 2005 4:20 pm

nice work Signy, we appreciate it. ... how the F do you figure all this stuff out!
User avatar
JakeParlay
Senior Member
Senior Member
 
Joined: Thu Dec 09, 2004 8:40 pm
Location: Oregon

Postby Spartan on Mon Apr 04, 2005 4:31 pm

nice work Signy, we appreciate it. ... how the F do you figure all this stuff out!

A lot of testing.
Spartan
Veteran
Veteran
 
Joined: Sat Oct 09, 2004 2:58 pm

Postby slayera on Mon Apr 11, 2005 2:55 am

Ok, so how to you keep scripts\soundscapes.txt from being overwritten by others?
Image


"When one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion." -Robert Pirsig
User avatar
slayera
Veteran
Veteran
 
Joined: Wed Dec 08, 2004 3:15 am
Location: Near the world's only super volcano.

Postby wiggle987 on Mon Apr 11, 2005 7:18 am

slayera wrote:Ok, so how to you keep scripts\soundscapes.txt from being overwritten by others?

apparently its something to do with soundscape manifests :shock:
Image
User avatar
wiggle987
Veteran
Veteran
 
Joined: Mon Nov 22, 2004 8:54 pm
Location: O RLY?

Postby slayera on Mon Apr 11, 2005 7:46 am

Yeah I found that a long time ago when playing with last time. But the SDK states that you can't make new soundscapes. You can only use whats included with mod. I spent days trying to get this to work before. Also I can' t figure out to call on my soundscape file. I get the error can't find soundscape.*. But did name my file in the script folder soundscapes_golf.txt, so it probably my errro. I am getting a headache over this.

soundscaples_manifest
{
"file" "scripts/soundscapes_dust.txt"
"file" "scripts/soundscapes_italy.txt"
"file" "scripts/soundscapes_aztec.txt"
"file" "scripts/soundscapes_dust2.txt"
"file" "scripts/soundscapes_cbble.txt"
"file" "scripts/soundscapes_havana.txt"
"file" "scripts/soundscapes_piranesi.txt"
"file" "scripts/soundscapes_chateau.txt"
"file" "scripts/soundscapes_office.txt"
"file" "scripts/soundscapes_prodigy.txt"
"file" "scripts/soundscapes_tides.txt"
"file" "scripts/soundscapes_congo.txt"

// List additional soundscape files here
}
Image


"When one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion." -Robert Pirsig
User avatar
slayera
Veteran
Veteran
 
Joined: Wed Dec 08, 2004 3:15 am
Location: Near the world's only super volcano.

Postby Signy on Mon Apr 11, 2005 3:42 pm

I was menna bundle the subsoundscape tut and the manifest tutorial with these 3 along time ago. But been really busy with the mod, but i assure you they are on the way.

Sigs
User avatar
Signy
Pheropod
Pheropod
 
Joined: Fri Nov 12, 2004 1:21 am
Location: UK

Postby -|Dizmas|- on Mon May 23, 2005 7:52 pm

Code: Select all
"soundscapes.playrandom"
{
   "dsp"   "1"
   "playrandom"
   {
      "time"         "0.1,1.5"
      "volume"       "0.5,1"
      "pitch"          "100"
      "rndwave"
      {
         "wave"   "ambient/atmosphere/town_ambience.wav"
      }
   }
}



Your wrong about the time. It is measured in seconds, so what you have would be 0.1 - 1.5 seconds. ex- ten seconds would be 10.0
-|Dizmas|-
Regular
Regular
 
Joined: Sun May 15, 2005 5:04 pm

Postby Signy on Mon May 23, 2005 9:17 pm

im pretty sure 0.1 is 1/10th of a second and 1.5 is 1 1/2 seconds.

so "0.1,1.5" would be telling the engin to trigger the sound at a random interval between 1/10th of a second or 1 1/2 a second.

Atleast thats how it appears to sound ingame.

If i am indeed wrong well spoted.
User avatar
Signy
Pheropod
Pheropod
 
Joined: Fri Nov 12, 2004 1:21 am
Location: UK

Postby [REG-A] Black Hawk on Sun Aug 27, 2006 9:39 pm

so can you create your own sound scapes or will they always been written over. Cus it doen't make sence to me, if someone made a soundscapes_manifest.txt and another person had one would one of them be written over? Is this tutorial useless now?

If that is true the only way to use sound scapes is to use the ones that have been created in an offical map and it will just automatacally work?
[REG-A] Black Hawk
Regular
Regular
 
Joined: Tue Nov 09, 2004 3:08 am
Location: Redmond, WA

Postby [REG-A] Black Hawk on Sun Aug 27, 2006 10:06 pm

I got this one to work well. It sounds like waves crashing onto a beach.

// Ocean Water Ambience
//
"ocean.playrandom"
{
"dsp" "1"
"playrandom"
{
"time" "2,5"
"volume" "0.5,1"
"pitch" "100"
"rndwave"
{
"wave" "ambient/levels/canals/shore1.wav"
"wave" "ambient/levels/canals/shore2.wav"
"wave" "ambient/levels/canals/shore3.wav"
"wave" "ambient/levels/canals/shore4.wav"

}
}
}
[REG-A] Black Hawk
Regular
Regular
 
Joined: Tue Nov 09, 2004 3:08 am
Location: Redmond, WA

Re: Soundscapes Part 3 - Play Random

Postby Mephasto on Thu Jun 26, 2008 3:59 pm

ok so what if i want to make like 4 or more overwatch announcements on random timer, how can i make it so it wont play two files same time?
User avatar
Mephasto
May Contain Skills
May Contain Skills
 
Joined: Sun Aug 19, 2007 7:03 pm
Location: Finland, Tampere

Return to Tutorials

Who is online

Users browsing this forum: No registered users