Time for action - add a sound to a particle effect

Let's say we have an explosion sound and an explosion particle effect.

  1. Select a particle effect of the subeffect in the Particles editor within Sandbox.
  2. Browse and add a sound event. The sound event will start when the effect or subeffect starts. If you wish to delay the start of the sound, attach it to a subeffect and use spawn delay to delay the start time.
  3. Sounds will stop when the particle effect stops. It is recommended that a fade out time be set in the sound event properties in the FMOD Designer project, to enable a smooth stopping of the sound.
    Time for action - add a sound to a particle effect

What just happened?

You've now added a sound to a particle effect: It will play every time this particle is triggered. This way we don't have to add secondary entities to play the sound in addition to explosions and other particle effects, which would have some obvious sound within it. There is, however, an exception to this as weapon particle effects do not usually have the sound assigned within the particle but rather in the weapon .xml file, which we will see in the next example.

Have a go hero - changing sound over time on particles

We have seen in previous examples that we have the ability to add parameters within FMOD on the sound event. When dealing with particles, one of the valuable sound parameters is the particlefx parameter.

  1. Create a parameter called particlefx in a sound event.
  2. Add that sound event to a particle effect.
  3. Set the Sound FXParam to 1.

    This defines the maximum value sent to the particlefx parameter of the sound event.

  4. Draw a curve in the Var Emitter Strength graph. The x axis, horizontal, represents time; whereas the y axis, vertical, represents the value sent to the particlefx parameter in the FMOD Sound event.
    Have a go hero - changing sound over time on particles

    Note

    This graph is reversed from the graph you would see for the particlefx parameter in the sound event in FMOD Designer.

    As seen in the previous screenshot, the curve will gradually move the value of particlefx from 0.0 to 1.0, over the life of the particle effect.

    A typical use may be to have a Volume effect curve on the particlefx parameter in the sound event, which reduces the volume of the sound as the value of the parameter moves from 0.0 to 1.0.

    Optionally, select a value for the Var Random value in the particle editor. A random amount from 0.0 to the maximum random value will be subtracted from the parameter each time the particle effect is played. This causes the value of the parameter to be lowered by a random amount.

    For example, if the value of Sound FXParam is 1.0 and Var Random is set to 0.2, then, each time the effect is played, the maximum value of FXParam would be set anywhere between 1.0 and 0.8.

Using the three different sound control overtime functions

There is a property within the particle editor called Sound Control Time. This pull-down window offers three different choices and is designed to work in conjunction with the particlefx parameter within FMOD.

Using the three different sound control overtime functions

The three different choices and its uses are as follows:

  • Use EmitterLifeTime to update the particlefx parameter according to the curve set in Var Emitter Strength.
  • Use EmitterExtendedLifetime to update the particlefx parameter, while the emitter emits as long as the emitted particle is still alive.
  • Use EmitterPulsePeriod to update the particlefx parameter over the entire emitter's pulse time.

    Note

    All of these functions apply to looping as well as one-shot sounds. Looping sounds will be stopped at the end of EmitterLifeTime and EmitterExtendedLifeTime but not EmitterPulsePeriod.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.183.210