| Lesson 11: Sound Lingo |
|
|
Goal In this exercise you will learn how to use Lingo to control and play sounds. Background: Sound as a media element is often overlooked in terms of its importance. Sound can add a great deal of impact to a presentation, provide useful feedback for a user interface, and generally fill-in the spatial void graphics media cannot. Sound has the capability to put the user into the environment you're presenting, and this can greatly enhance the effectiveness of your work. Director has very capable sound playback options for the multimedia author, and most of its advanced sound features are easy to use. Beginning Director developers might be tempted to place Sound Cast Members into the Score and play them like sprites. This works for very basic sound needs, but will likely lead to sounds that are not in precise sync with images in the rest of the movie when the movie is run on computers having different processor speeds. Another limitation to using the Score for playing sounds is that you only get two sound channels to work with. Overall, you will find that sounds play much better when controlled entirely with Lingo, and will offer unparalleled authoring control. Playing Sound with Lingo Director is very sound-capable, and can play a wide variety of sound file formats, including AIF, WAV, and MP3. The needs of your project will determine the sound format you will end up using, but in many cases MP3 sound files work well, and can be easily streamed through the Shockwave Audio object. If more audio fidelity is needed, AIF or WAV sound files are supported at a 16-bit depth with stereo channels, and up to a 44.1 KHz sample rate. A good option for AIF or WAV files is to save them as mono, with a sampling rate of 22.050 KHz, and 16-bit depth. This will produce a reasonably good sounding file at 25% the size of a 16-bit, 44.1 KHz, stereo file. You can reduce the file size further without any noticeable loss of quality by using the IMA 4:1 compressor. This will further reduce the size of the AIF or WAV file by 75%, so the end file size can easily be 1/8th the size of the original, and still sound good. If you want to play long files, or music, the MP3 format is the best choice overall, though there is a free XTRA for Director that allows OGG format files to be played. OGG files are similar to MP3, but the compressor-decompressor code is open-source and license free. To play a sound with Lingo you will need to import a sound into the Cast Window, just as you would if you were using the Sound Channels in the Score for playback. Sound files you import may be embedded, that is, they become integrated into your Director file, and automatically go wherever the Director file goes. Sound files may also be linked, which means the sound remains separate from the Director Cast and must be moved separately from the Director movie. There are advantages and disadvantages to each approach. Embedded Sounds Advantages
Disadvantages
Linked Sounds Advantages
Disadvantages
Remember, when you play sounds using Lingo, you should never place the sounds in the Score, but instead keep them in the Cast only. It is also important to name any Lingo-controlled Sound Cast Members to make them easier to locate. When you use Lingo you are not limited to just 2 sound channels, but instead you may control up to 8 channels of sound simultaneously. Lingo to Play Sound If you want a sound to begin playback when the movie starts, create a Movie Script, and place the following handler in the Movie Script. Naturally, in this example, and those that follow, you will need to substitute a valid name of the Sound Cast Member to play. -- plays a sound in channel 1 You can just as easily play three sounds at a time when the movie starts, using the same Movie Script method. -- plays a sound in channels 1-3 To stop a sound in Channel 1 from a button, the handler below may be used: -- stops a sound in channel 1 Rather than simply stopping a sound you may wish to have it fade out for a better aesthetic effect. The fadeOut() value below is in milliseconds, so setting it to 2000 would make the sound fade out over a period of two seconds. If no number is specified the default is 1000 milliseconds. -- fade out a sound in channel 1 To change the volume of a sound in Channel 1 you may use the following handler on a button: -- change the volume of a sound in channel 1 The volume property has an 8-bit range, so the volume property of a sound channel has a range of 0-255, where 0 is no volume, and 255 is full volume. All sounds play at full volume by default. Another strategy to start or stop a sound is to place a Frame Script where you want the sound to begin playing, or stop. The following handler triggers a sound to play when the playhead sends the exitFrame message for the frame this script is attached to. An enterFrame message works well for this too. -- plays a sound in channel 1 when triggered by a frame message Cue Points It is possible to add what are called "Cue Points" to a sound file. Cue Points are markers attached to individual samples in a sound file that can be read by Director through Lingo commands that look for them. Cue Points must be added in audio editing programs that are compatible with the way Director reads meta data in the sound file. Currently, Bias Peak for Macintosh OS X, and SoundForge XP and Adobe Audition for Windows allow sample marker names and positions to be recognized by Director as Cue Points. Below is a view of two region names in Peak, "Four" and "Full Band 1", which will be available as Cue Points when the sound file is embedded or linked in Director.
The primary advantage for Cue Points is that they are the most accurate way to synchronize audio and video in your Director Movie because they can operate at up to 44.1 KHz, which is more than 44 times faster than the usual millisecond timing option. With a bit of thought and Lingo, you can create an animation that is driven by Cue Points, so the timing of events is inherent in the structure of the sound file, and not dependent on Lingo timers. There are many other options for playing back sounds using Lingo. The best way to experience and understand the various sound capabilities of Director is to download this Example Director Movie, which provides examples for most of the types of sound, and DSP effects you are ever likely to use. Of course, the example movie also provides a good starting point for even more sophisticated sound manipulations in your own work. Exercise: Using the example movie as a reference, create a Director movie that includes at least two sounds controlled by Lingo. Experiment with different settings and configurations to achieve the desired results.
Set as favorite
Bookmark
Email this
Hits: 2496 Trackback(0)
Comments (0)
![]() Write comment
|



