Dawn Pedersen. Flash Audio Formats Flash can handle many of the major audio formats, including these...
If you can't read please download the document
Dawn Pedersen. Flash Audio Formats Flash can handle many of the major audio formats, including these common ones: MP3 (Moving Pictures Expert Group Level-2
Flash Audio Formats Flash can handle many of the major audio
formats, including these common ones: MP3 (Moving Pictures Expert
Group Level-2 Layer- 3 Audio.mp3 extension) WAV (.wav extension)
QuickTime (.qt or.mov extension) AIFF (Audio Interchange File
Format.aif extension) AAC (Advanced Audio Coding.aac
extension)
Slide 3
Waveform Sound is traditionally visualized as waves. The shape
of the wave defines numbers that encode the sound. The horizontal
line is silence. Audio is measured from the top of one blip to the
top of the next one. These blips are called peaks.
Slide 4
Sample Rate Sampling is done from peak to peak. Top peaks are
positive numbers and bottom peaks are negative. For any sound to be
digitized (similar to how color is digitized in Photoshop,) the
wave needs to be sampled. A sample is a snapshot of a waveform
between peaks at any given time.
Slide 5
Sample Rate This snapshot is a number representing where on the
waveform the snapshot was taken. How often the waveform is sampled
is called the sample rate. Low Sample Rate High Sample Rate
Slide 6
Bit Depth Bit depth is the resolution of the sample. A bit
depth of 8 bits means that the snapshot is represented as a number
between -128 to 127. Bits are computer data describing whether an
electrical circuit is on or off. One is represented by a 1, and off
is represented by a 0. This method of expressing data is called
binary, because there are two possibilities. 8 bits means 8
possibilities of either 1 or 0, therefore 2 to the 8 th power (2 8
). This equals 256 possibilities.
Slide 7
Bit Depth A bit depth of 16 bits means that the snapshot is
represented as a number between -32,768 to 32,767 (over 65,000
potential samples.) The greater the number of potential samples of
a wave, the more accurate the sound.
Slide 8
Kilohertz One wave cycle in 1 second is known as a hertz (which
cannot be heard by the human ear.) Audible sound uses thousands of
these waves, crammed into a 1-second time span. A thousand waveform
cycles in 1 second is called a kilohertz.
Slide 9
Kilohertz Audio CDs are typically sampled at the frequency of
44.1 thousand waves per second (44.1 kHz). These waves are commonly
referred to as the sample rate.
Slide 10
File Size The more samples per wave and the more accurate the
samples, the larger the file size. The potential for huge sound
files is therenot a good situation when dealing with Flash. Large
files take a very long time to load into a browser. One way of
dealing with this is to reduce the sample rate (number of waves per
secondkHz).
Slide 11
File Size Reduction of sample rate has a corresponding
reduction in audio quality. As a Flash designer, your objective is
to obtain the best quality sound at the smallest file size. Many
designers say that 16-bit, 44.1 kHz is a good standard. However,
its really unnecessarily high for sounds such as simple mouse
clicks, or for music listened to through inexpensive PC speakers.
In these cases, 16-bit and 22.05 kHz are fine.
Slide 12
Flash and MP3 The 2 most common audio formats imported for use
in Flash are WAV and AIFF. Like video, sound contains a huge amount
of data and must be compressed before it is used. This is the
purpose of a codec (enCODer/DECoder.) Flash uses the MP3 codec to
output audio.
Slide 13
Flash and MP3 WAV and AIFF files are converted to MP3 files on
playback. Its best to start with the purer WAV and AIFF files and
have Flash convert to a smaller MP3 file size. MP3 uses perceptual
encoding: It tosses a ton of audio information into the trash. This
corresponds to a decrease in file size. The information tossed is
typically inaudible to human ears anyway.
Slide 14
Importing an Audio File 1. Create a new Flash document. 2. File
> Import > Import to Library (audio files cannot be imported
directly to the stage) 3. Select PreachersAndThieves.mp3 4. Open
the Library panel and select the new audio file. You will see the
files waveform in the preview pane. 5. In the Library panels panel
menu, select Play to test the sound file (stop it from the same
menu.)
Slide 15
Setting Sound Properties 6. Double-click the speaker icon for
the audio file. The Sound Properties dialog box appears. 7. Notice
the options available: Test and Stop to play the file and stop it.
Update to replace the imported copy with the edited version. Import
to replace the file with another. Audio information under the path
and date. Compression drop-down, in which you select a codec.
Slide 16
Setting Sound Properties 8. Select MP3 for Compression. 9.
Click the Test buttonyou may notice flatter sound quality. The file
size is markedly decreased. 10. Change the Bit Rate to 48 kbps. 11.
Select Best in the Quality dropdown. 12. Click Test again and
listen for the improved audio quality. The file size is
significantly increased. 13. Close the dialog box and the Flash
movie without saving changes.
Slide 17
Using Audio in Flash Flash has two main types of sound: event
and streaming Event sound tells Flash to load a sound completely
into memory before playing it. It does not start loading into
memory until the playhead encounters the frame with this audio.
Once loaded, the sound continues to play, even if the movies
playhead stops.
Slide 18
Using Audio in Flash Event sounds are not locked into the
Timeline. Depending on the users computer, audio and animation may
not synchronize. This type of sound is ideal for pops, clicks, or
other very short sounds.
Slide 19
Using Audio in Flash Streaming sound can begin playing before
it is fully loaded into memory. The trade-off is that it must be
reloaded every time you want to play it. This sound type is ideal
for longer background soundtracks that play only once. Because it
is locked in step with the Timeline, streaming sound is the only
realistic option for cartoon lip-synching, or any scenario that
requires tight audio-visual integration.
Slide 20
Event Sound 1. Open the Bang.fla file. It includes a kaboom.mp3
audio file in the Library. 2. Rename Layer1 as Audio. 3. Drag the
kaboom.mp3 symbol from the Library onto the stage. 4. Notice the
small blue line running through Frame 1 (this is the start of the
waveform.) 5. Insert a frame at frame 97 (F5)you should now see the
entire waveform.
Slide 21
Event Sound 6. Right-click (Mac: Ctrl-click) on the layer name
and select Properties. 7. In the Layer Properties dialog box,
select 300% from the Layer height dropdown. 8. Click OK. Now the
waveform is in greater detail. This can be instrumental in timing
animation, because you can more clearly see the peaks and valleys.
9. Click in the waveform on the Timeline anywhere but frame 1.
Slide 22
Event Sound 10. In the Properties panel, select Event from the
Sync dropdown menu in the Sound area. 11. Press Enter/Return. The
playhead moves but the sound does not play. 12. Drag the playhead
to frame 1 and press Enter/Return again. You can preview event
sounds only by playing them in their entirety, and only from the
keyframe in which they appear.
Slide 23
Streaming Sound 13. Change the Sync setting to Stream. 14. Drag
the playhead across the timeline. Notice that you can hear the
sound as you scrub across. 15. Drag the playhead to frame 2 and
press Enter/Return. The sound plays from that point forward. 16.
Press Enter/Return again. The sound stops. Streaming playback lasts
only for the frame span on the timeline.
Slide 24
Keeping Sounds from Overlapping 17. Add a new timeline layer
named audio2. 18. Add a keyframe to frame 20 of this layer (F6).
19. Select the new keyframe, and drag kaboom.mp3 onto the stage.
Now you have two layers associated with the explosion sound. 20. In
the same keyframe, set the Sync property to Event. 21. Drag the
playhead to frame 1 and press Enter/Return. You will hear two
explosions.
Slide 25
Keeping Sounds from Overlapping 22. Change the Sync property
for frame 8 of the audio2 layer to Stop. 23. Press Enter/Return
again from frame 1. Youll hear only a single explosion. Its sound
gets cut off halfway through. Thats the playhead encountering the
Stop keyframe. A Stop keyframe doesnt halt all soundsthe halted
sound must be specified.
Slide 26
Keeping Sounds from Overlapping 24. Change the Sync property
for frame 20 of the audio2 layer to Start. 25. Drag the Keyframe at
frame 20 until you move past the waveform in the Audio layer. Frame
16 should do it. 26. Move the playhead to frame 1 and press
Enter/Return. You should hear one explosion after another. Users on
slower computers might hear only one explosion, because the first
sound may not have finished by the time the playhead hit frame
16.
Slide 27
Removing an Audio File from the Timeline Audio files cant be
deleted directly from the timeline. 27. Hold down the Shift key and
select frames 1 and 15 in the Audio layer to select the audio file.
Press the Delete keynothing happens. 28. Select any frame within
the audio layers waveform. 29. In the Properties panel, select None
from the Name dropdown. The sound is removed. 30. Close bang.fla
without saving your changes.
Slide 28
Looping Audio 1. Open FrogLoop.fla. 2. Notice the audio layerit
has the same ribbit, happening only once (even though the timeline
spans 60 frames.) 3. Select anywhere inside the waveform. 4. In the
Property panel, look for the Repeat dropdown; change the 1 next to
it to 4. The waveform will repeat 4 times. 5. Scrub the
timelinebecause this is an Event sound, we do not hear
playback.
Slide 29
Looping Audio 5. Click in frame 1 and press Enter/Return to
hear the 4 ribbits. 6. Set the Sync to Stream. Streaming audio can
be looped just like event audio. 7. Scrub the playhead again. 8.
Change the Repeat dropdown to Loop. 9. Test the movie. Now the
sound will play forever in the SWF, unless you stop it with a Stop
keyframe layer in the timeline. 10. Close the FrogLoop.fla without
saving changes.
Slide 30
Add Sound to a Button 1. Create a new Flash file. 2. Import
kaboom.mp3 into the Library. 3. Select Window > Common Libraries
> Buttons to open a collection of preset buttons. 4. Scroll down
to the playback flat folder in the Buttons library, open it, and
drag a copy of the flat blue play button to the stage. 5.
Double-click the button on the stage to open it in the Symbol
Editor.
Slide 31
Add Sound to a Button 6. Add a new layer named audio and add a
keyframe (F6) to the Down area of the audio layer. 7. With the
keyframe selected, drag a copy of the kaboom.mp3 audio file onto
the stage. 8. Click in the waveform. 9. In the Properties panel,
set the Sync to Event (if you had chosen Stream, the audio would
not be able to play completely.)
Slide 32
Add Sound to a Button 10. Click Scene 1 to return to the main
timeline. 11. Control > Enable Simple Buttons. 12. Click the
button on stage to hear the explosion. Click it several times
rapidlyyou will hear the sound repeated for each click, all
overlapping if you go fast enough. 13. Control > Enable Simple
Buttons (to disable it.) 14. Double-click the symbol again to edit
it.
Slide 33
Add Sound to a Button 15. Click on the Down keyframe in the
audio layer. 16. Change the Sync setting from Event to Start. 17.
Return to the main timeline and Enable Simple Buttons again. 18.
Click the button rapidly againsubsequent ribbits will only begin
with the previous one has finished.