Using MCI Within Movies

One way to include sound in your movies is by using sound cast members embedded in the movie sound channel. These sound cast members are converted to waveforms by the Movie Convertor and built into the movie itself (adding to the size of the movie). Then, when it plays the movie, the Movie Player routes the sound to the waveform audio outputs.

Another way to add sound is by using the Media Control Interface (MCI) to play streamed audio from a waveform file, MIDI file, or compact disc. With streamed audio, the audio data is stored outside the movie file, thus reducing the size of the movie file. Since all of the movie is loaded into memory and audio data is often much larger than the rest of the movie file, the can provide large savings in memory. However, streamed audio can be more difficult to synchronize than embedded audio. Since MCI is not supported on the Macintosh, you'll need to transfer the movie file to the PC to test the synchronization.

Note:

Detailed discussions of MCI and the MCI string interface appear in the MDK's Programmer's Workbook and Programmer's Reference.

The Movie Player recognizes two script-channel commands that allow you to control MCI devices from a movie. The commands are not case sensitive. You can use these commands to control any MCI device, including an audio compact disc, MIDI sequencer, and waveform-audio device.

Command Description

mci <MCI command string>  
  Sends the specified command string to MCI for processing. The <MCI command string> consists of an MCI command string, optionally enclosed in single or double quotation marks.
mciWait <MCI device name>  
  Pauses frame advancement until the specified MCI device has completed the last command it received. The <MCI device name> consists of an MCI device name, optionally enclosed in single or double quotation marks.
 

Generally, streamed audio is useful for synchronizing audio with a block of frames; it's difficult to try to synchronize at a more detailed level. Embedded audio has the same problem. This more due to playing across different platforms than anything else.

Summary: Some Synchronization Tips

It can be very difficult to completely synchronize sound with specific image movements, like synchronizing the beat of a drum with a dancing figure. The task becomes more complex when you use streamed audio (such as CD audio or MCI waveform playback) due to the time it takes to open or seek in the audio file. If opens and seeks are minimized, then streamed audio can work as well as embedded audio.

One way to minimize synchronization problems is to loosely tie the audio to the action on the screen. Don't try to synchronize facial expressions or lip movements to voice narration. Instead, coordinate sounds with a series of frames. See the MCI script channel command example later in this chapter for a good model of how to do this.

Make sure you consider synchronization during design and you test your product on a range of delivery platforms.