Difference between revisions of "Adding Sounds II"
(→Controlling your Sound with Regions) |
|||
Line 82: | Line 82: | ||
soundemitters: ['''<Name of sound emitter object 1>''', '''<Name of sound emitter object 2>'''] | soundemitters: ['''<Name of sound emitter object 1>''', '''<Name of sound emitter object 2>'''] | ||
Note the plural in soundemitter'''s''' and the use of brackets: [ ]. These brackets are part of the actual AlcScript! | Note the plural in soundemitter'''s''' and the use of brackets: [ ]. These brackets are part of the actual AlcScript! | ||
+ | |||
+ | [[Category:AlcScript]] |
Latest revision as of 08:58, 18 April 2011
Contents
Fading your Sound
Plasma supports FadeIn and FadeOut properties on sound objects. These can make a sound fade gradually. The properties are set in AlcScript on the Sound Emitter object.
fadein: length: start: <starting volume> end: <ending volume> type: <fade type> stop: <stop when finished fading>
The fadeout params are identical, but defined under fadeout rather than fadein.
Length
Length controls how long it takes for the sound to fade in or out. This is a decimal value in number of seconds.
Start
Starting volume defines the percentage of the volume (as a decimal) to use when fading. For fading in, this value should be 0.0. For fading out, this value should be 1.0.
End
The final volume of the sound at the end of the effect, expressed as a decimal percentage. For fading in, this value should be 1.0. For fading out, this value should be 0.0.
Type
Plasma supports three types of fading, these are mathematical equations used internally to produce the fading effect. The three options are
linear #Default fade type logarithmic #Fade using logarithms, best for fading in exponential #Fade using exponents, best for fading out
The fade type is defined as a string of text in AlcScript, using the type names above.
Stop
A boolean value [stop: true] determining whether to stop playing the sound when the effect finishes. This should be set for fadeout effects.
Making your Sound 3D
3D sounds are setup the same way as other sounds, but include two new params in AlcScript and an additional flag.
flags: - is3dsound - <other flags> minfdist: <minimum distance> maxfdist: <maximum distance> type: <sound type>
Minfdist
This value is the distance before the sound starts to fade out. Keep in mind that this value is in Blender units, and should be quite large.
Maxfdist
This value is the distance at which the sound can no longer be heard. Keep in mind that this value is in Blender units, and should be quite large.
Type
This parameter was mentioned in the first Adding Sounds tutorial. For 3-D sound effects, choose soundfx.
Sound Flags
The available sound flags are:
is3dsound disablelod looping autostart localonly loadonlyoncall fullydisabled dontfade incidental
Controlling your Sound with Regions
You can use a sound region to start and stop a sound emitter. Entering and exiting the region will toggle the sound emitter. To add one, use the scripts window menu Scripts > Add > PyPRP > Add a (Generic) Logic Region to add a region. Then you can either set the text properties:
regiontype: soundregion soundemitter: <Name of sound emitter object>
or use the following AlcScript:
<Name of sound region>: region: type: soundregion soundemitter: <Name of sound emitter object>
A soundregion can trigger multiple emitters. Use the following AlcScript to create an emitter list.
<Name of sound region>: region: type: soundregion soundemitters: [<Name of sound emitter object 1>, <Name of sound emitter object 2>]
Note the plural in soundemitters and the use of brackets: [ ]. These brackets are part of the actual AlcScript!