|
Add Audio Tracks
After designing the console, you are ready to add audio tracks. Download the sample tracks in WAVE (Windows) or AIFF (MacOS) formats. For each audio track, you will create a two-frame movie clip with a stop( ) action in frame one that prevents the clip from starting automatically, and a sound in frame two. Set the sound to "event" sync and loop = 999 in the Sound Panel (see Figure 5).
Figure 5. Structure of Audio Track Movie Clip
Next, you will create a movie clip named "sounds" to aid simultaneous playback of your tracks. The sounds movie clip contains your audio tracks, a silent stream sound to improve synchronization and ActionScript code to play your audio tracks simultaneously.
1) Attach each audio movie clip to frame one of the sounds movie clip.
2) Name each movie clip according to the audio track it contains, such as "drumtrackmc".
3) Attach a stop action in frame one that prevents the clip from starting automatically.
4) Attach a sound to frame two of the sounds movie clip.
5) Select the sound and open the Sound Edit window. Drag the envelope handles of both channels to zero and minimize the wave form length by dragging the Time Out Control to the left. (see Figure 6).
Figure 6. Set Volumes to 0 and Minimize waveform in Sound Edit Window
Figure 7. Set sound to stream sync
6) Loop the "silent" stream sound so that the wave form appears on the timeline from frame two through frame four. (see figure 7).
A silent stream sound requires the Flash player to maintain a constant frame rate, which helps syncronization. In frame three attach the ActionScript below.
// loop through all movie clip objects attached to this movie clip
for(name in this)
{
// play each sound track movie clip
this[name].gotoAndPlay(2);
}
The preceding code, combined with the "silent" stream sound will play your tracks simultaneously (see Figure 8).
Figure 8. Structure of Sounds Movie Clip
Attach the sounds movie clip to the audio section of the main timeline. Create a loop in frames 6 and 7 to show a message in your "mixerstate" dynamic text box while audio loads. Use the following diagram as an example of your main timeline's structure. (see Figure 9).
Figure 9. Structure of Main Timeline
Attach the following ActionScript to the main timeline in Frame 6:
// if audio in frame 8 is loaded exit loop.
ifFrameLoaded(8) {
gotoAndPlay("objects");
mixerstate = "Audio Loaded";
}
Finally, attach the following ActionScript to the main timeline in Frame 7:
gotoAndPlay(_currentframe - 1 ); // loop
mixerstate = "Loading Audio"; // show loading message
Flash will loop these frames until all audio tracks are loaded, after which the playhead moves on to the "objects" section.
|