Difference between revisions of "Adding Sounds II"

(Controlling your Sound with Regions)
 
(10 intermediate revisions by 5 users not shown)
Line 31: Line 31:
  
 
=== Stop ===
 
=== Stop ===
A boolean value determining whether to stop playing the sound when the effect finishes. This should be set for fadeout effects.
+
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 ==
 
== 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.
 
3D sounds are setup the same way as other sounds, but include two new params in AlcScript and an additional flag.
         flags: '''3d'''|''<other flags>''
+
         flags:
 +
          - is3dsound
 +
          - ''<other flags>''
 
         minfdist: '''<minimum distance>'''
 
         minfdist: '''<minimum distance>'''
 
         maxfdist: '''<maximum distance>'''
 
         maxfdist: '''<maximum distance>'''
 +
        type: '''<sound type>'''
  
 
=== Minfdist ===
 
=== Minfdist ===
Line 44: Line 47:
 
=== Maxfdist ===
 
=== 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.
 
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_I| 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 ==
 
== Controlling your Sound with Regions ==
Line 49: Line 67:
  
 
  regiontype: soundregion
 
  regiontype: soundregion
  soundemitter: <Name of sound emitter object>
+
  soundemitter: '''<Name of sound emitter object>
 
+
'''
 
or use the following AlcScript:
 
or use the following AlcScript:
  
  <Name of sound region>:
+
  '''<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:
 
     region:
 
         type: soundregion
 
         type: soundregion
         soundemitter: <Name of sound emitter object>
+
         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 that when the sound region starts a sound emitter, it sets the volume to 1. This value will be an option in later versions. Also note that entering and exiting a sound region merely toggles the sound emitter, and the sound emitter is started at the first crossing of a region boundary. So if you start inside the region, exiting the region will start the sound emitter, and entering will stop it, whereas if you start outside the region, entering will start it, and exiting will stop it. Again, more flexibility will be added to the sound region quickscript in later versions.
+
[[Category:AlcScript]]

Latest revision as of 08:58, 18 April 2011

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!