Exercise 16: A blast you can hear
Purpose. To give the explosion a sound that is fired with it and comes from its place in the world. The sound should never play exactly the same way twice.
A sound belongs to an effect as much as its sparks do. It must start at the same instant, come from the same spot, and vary from one blast to the next. A Sound can be transformed like anything else, and then it is fired, timed and layered with the rest.
Before starting
Section titled “Before starting”- The
Explosionfolder from Exercise 15 is in the workspace. - One new ordinary Part named
Boomis inside the folder, at the centre of the explosion, anchored, with Transparency1and CanCollide off. - Inside
Boomis one Sound namedBlast, with its SoundId set to an explosion sound.
Procedure
Section titled “Procedure”Steps 1, 2 and 6 repeat earlier exercises on a new kind of emitter.
| Step | Control | Action | Result |
|---|---|---|---|
| 1 | Blast | Select, then press Transform | The Properties panel shows the sections of a Sound emitter, with Emission and Sound open. The Emit box reads 1. |
| 2 | HUD ▸ Emit button | Press | The sound plays once, from the place where Boom is. |
| 3 | Properties ▸ Sound ▸ Speed | Enter 0.9, 1.15 | No change yet. |
| 4 | HUD ▸ Emit button | Press several times | Each play has a slightly different pitch. |
| 5 | Properties ▸ Sound ▸ Roll-off Max | Enter 150 | The sound is no longer heard from more than 150 studs away. |
| 6 | Explosion | Select, then press Emit on the HUD | Fire, smoke, flash, jolt, shockwave and sound go off together. |
What the steps did
Section titled “What the steps did”A Sound emitter plays a duplicate of the Sound each time it is fired. Transform keeps the Sound’s volume, speed, roll-off distances and Looped setting. It starts with an Emit count of 1.
The sound comes from the Part or Attachment that holds the original Sound, and follows it if it moves. A Sound emitter nested in another emitter plays from each parent particle and travels with it.
| Row | Starts at | What it sets |
|---|---|---|
| Emission ▸ Lifetime | 0 | How long each play lasts, in seconds. At 0 the sound plays once to its end. Above 0 the play is cut off at that time. |
| Emission ▸ Start At | 0 | How many seconds into the clip the play begins. |
| Emission ▸ Looped | The Sound’s own setting | The clip repeats until the Lifetime ends. |
| Emission ▸ 2D (local) | Off | On, the sound has no place in the world. It is heard at the same volume everywhere. |
| Sound ▸ Volume | The Sound’s own volume | The volume, over the life of the play. |
| Sound ▸ Speed | The Sound’s own speed | The playback speed, which is also the pitch, over the life of the play. |
| Sound ▸ Roll-off Min | The Sound’s own distance | The distance, in studs, at which the volume begins to fall. |
| Sound ▸ Roll-off Max | The Sound’s own distance | The distance, in studs, beyond which the sound is not heard. |
Volume and Speed are graph rows. Two numbers typed into either one give each play a value of its own between them, as with Speed in Exercise 1. A drawn graph changes the value while the sound plays.
If the result differs
Section titled “If the result differs”| Symptom | Cause | Action |
|---|---|---|
| No sound at step 2 | The Sound has no SoundId, or Studio’s own volume is off. | Set the SoundId on the RenderTemplate inside Blast, which is the duplicate that is played. |
| The sound is equally loud everywhere | 2D (local) is on, or the Sound is not inside a Part or an Attachment. | Switch 2D (local) off. Keep the Sound inside Boom. |
| The sound is cut short | Lifetime is above 0 and shorter than the clip. | Enter 0 for Lifetime. |
| Many sounds pile up | Enabled is on. | Switch it off and use the Emit box. |
| The sound does not fire with the rest | Boom is not inside Explosion. | Drag it into the folder. |
Variations
Section titled “Variations”| Change | Result |
|---|---|
Sound ▸ Volume 0.4, 0.6 | Each blast is a little louder or quieter than the last. |
| Sound ▸ Volume, a graph that falls to 0 | The sound fades out as it plays. |
HUD ▸ Delay 0.1 on Blast | The sound arrives a moment after the flash, as from a distant blast. |
A Sound emitter inside the RenderTemplate of the rocket of Exercise 9 | Each rocket carries its own whoosh, which stops when the rocket ends. |
Looped on, Lifetime 3, a Speed graph from 0.6 to 1.4 | A hum that rises in pitch for three seconds. |
| Emission ▸ 2D (local) on | A sound for a menu or a screen effect, heard at full volume wherever the camera is. |
| New in this exercise | Transforming a Sound. Speed as pitch. Roll-off Max. Lifetime 0. |
| Done before | Transform (eight times). The Emit button (nine times). Two numbers in a graph row (Exercise 1). A Folder fired as one (Exercises 10, 11 and 15). |
| Carried forward | Keep Explosion. The next two exercises fire it from a script. |