Fr/Soundscape

From Valve Developer Community
< Fr
Revision as of 12:17, 6 November 2008 by Anarkia777 (talk | contribs)
Jump to navigation Jump to search

Un Soundscape est un ou plusieurs son destiné à être joué sous Source. Le DSP peut être appliquer a ces sons et ainsi permettre un rendu réaliste du son, avec des écho, de la reverberations, des occlusions, ce que ne permet pas l'entité Ambient_generic. Ces Soundscapes peuvent être contrôlé sur de nombreux paramétre telle le volume (loop, volume, DSP,...) ce qui permet de rendre un environement complexe.

Un Soundscape est composé :

  • D'un fichier .txt comprenant tous vos soundscape avec leur differents paramètres.
  • De l'entité env_soundscape dans hammer pour relier vos son au fichier .txt. il se situe dans le dossier \Script.
  • Et de vos son Wav ou Mp3 dans le dossier \Sound.


Entitée point env_soundscape

Le moteur Source ne peut jouer qu'un seul soundscape à la fois, passez à un autre Soudscape se fera de facon progressif. Il y à une exeption qui sera expliqué plus loins. L'entité env_soundscape à un rayon d'action, qui correspond non à la distance d'audition des sons, mais à une zone d'activation du Soundscape, une fois activer il le restera jusqu'a que le joueur entre dans un autre rayon d'action d'un autre env_soundscape. Le nom que vous lui donnez sera lier directement au Soundscape dans votre fichier "soundscape.txt".

L'entité a aussi 8 slot, permettant de jouer plusieurs son à des endroit précis differents. Ces slots sont déclarés dans le fichier .txt. Ils peuvent pointer sur n'importe quel entité, un point_target par exemple.

Creating and Editing soundscapes.txt Entries

Soundscapes.txt is a simple key/value pair file with the same format as .VMT or .VMF:

"example"
{
   "key1" "value1" 
   "key2" "value2" 
   "subexample" 
   { 
          "key3" "value3" 
   } 
   "key4" "value4" 
} 

// Comment text, not parsed 
"example2"        // This is a comment as well 
{ 
} 

Each root-level section (a section that is not within another section) is considered to be a definition of a soundscape. The name given to this soundscape is referenced by the env_soundscape entity.

Adding custom soundscapes

Adding soundscapes to a mod

The soundscapes which are loaded are defined in <game directory>\scripts\soundscapes_manifest.txt. Add the name of your custom soundscape(s).

Place your soundscape(s) in <game directory>\scripts\my_custom_soundscape.txt.

Adding a soundscape to a map

If you are third-party mapping for a game or modification and therefore can not change the original soundscapes_manifest.txt, you can give your soundscape the same name as your map and it will be loaded with this map.

For example, with a Counter-Strike: Source map called my_custom_map.bsp:

<game directory>\scripts\soundscapes_my_custom_map.txt

Commands

dsp

Sets the DSP effect to a particular room number. In general this should be set to 1, which is the “automatic” DSP. With this DSP the sound engine will attempt to discover the proper parameters based on the surrounding geometry. Setting the DSP to 0 will result in effectively turning DSP effects off. Using other pre-sets are only recommended for special cases. These pre-sets are declared in the ../hl2/scripts/dsp_preset.txt file.


Example

    // This soundscape disables DSP and plays no sounds 
        "Nothing" 
        { 
               "dsp"   "0" 
        }

playlooping

Plays a looping sound until a new soundscape is triggered.

wave

  • The name of the wave file.

volume

  • Sets the wave's volume (0-1).

pitch

  • Sets the pitch for the wave (100 is normal).

attenuation

  • Sets the attenuation of the wave (only used if a "position" command follows).
    • Note.pngNote:These can be random intervals - the random value will be chosen once each time the soundscape is triggered.

position

  • References a position by index (0-7) that the level designer has pointed to in the env_soundscape entity.

Example

    // This plays a single looping sound, with a generic reverb (room type 1)
    "GenericIndoor" 
    { 
         "dsp"   "1" 
         "playlooping" 
         { 
                "volume"       "1" 
                "pitch"        "100" 
                "wave"         "ambient/areas/air_exchange/indoor2.wav" 
         } 
    }
Note.pngNote:In order to use the function of playlooping you need to set make sure your wavfile has cues so that the Source engine knows where to loop the sound. To find out one way of doing this then read the following article..also note this article is for Goldsource and you can now use higher sample rates, for example 44100hz.

[1]

playrandom

Plays random sound events until a new soundscape is triggered.

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), or "random" for a random position.

Example

    "GenericOutdoor"
    
    { 
        "dsp"   "1" 
        
        "playrandom" 
        { 
            // Play every 0.1 to 1.5 seconds 
            "time" "0.1, 1.5" 
            
            // At a volume of 0.5 to 1 
            "volume" "0.5,1" 
            
            // At a pitch of 50% to 120% 
            "pitch" "50,120" 
            
            // With an attenuation of 0.7 
            "attenuation" "0.7" 
            
            // At entity specified at position 1 
            "position"  "1" 
            
            // Play one of these .wav files randomly each time 
            "rndwave" 
            { 
                "wave" "temp/soundscape_test/music_snippet1.wav" 
                "wave" "temp/soundscape_test/music_snippet2.wav" 
                "wave" "temp/soundscape_test/music_snippet3.wav" 
            } 
        } 
    }

playsoundscape

Plays another soundscape and all of its sub-commands.

Note.pngNote:DSP effects cannot be altered by sub-soundscapes.

name

  • Sub-soundscape to play.

volume

  • All volumes in the sub-soundscape are scaled by this value (0-1).

position

  • An offset added to each position index of the sub-soundscape (0-7).

positionoverride

  • Forces all sub-soundscape positional sounds to occur at a single position originating from the entity at this index (0-7).

ambientpositionoverride

  • Forces all sub-soundscape ambient sounds to be spatialized at a particular position originating from the entity at this index. Useful to make ambient sounds come “from a direction" (0-7).

Example

    "SubSoundscape"
    { 
        "dsp"   "1" 
        
        "playsoundscape" 
        { 
            // Sub-soundscape to play 
            "name" "GenericIndoor"
            
            // All sub-soundscape volumes reduced by 50% 
            "volume" "0.5"
            
            // All sub-soundscape position sounds will come from this point 
            "positionoverride" "0"
            
            // All sub-soundscape ambient sounds will come from this point 
            "ambientpositionoverride" "1" 
        } 
    }

soundmixer

Sound mixers are used to provide custom volume control over various sound categories, called mix groups. Sound mixers are referenced in Soundscapes via "SOUNDMIXER" "name".

Example

"automatic"
{
	"dsp"	"1"
	"dsp_volume" "1.0"
	"SOUNDMIXER" "Default_Mix"
}

Always use Default_Mix as a template.

"Default_Mix"
{
//	group name			mix value
//	----------			---------
	"Explosions"			"0.90"
	"Player_Weapons_Loud"		"1.0"
	"Player_Suit"			"0.56"
	"Weapons"			"0.79"
	"AHELI_WEAPON"			"0.85"
	"GUNSHIP_WEAPON"		"0.85"
	"STRIDER_WEAPON"		"0.85"
	"bullethit"			"0.67"
	"Music"				"0.81"
	"All"				"0.72"
}

References

  • /scripts/soundmixers.txt from create a mod, source sdk
  • /scripts/soundscapes.txt from create a mod, source sdk