Working with Sound Sprites
The Score contains two sound channels in which sprites can be placed. It doesn’t matter which channel you use for a particular sound sprite; the sound will play the same way in either channel. If you place sprites in both channels, you can have two sounds play at the same time (Figure 13.6). (Director actually allows eight sounds to play at the same time, but the additional six sound channels can be accessed only via Lingo.)
Figure 13.6. By placing sound sprites in both sound channels, you can have two sounds play at the same time—like rain and thunder, for example.
Sound sprites, like digital video sprites, have time-based content, and therefore the same ground rules apply:
-
Every sound file has a fixed duration that’s independent of the tempo of the Director movie.
-
When the playhead enters a sound sprite in the Score, the content of the sound begins to play. It continues to play until either the playhead leaves the sprite or the duration of the sound file is reached, whichever comes first.
-
If the duration of the sprite is less than the duration of the sound file, you’ll hear only part of the sound.
For a more thorough discussion of these issues, see “Working with Video Sprites” in Chapter 10.
To turn a sound cast member into a sprite:
-
In the Score, select the frames in a sound channel where you want to place the sound (Figure 13.7).
Figure 13.7. Select the frames in the Score where you want the sound sprite to go.
-
Choose Modify > Frame > Sound.
The Frame Properties: Sound dialog box opens, displaying all the sound cast members in the movie (Figure 13.8).
Figure 13.8. The Frame Properties: Sound dialog box.
-
From the list in the dialog box, select the sound you want to place in the Score.
If you don’t remember what a particular sound sounds like, you can click Play to preview it.
-
Click OK to place the selected sound in the Score.
The sprite occupies the frames you selected in step 1 (Figure 13.9).
Figure 13.9. The sound sprite occupies the frames you selected in the Score.
-
You can drag a sound directly into one of the Score’s sound channels from a Cast window, just as you would with other types of cast members. When you do so, you get a sound sprite that’s 28 frames long (or whatever duration you’re previously chosen—see “To change the default sprite duration” in Chapter 3).
To play a sound for a fixed amount of time (regardless of the duration of the sound file):
-
For a particular sound sprite in the Score, decide how long you want the sound to play.
For this example, let’s assume you want to hear the sound for 2 seconds.
-
Multiply the number of seconds from step 1 by the current tempo of the movie. (See “Setting a Movie’s Tempo” in Chapter 5.)
Let’s assume the current tempo is 15 frames per second (fps). In that case, 2 times 15 equals 30.
-
Extend the sound sprite in the Score to span the number of frames you arrived at in step 2.
In this case, you’d make the sprite 30 frames long.
-
Play the movie.
When the playhead enters the sound sprite, the sound begins to play. If the sprite’s sound file has a duration of more than 2 seconds, only the first 2 seconds of the content is heard (Figure 13.10).
Figure 13.10. A 2-second sprite in a movie whose tempo is 15 fps. If the sprite’s audio file is 4 seconds long, only half of the audio content will be heard.
If the sprite’s sound file has a duration of less than 2 seconds, the audio content of the video file is heard in its entirety, followed by silence (Figure 13.11).
Figure 13.11. A 2-second sprite in a movie whose tempo is 15 fps. If the sprite’s audio file is 1 second long, the sound will be heard in its entirety, followed by 1 second of silence.
To loop a sprite’s audio content:
-
In the Score, extend the sprite so that its duration is longer than that of the sprite’s audio content.
The longer the sprite, the more times the video content will repeat.
-
Click the Sound tab in the Property Inspector.
If there is no Sound tab, select the sound sprite in the Score (or its corresponding cast member in the Cast window) to make the tab available.
-
Select the Loop option in the Property Inspector (Figure 13.12).
Figure 13.12. The Loop option on the Sound tab in the Property Inspector.
-
Play the movie.
The sound begins to play when the playhead enters the sprite and repeats until the playhead leaves the sprite.
-
You can also repeat a sound by placing multiple copies of a sound sprite next to one another in the Score (Figure 13.13). For this technique to work, you must separate the sprites by at least one frame. Separating the sprites tells Director to start playing the sound again at the start of each sprite.
Figure 13.13. You can repeat a sound by placing it in the Score multiple times. Make sure to separate the sprites by at least one frame.
To make a sound sprite play its full audio content just once:
-
In the Score, place a Wait for Cue Point command in the tempo channel in the sound sprite’s last frame, using {End} as the cue point (Figure 13.14). (For details, see the “Using Cue Points” sidebar in Chapter 5; see also the “Synchronizing Sound to Actions” section later in this chapter.)
Figure 13.14. This Wait for Cue Point command will cause the Director movie to pause until the sound sprite has played in its entirety.
or
-
Select the sound sprite in the Score.
-
In the Property Inspector, click the Sound tab.
-
If the Loop option is selected in the Property Inspector, deselect it.
While you’re in the Property Inspector, look at the value for Duration (Figure 13.15). It’s displayed to the thousandth of a second, but you’ll probably want to round it to the nearest second, since sprite durations are not an exact science.
Figure 13.15. The duration of a sound cast member, as displayed on the Sound tab in the Property Inspector.
-
Multiply the sound file’s duration (in seconds) by the current tempo of your Director movie (in frames per second).
-
Extend the sound sprite in the Score to span more than the number of frames you arrived at in step 4.
Since the Loop option is turned off, adding more frames to the sprite does no harm, and it adds an extra cushion in case the actual tempo of your movie is less than the target tempo.
-
If you’re using music as a background, instead of playing one long sound file all the way through, it’s usually a better idea to take a smaller chunk of music and loop it. (See “To loop a sprite’s audio content” on the previous page.) Doing so keeps your file size down, reduces download time, and improves playback performance.