Sound in Flash

download Sound in Flash

of 11

Transcript of Sound in Flash

  • 7/28/2019 Sound in Flash

    1/11

    Using Sound in Macromedia Flash

    by Jeff Essex

    Sponsored byApple Computer, Inc.

    Apple Developer Connection

  • 7/28/2019 Sound in Flash

    2/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 1

    Using Sound in Macromedia FlashbyJeff Essex

    If youre creating multimedia content for the Web, Flash and Shockwave are likelyto be

    part of your dailylife. Thisarticle exploresthe use of sound in Flash presentations. It

    wont serve asa basic tutorial: you can get that from the documentation. Instead, Ill cover

    some tricksand workaroundsthat maycome in handyon your projects.

    Thisarticle assumesyou have a basic working knowledge of audio file formats(AIFF, WAV, etc.) and understand a

    bit about sample ratesand sample resolutions( 8-bit/22 kHz vs. 16-bit /44.1 kHz, etc.) If you need help with

    multimedia audio basics, you maywant to skip to the Resourcessection at the end of thisarticle for moreinformation.

    Flash Audio - A Quick ReviewFlash isa vector-based drawing and animation program thatspopular among web designersbecause it packslotsof

    graphic content into a small file. Flash also hasbasic interactivityand the abilityto playsounds(AIFF on Macintosh,

    WAV on Windows). The greatest strength of Flashsaudio support isitsabilityto reuse the same sound data in

    different ways. Thisistremendouslyhelpful in reducing file size, and with a bit of creativity, can produce great

    soundtracks. There are three areasto focuson when optimizing audio in Flash:

    Tweaking waveformsin the Frame PropertiesDialog

    Setting Export optionsfor each sound in a Library Designing a palette of soundsand layering them in the Timeline

    Before looking at each of these in more detail, heresa quick list of the stepsfor adding sound to a Flash document:

    1. Import a sound into the Library( File > Import)2. Create a new layer in the timeline ( Insert > Layer -layersare similar to sprite channelsin Director)3. Add a keyframe within that layer (Insert > Keyframe)4. Open the Frame Propertiesdialog (double-click the keyframe)5. Assign a sound to the frame (click the Sound tab and choose a sound from the pop-up menu)You can also drag and drop soundsfrom the Libraryonto the Stage, but onlyif the active layer alreadycontainsa

    keyframe. Flash will place the sound at the nearest previouskeyframe in that layer.

  • 7/28/2019 Sound in Flash

    3/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 2

    Tweaking in the Frame Properties DialogThe Frame PropertiesDialog letsyou change the propertiesof soundsin a surprising number of ways:

    Envelope control handlesgive you precise control of fade-in and fade-out, aswell asvolume level. Even better,

    the envelopescan varythe position of monaural soundsbetween the Left and Right channelsof a stereo field.

    You get the impact of stereo, but save half the file size byusing mono.

    The Time In and Time Out controlslet you change where playback of the sound will start or stop. Combine

    thiswith the volume envelopes, and it becomeseasyto squeeze a varietyof sound effectsfrom one file.

    You can set a sound to loop a specified number of times. Even better, you can tweak the envelopesover the course

    of the entire sequence of loops( see Figure 1 below).

    Figure 1. The Frame PropertiesDialog

    Heresan example of envelopesaffecting a looped sound. The sound hasbeen set to loop four times, and the

    Envelope hasbeen set to pan the sound between channelsthen fade out. Click hereto hear the example.

    When possible, avoid using the Time In and Time Out controlsto crop silence from the beginning and ending of

    files. Instead, use an audio editing program like Sound Edit 16, Peak or Sound Forge to remove anyleading ortrailing silences, and to verifythat the audio iscropped asclose to the endsaspossible to reduce file size. The

    waveform displayin Flash isslightlyinaccurate. What lookslike a flat line of silence in a Flash waveform may

    actuallycontain audio content.

    On the plusside, Flash onlyexportsthe audio thatsbetween the Time In and Time Out controls. Thiscan be

    handyfor quick and dirtyeditson sound files. Still, itsbest to edit soundsbefore importing.

  • 7/28/2019 Sound in Flash

    4/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 3

    The Frame PropertiesDialog also letsyou select one of four optionsfor synchronizing sound

    with animation:

    Eventsync triggerssoundsat a specific keyframe. Thisisuseful for button clicksand sound

    effectsthat are related to animation. Event soundsalwaysplaythrough to the end of the

    sound, unlessspecificallystopped bytheStopoption (see below) or aStop all SoundsFrame

    action. You can playmultiple instancesof an Event sound byretriggering the sound in subsequent keyframes.

    For example, imagine the whoosh sound of numerouscarsdriving by. An Event sound letsyou use the samesound multiple times, without cutting off the previoususe of the sound.

    Streamsync locksthe animation to the sound, forcing Flash to drop framesif the picture fallsbehind the

    sound. Thisisuseful for locking longer sequencesof sound and animation. Dont be fooled bythe name,

    though. Stream soundsdont actuallystream the audio acrossan Internet connection in the same waythat

    QuickTime, RealAudio and Shockwave Audio provide streaming. Instead, think of Stream soundsasproviding

    a QuickTime-style abilityto lock the audio and animation into a synchronized stream of media. A major

    drawback of using Stream sync isthat Flash doesnt reuse the audio. For example, if you place two instancesof

    a 20-second Stream sound in the Timeline, Flash will create 40 secondsworth of data when saving the final

    playback version of the file. The flip side of thisbehavior, however, can be a real bonus. Letssayyoure

    creating a complex mix of music, voice and sound effectsthat lastsfor one minute. With Stream sounds, you

    can do whatever you want for that minute: no need to reuse the same soundsover and over, or have looping

    music or ambience. Once youve paid the price of admission (i.e. larger file size), you can layer all the sounds

    you want, since the result will be mixed to a single audio stream. In some cases, if youre using a whole bunch

    of event sounds, you might actuallysave space byswitching to Stream sounds.

    Startworkslike an Event sound, but if a sound isalreadyplaying, it wont retrigger a new instance of the

    sound. Look out!Thisisincorrectlydescribed in the Flash 3.0 documentation, but correct in the Flash 2.0

    docs.Startcan be useful if you want playback to jump to another frame, but not interrupt the sound.

    Triggering two instancesof the same voice or music file would result in simultaneousplayback of two copiesof

    the file (great for creating crowd scenesor avant garde music, but not much help otherwise!) .

    Stopcutsoff an Event sound at a specific keyframe. Thisishandyfor cutting off long Event soundswhen a useraction forcesplayback to jump to a new location, or when a long or looping sound needsto stop at a specific

    point to match the animation. Used wisely, Stop can greatlyimprove the synchronization of sound with

    animation, since Flashsframe rate can varydue to processor speeds, animation complexity, modem speeds,

    and the amount of Web traffic at anygiven time.

    In most situations, Event sync isthe most common setting. Event sync makesthe most of Flashsabilityto

    repurpose soundswith a varietyof Frame Propertysettings, so use it whenever possible. Also, the functionalityof

    Stream sync indicatesthat it could be most useful for forcing synchronization between animation and long

    segmentsof dialog or music. In practice, however, Flashsaudio compression schemescompromise the qualityof

    the audio to such an extent that itswise to avoid using Flash asa deliverystrategyfor long segmentsof dialog or

    music over standard Web connections(for workaroundsin Flash, see the section below on Shockwave Audio and

    the Flash Asset Xtra). If youre planning on delivering Flash content over an Intranet or other local deliverymechanism, you can get awaywith using the higher qualityaudio compression options. To get a better grasp on

    thisissue, letsexplore compression optionsin Flash.

  • 7/28/2019 Sound in Flash

    5/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 4

    The Sound Properties Dialog - Making or Breaking your AudioFlash usestwo techniquesto reduce the size of audio data in presentationsastheyare exported to the Shockwave

    Flash format for deliveryon the web:downsamplingandADPCM compression. These settingsare applied in theSound Propertiesdialog. You can improve the perceived qualityof your Flash audio byunderstanding and working

    within the limitationsof these audio processes. Or, to look at it from the negative angle, applying the wrong

    settingscan leave you with horrible soundtracks.

    Downsamplingmakesfilessmaller byreducing the number of samplesper second. For example, the standard

    sample rate for audio CDsis44,100 samplesper second (i.e. 44.1 kHz). Flash can downsample to ratesof 22, 11

    and 5.5 kHz. Higher sample ratesallow for more high-frequencycontent to be represented in a sound file. Here

    are some general guidelinesfor comparing the qualityof varioussample rates:

    44.1 kHzsoundsgreat, just like CDs

    22 kHzisfine for most multimedia applications, similar to FM radio

    11 kHzoffersa heavilymuffled but intelligible representation of a sound

    5.5 kHzcan conveybonks, thumps, and other low frequencysounds, but not much else

    Click on anyof the sample ratesto hear an example of how the ratesaffect a file containing voice mixed with music.

    You can also choose between stereo or mono for each sample rate. In almost all cases, youll probablywant to

    choose mono to save space. Stereo could be useful for music, but it will double the size of the audio data. Instead,

    tryto create stereo effectsusing the Envelope handles, asdescribed in the previoussection.

    ADPCM compressionmakesthe file smaller byreducing the number of bits(onesor zeroes) used to store the data.

    ADPCM usesmathematical formulasto reduce the number of bitsrequired in a signal. Most multimedia developers

    are familiar with 4:1 ADPCM compression schemeslike QuickTimesIMA, or MicrosoftsMS-ADPCM. When these4:1 compressorsare applied to a 16-bit sound (the standard for audio CDs), the result isa 4-bit sound. Keep in

    mind that, thanksto the use of ADPCM, this4-bit compressed audio still soundsmuch better than the old

    uncompressed 8-bit standard that manyof uswere familiar with in yearspast. Flash providesADPCM compression

    from 2-bit to 5-bit ( i.e. from 8:1 to roughly3:1). Higher bit ratessound better. Asyou move toward lower bit rates,

    distortion becomesmore pronounced. At the bottom end, 2-bit compression soundslike a scratchyold record.

    Itshard to overemphasize the importance of using the Sound Propertiesdialog to applycustom sample rate and

    ADPCM compression settingsto each sound in your presentation. DONT export all your soundsusing the Default

    rate pop-up menusin the Export dialog. You should ALWAYS audition soundsin the Sound Propertiesdialog, and

    experiment with compression settingsand sample ratesto get the best resultsfor each individual sound. There will

    be tradeoffsbetween size versusquality, and youll have to use your earsto judge which settingsare appropriate for

    which sounds. Using the Default export valuespracticallyguaranteesthat some of your soundswill be horriblycompromised, while othersmaytake more space than necessary.

  • 7/28/2019 Sound in Flash

    6/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 5

    To applya specific sample rate and ADPCM compression setting:

    1. Double-click a sound in the Librarywindow to bring up the Sound Propertiesdialog.2.

    Choose a sample rate and bit depth (11 kHz mono, 3-bit isa good place to start)3. Click the Play button to audition the sound.4. Doesit make you cringe? If so, increase the sample rate or bit depth. If not, tryreducing them further.Watch out when auditioning sounds! You wont reallyhear the effect of anysample-rate changesor ADPCM

    compression when the sound playsin the timeline, or when you playit using the Playbutton found at the top of

    the Librarywindow. You also wont hear the effectsif you leave the Default settingsactive in the Sound

    Propertiesdialog -even if you previously chose settings when exporting a movie!The ONLY wayto know how

    your audio will sound when itsplayed back in a browser isto applysettingsin the Sound Propertiesdialog, and

    preview the sound in that dialog.

    Experiment with nudging the sample ratesand bit depthsup and down, and test the result. If a sound seemstoo

    muted at 5.5 kHz and 3-bit ADPCM, it might sound better at 11 kHz and 2-bit ADPCM, and the result wont be toomuch larger. Increasing the sample rate can also significantlyreduce distortion at a particular bit depth. Keep in

    mind that setting the sample rate higher than the rate of the original source file wont improve quality. Once a file

    hasbeen downsampled, the extra audio data isgone for good, unlessyou go back to the master source files(you

    arearchiving your source filesat 16-bit, 44.1 kHz, right?). The chart below (Figure 2) can help you determine which

    combination of settingswill result in the smallest file.

    Sample # kBits/ kBytes/

    Rate Bits second second

    44.1 5 220.5 27.563

    44.1 4 176.4 22.050

    44.1 3 132.3 16.538

    44.1 2 88.2 11.025

    22.05 5 110.3 13.781

    22.05 4 88.2 11.025

    22.05 3 66.2 8.269

    22.05 2 44.1 5.513

    11.025 5 55.1 6.891

    11.025 4 44.1 5.513

    11.025 3 33.1 4.134

    11.025 2 22.1 2.756

    5.5 5 27.5 3.438

    5.5 4 22.0 2.750

    5.5 3 16.5 2.063

    5.5 2 11.0 1.375

    Figure 2. File sizesat varioussample ratesand ADPCM bit depths.

  • 7/28/2019 Sound in Flash

    7/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 6

    Here are some tipsfor setting export optionsfor sounds:

    Higher compression ratios( 4-or 5-bit) are better for longer sounds. With shorter sounds

    (button soundsand short sound effects), itseasier to get awaywith lower ratios(2-or 3-

    bit) , since the listener haslessof an opportunityto perceive the distortion. For example,

    there might be one or two distorted glitchesin a button sound, but the sound playsso

    quicklythat the listener islikelyto think that the glitcheswere actuallypart of the sound. Longer sounds

    (music, voice or ambient effectslike wind or citytraffic) give the listener more of an opportunityto perceivehow the audioshouldsound, and allowsmore time for crackling distortion to become apparent.

    Lower compression ratiosare more effective on soundswith veryabrupt or chaotic waveforms(like crackling

    fires, crashes, explosionsor the clickety-clack of train wheels), and are lesseffective on soundswith consistent,

    predictable, smooth waveforms(like wind, waves, or musical tones). Soundsthat a listener would

    reasonablyexpect to be loud or distorted are perfect candidatesfor 2-bit ADPCM.

    Dont use 8-bit samplesinstead of 16-bit samplesto save space. The ADPCM compression routineswork from

    16-bit data. If you import 8-bit samples, theyll just be converted to 16 bitsbefore compression isapplied. All

    the quantization noise and distortion found in 8-bit sampleswill be carried into the Flash file.

    Tryto use higher sample rateswhen itsimportant to retain high frequencycontent (bells, etc). Be especiallycareful when applying low sample ratesto these typesof sounds, asit can create strange aliasing effects. This

    wasparticularlyproblematic in Flash 2.0, and while itsimproved in Flash 3.0, the aliasing artifactsstill exist. If

    you know that a sound isdestined to be set to sample ratesof 5.5 kHz or 11 kHz, you can often get better

    resultsbydownsampling the audio in a separate audio editing program (likeSoundEdit 16 or BIAS Peak), then

    importing the result into Flash.

    When creating lotsof audio for larger projects, consider creating a separate Libraryof soundsthat have your

    preferred sample ratesand bit depthsapplied to them. Give the Libraryfile to the artistsand programmersto

    assure that soundswill be exported with the proper settings. Of course, thisassumesthat the Override sound

    settings option isnt selected in the Export dialog.

    Dont forget the distinction between settingsapplied to soundsin the Library (i.e. sample rate and bit depth for the

    exported sound data) vs. settingsapplied to soundsin the Timeline ( instancesof a sound from the Library, with

    different start and stop pointsand volume envelopesfor each instance). The sample rate and bit-depth options

    selected in the Sound Propertiesdialog are applied to everyinstance of that sound in the Timeline. To make an

    analogywith Flash graphics, soundsbehave like Symbolsin the Timeline : theyre both instancesof objectsfrom

    the Library, and can have multiple attributesapplied to them at different pointsin the Timeline. Export settings, on

    the other hand, have a similar effect with both soundsand JPEG imagesin the Library. Theycan have multiple

    instancesin the Timeline, but compression settingsapplied to the parent in the Libraryare applied to all the

    child instancesin the Timeline.

    Design StrategiesItsa big challenge to pack a compelling multimedia experience into a small file. Flash moviescan be incredibly

    compact, thanksto the efficiencyof vector graphics. Add a bit of audio, on the other hand, and your file size can

    quicklyget out of control. In Flash thissometimesleadsto one of three results: (a) reuse the same piece of audio

    over and over until the repetition drivespeople crazy; (b) compressand downsample the audio until it sounds

    atrocious; or (c) after experiencing # 1 and # 2 several times, avoid using audio altogether.

    Luckily, Flash providesenough flexibilitythat, with a bit of creative design, you can get a lot of mileage out of just a

    few well-chosen sounds. Flash letsyou reuse a sound asmanytimesasyou like, but it onlyhasto download once

  • 7/28/2019 Sound in Flash

    8/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 7

    (unlessyoure using Stream sync, asdescribed earlier) . Once youve paid the price for that

    download, itsin your best intereststo figure out how manytimesthe sound can be used in an

    interesting way. Bycombining Flashsabilityto mix sound layersin the Timeline, and the ability

    to applydifferent start/stop pointsand volume envelopesto each instance of a sound, you can

    create some prettycompelling effects. The combined abilityof these two methodsisnot too far

    removed from the capabilitiesof multi-track audio editing and mixing programslike SoundEdit

    16 or Deck. In fact, it putsFlash far ahead of Macromedia Director! Here are some ideas:

    Layering

    Create subtle variationsin the tone of a sound effect bylayering a short quiet sound beneath the main effect. For

    example, Figure 3 showsa tinyblip created from a section of voiceover.

    Figure 3. A tinysection of voiceover or other audio content addsdepth to abutton click sound.Click one of the following to hear a sample of vocal button clicks: vox1, vox2, vox3, vox4

    Playing two or three of these veryquiet effects, layered with a prominent button click sound, createsa small suite of

    related soundsthat would be much more interesting to listen to than a simple click. Practicallyanysound will do

    for an application like this. If youre drawing from voice asa source, tryto find soundscreated bypronouncing the

    lettersB, K, T, P for percussive effects, and use S or Z to add a brighter tone. Pan the sound to one side of the

    stereo field to enhance the perception of depth that the layer addsto the original sound

    Heresanother example of the layering technique. Everyone knowsthat in the real world, we rarelyhear the exact

    same sound twice. Think of footstepscrossing a room, someone knocking on a door, or objectsfalling to the

    ground with a plop. Theresalwaysa bit of variation in the real world, and when we hear the exact same sound

    repeatedly, it reinforcesthe realization that were hearing something canned and artificial. Working with the

    example of footsteps, imagine starting off with four distinct footstep samples, all similar, but with slightlydifferent

    tonal qualities. If we just loop the four footstepsover and over, it would sound prettydull: 1-2-3-4-1-2-3-4, etc., ad

    nauseum. But with layering, we can extend the depth of the sound without making the file anybigger, for example:

    Foreground sound layer: 1 -2 -3 -4 -1 -2 -3 -4 -1 -2 -3 -4 (click hereto hear a static, repeated loop)

    Background sound layer: 3-4 -1 -2-4 -3 -1 -2 (click hereto hear a layered loop)

  • 7/28/2019 Sound in Flash

    9/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 8

    Taking thisa step further, altering the volume level of each instance of either layered sound will

    create a slightlydifferent tone to the resulting mix of sounds. To borrow a graphic metaphor,

    think of it asvarying the transparencylevelsor brightnessof two superimposed colors. Each

    variation createsa slightlydifferent shade.

    Retrigger and Layer Wisely

    If you need to create a looping ambience for a scene (i.e. waves, a rushing river, wind or citytraffic) , dont just loop

    the same sample over and over. Create several instances of the ambience on separate layers. Give each one a

    different start and stop time. Let some of them fade in or out quickly, and have othersfade in or out slowly. Copy

    them out several timesacrossthe two layers, and adjust their start timesto create a continuousambient

    soundtrack. Take advantage of Flashsabilityto retrigger a sound multiple timesin the same layer to create variety.

    TheStop All SoundsFrame action can come in handyhere, when you need to stop all the soundsat once.

    Create a Sound Palette

    Since Flash isso accommodating in reusing sounds, it paysto spend some extra time considering which soundsare

    most useful asraw material for slicing into tinysegmentsand layering against other sounds. Look for soundsthat

    have a lot of sonic variationsin a short period of time. Tryto find a balance of soundsacrossthe entire spectrum:

    some with high frequenciesor lotsof sizzle, and otherswith plentyof low frequencyand kick. Thisgivesyou

    more optionsfor altering tones. For example, I once worked on an animation that included lotsof impacts,

    chewing, crunching bones, and rustling plants. I wasable to tweak one sound (the crackling of a falling tree) into

    all of these effectsthrough careful use of layering and volume control.

    Work With Distorti on

    If youre likelyto end up with distortion, whynot use it to your advantage? For example, the effect of a car crash or

    falling tree often seemslifelesswhen brought down to a sample rate of 5.5 kHz. The downsampling removeshigh

    frequenciesfrom the signal, so we dont hear the crack of branchesor the crunch of breaking glass. The distortion

    created by2-bit ADPCM actuallyhelpsthese kindsof effectsto sound more natural because it addsthe snap and

    crackle back into the signal. If youre going to use music samples, maybe you should go out of your wayto find one

    with lotsof distorted guitar!

    Spend Your Budget Wisely

    It can payoff to use higher qualitysettingsfor soundsthat are used all the time. For example, the perceived quality

    of your audio maygo up quite a lot if you use a setting of 22 kHz and 2-bit ADPCM for a veryquick mouseclick.

    Thiswill preserve the crisp high frequenciesof the signal, while the distortion created bythe 2-bit compression is

    likelyto get lost in the sound of the click. If usersare going to be generating lotsof mouseclick sounds, it could be

    worth using a few extra bytes.

    Build Complex Sequences wi th Loops and Stop Sync

    You can achieve great synchronization between effectsand animation using loopsand Stop sync. Heresa tip from

    Dave Hollinden, Audio Engineer atJet CityStudios(a fabulousgroup of Flash developersin Seattle). Dave wantedto create the effect of a fanfare, followed bya drum roll, followed bya rimshot when the user clicked a button.

    Launching the fanfare waseasy-just add the sound to a layer. Launching the drum roll waseasy, too -create a

    short drum roll loop and set it to play100 times. The nice trick wasresponding to the usersmouseclick. Playback

    jumped to another frame with a Stop sync event applied to the drum roll, while the rimshot wastriggered in

    another layer.

    http://www.jetcitystudios.com/http://www.jetcitystudios.com/
  • 7/28/2019 Sound in Flash

    10/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 9

    Flash Synthesis

    While were on the subject of loops, you can actuallyuse Flash asa synthesizer that generates

    tonesfrom looping. Anylooped waveform playsat a pitch which isdetermined bythe length of

    the waveform: the shorter the loop, the higher the pitch of the tone. Set the Start and Stop

    pointsasclose together asyou can manage, then crank the number of loopsup to 15 or more.

    Remember, you can adjust the volume Envelopesacrossthe entire seriesof loops, so the tone

    can fade in or out aswell aspan acrossa stereo field. For an example, see Figure 4.

    Figure 4. Flash synthesis can be created using tinylooped sectionsof a waveform.

    Click hereto hear the sample above, or click herefor a different sample.

    Cheesy Elvi s Reverb

    Ever hear the slapback delayon old Elvisrecords? You can add a similar type of ambience to an effect by

    retriggering it in multiple frames. Recall that soundsplayed with Event sync playall the waythrough to the end,

    and retriggering that sound in another frame will actuallylaunch a new instance of the sound instead of cutting the

    existing sound off. Use thistechnique to create several echoes of a sound, and experiment with the placement of

    the soundsto build echoing effectsranging from small concrete chambersto large canyons.

    Use Director and the Flash Asset Xtra to Play Shockwave Audio

    While Flashsaudio compression isnt state of the art, you can take a roundabout route to enjoythe superior

    performance of Shockwave Audio ( SWA) , a variant of MP3 thatsbuilt into Shockwave for Director. The Flash Asset

    Xtra letsyou playFlash moviesfrom within Director ( the Flash movie can either be linked externallyto the Director

    movie, or embedded right into Directorscast) . You can send Lingo commandsfrom Flash to Director by

    embedding the text of the Lingo command in the GetURL portion of FlashsInstance Propertiesor FramePropertiesdialog. In thiscase, sending a Lingo puppetsound command at a particular frame or button action could

    trigger playback of a SWA file. The exact stepsare described in more detail in the Director documentation. This

    approach maynot be feasible in some situations. Designersmayprefer to stayentirelyin the Flash environment,

    and use the smaller Flash plug-in instead of the larger Director Shockwave plug-in. Complex presentationsmay

    suffer a bit from the extra overhead of playing Flash within Director. But when audio qualityisat a premium, the

    abilityto playSWA could be a helpful alternative.

  • 7/28/2019 Sound in Flash

    11/11

    Apple Worldwide Developer Relations Using Sound in Macromedia Flash 10

    You maybe wondering, Whydidnt Macromedia use SWA in Flash instead of downsampling and

    ADPCM? Apparently, the amount of code required for SWA would double the size of the Flash

    plug-in. Macromedia isreluctant to make userswait twice aslong to download the plug-in just to

    boost the audio quality. But theyare committed to improving audio performance in future

    versionsof Flash. Well have to wait and see.

    Using RealFlash

    Another option for playing Flash content isthe RealFlash player from RealNetworks. Developed jointlybyMacromedia and RealNetworks, RealFlash convertsFlash animationsand soundtracksinto linear, streaming

    animationswith synchronized sound. Heresone place where FlashsStream sync option isveryuseful, since it

    providesthe same type of linear, synchronized playback that one can expect when watching a RealFlash movie.

    Stream sync makesit possible to tweak a soundtrack to fit animation, and be sure of a similar result once the

    resulting RealFlash movie hasbeen compiled. The one drawback of RealFlash filesisthat audio qualityispoor on

    slower modem connectionslike 28.8. While traditional RealAudio filescan use all the bandwidth of the modem,

    RealFlash movieshave to split the bandwidth between graphicsand audio. For more information on creating

    RealFlash, check out the Resourcessection below.

    Summary

    Flash hasthe potential to create compelling soundtracksif you take the time to become familiar with itscapabilities.There are three keyareasfor tapping thispotential: 1) creating multiple instances of sounds, with unique

    envelopesand start/stop pointsfor each instance; 2) setting Export optionsfor each sound; and 3) layering multiple

    soundsin the Timeline. You have to be careful with Flashsaudio compression scheme, but even thisweak spot

    can be used to your advantage in some situations. I hope the techniquesin thisarticle will give you some new ideas

    when the time comesfor you to set out on your next web adventure with Flash.

    Resources

    Macromedia http://www.macromedia.com

    Flash Central http://www.flashcentral.com

    RealFlash http://www.real.com/devzone/library/creating/flashSound Forge http://www.sonicfoundry.com

    BIAS Peak and Deck II http://www.bias-inc.com

    For more information on multimedia audio basics, check out mybook, Multimedia Sound and Music Studio.

    Special thanksto Dave Hollinden atJet CityStudiosfor a rollicking round of tip-swapping!

    About the Author

    Jeff Essex, Creative Director ofaudiosyncrasy, specializesin digital audio and MIDI to create music, sound effects

    and voiceover for multimedia. In addition to hiscreative and audio engineering skills, he isintimatelyfamiliar with

    multimedia toolsand technology. A veteran of MacroMind and Macromedia, he served two yearsasTechnicalSupport Lead for Macromedia Director and SoundEdit. He iscredited on over 40 CD-ROM titles, including products

    from Virgin Sound and Vision, CorbisProductions, Mindscape, 3DO, and DisneyInteractive. For the past year he

    hasworked asthe primarycomposer and audio consultant for the leading childrensinteractive web site. Hisbook,

    Multimedia Sound and Music Studio, (Random House/Apple New Media Library,1996) isthe definitive guide to

    multimedia audio production. It won the Computer PressAward for Best Advanced How-To Book of 1996.

    http://www.macromedia.com/http://www.flashcentral.com/http://www.real.com/devzone/library/creating/flashhttp://www.sonicfoundry.com/http://www.bias-inc.com/http://www.audiosync.com/book.htmlhttp://www.audiosync.com/book.htmlhttp://www.jetcitystudios.com/http://www.jetcitystudios.com/http://www.audiosync.com/http://www.audiosync.com/http://www.audiosync.com/http://www.jetcitystudios.com/http://www.audiosync.com/http://www.audiosync.com/book.htmlhttp://www.bias-inc.com/http://www.sonicfoundry.com/http://www.real.com/devzone/library/creating/flashhttp://www.flashcentral.com/http://www.macromedia.com/