Email the Instructor

Upload a File

Flash 1 - Beginning

Class ends Sunday June 29, at 5pm

×

Drag your file here to upload it.

Lesson 4 – Multimedia

Sound

Flash can import sound files in AIFF, AU, MP3, SD2, and WAV formats (note that it cannot import the AAC iTunes format, or the .m4r ringtone format). To import a sound file, choose FILE>Import>Import to Library.... You can listen to it by selecting it in the Library, and pressing the Play button in the Library's preview area at the top.

You can find lots of free sounds online. One of my favorite sources is FlashKit. Flash also comes with a Common Sounds library (WINDOW > Common Libraries > Sounds)

Like ActionScripts, sounds can only be placed on keyframes. To use sound in a Flash movie, import one (see above), and select the keyframe in which you'd like the sound to start. Drag the sound from the Library to the stage (it doesn't matter where on the stage—you can't see sound). Frames containing sound display a waveform in blue:

To control sound, select the frame it starts in, and use the Properties panel:

Sound Synchronization

When you add a sound to a keyframe, the Properties panel offers the following Sync options:

Event: This option starts the sound at a particular keyframe and plays it to the end, regardless of what the Timeline is doing.

Start: Works much the same as Event, but will add an instance of a sound if one is already playing.

Stop: Makes the specified sound stop.

Stream: Makes the sound play as it's downloading, and forces the animation to keep pace (skipping frames if necessary to keep up). Streaming sounds stop if the animation stops, and cannot keep playing if there are not enough frames to encompass the length of the sound file.

You can also set the number of times the sound loops, to make a short sound last longer. You can edit the sound envelope to adjust the volume (press the Pencil icon—more on this on the next page). To remove a sound, choose "none" from the Sound drop-down menu on the Properties panel.

Compression codecs

Sound takes more data to render than even image files do, and must be compressed to download efficiently—much as image files are compressed with either GIF or JPEG algorithms. The two compression codecs Flash employs to reduce the size of imported sounds upon export are ADPCM and MP3 (there is also a "Speech" compression, which is a variation of the ADPCM codec).

ADPCM (Adaptive Differential Pulse Code Modulation) records the differences between the wave amplitude from one moment to the next, rather than the amplitude itself (which is usually a higher value, and therefore requires more bits to express). This form of compresson works best for short sounds without much variation, like button clicks. It yields a compression ratio of 4:1.

MP3 (Motion Picture Experts Group {MPEG}, Layer 3) compresses sound in several ways simultaneously, including outright elimination of sound beyond typical human perception, sound masking (elimination of soft sounds occuring in close proximity to louder sounds, on the assumption that the human ear will ignore the details 'lost in the noise' anyway), and Huffman encoding (creating short 'symbols' for frequently occurring data packets). Employing multiple layers of compression makes MP3 a very efficient way to achieve high compression ratios (12:1), yet maintain sound quality (notable exceptions include very short sounds, and the spoken word).

You can either set this compression globally (on all sounds throughout the movie) or locally (on each sound in the Library. To set it locally, double-click the sound in the Library (Global settings will be covered in the last Lesson).