Flash Sound
syllabus | schedule | assignments | Web Resources | ARTC courses
[Flash Intro]     [Drawing]     [Other Tools]     [Modify/Import]     [Symbols]     [Animation]     [Navigation]     [Publishing]    [ActionScript]     [Textboxes]     [Conditionals/Loops]     [Functions]     [Audio]     [Timing]     [Interaction]    [KeyPressed]    
Importing and Converting Audio

For class, sound editing programs: GARAGEBAND (mac) or SOUND FORGE (pc).

You can download copyright-free audio from Bonnie's audio resources:

http://digitalarts.bgsu.edu/mitchell/Fall04/artc400_1/links.html

Sound files can be imported from CD also, but you should get in the habit of using copyright-free files and/or creating your own audio files from mixing sounds.

** Sound Forge does not support MP3s, which happens to be the best choice when working with Flash because of the small file size. Other usable formats include: AIFF, WAV, QuickTime movies with sound and Sun AU format.

If you would like to use MP3s in your Flash movie to keep file size down, convert your audio files (after editing in Sound Forge):

  1. Import file into iTUNES.
  2. iTUNES > preferences > importing: set encoder type for "Import Using" to the desired file format and click OK.
  3. Select your audio file in iTUNES: ADVANCED > convert.
  4. To find the converted file, you need to go into your account > music > iTUNES > iTUNES Music and find the folder the file is in.

 

Bit Rate and Sampling Rate

Bit Rate - number of bits transferred by a digital device. Generally, higher bit rate equals better quality. Common bit rates are 8 and 16. <audiovideo101.com/dictionary>

Sampling Rate - the rate at which samples (periodic snapshots) of an analog signal are taken in order to be converted into digital form. Common sample rate for CDs is 44.1 khz. <webopedia.com>

 

Audio in Flash

  • File > Import to Library.
  • Create a new layer called Sound in your timeline to place your sound into. It is a good idea to put your sound layers at the bottom of the timeline.
    • Create a New Keyframe (F6)
    • Drag your sound file from the Library to the Stage.
    • Lock your layer to prevent accidentally adding graphic elements.
    • To view your sound wave:  Modify > Timeline > Layer > Layer Properties - Height = 200 or 300%
  • Each Layer can contain only one sound, so if you want more than one to play simultaneously, you must create new layers for each one.

Using the Property Inspector to Add Sound

  • Instead of dragging a sound file from the library to the stage, click and highlight the keyframe where you want the sound.
  • In the Property Inspector, select the Sound from the drop-down menu.

Adding Sounds to Buttons

  • Double-click the button you'd like to add sound to (in Library for symbol, on Stage for instance).  This throws you into Symbol Editing Mode.
  • In the button's timeline, add a new layer called Sound.
  • In the Sound Layer, select the Over and Down Frames and Insert > Blank Keyframe.
  • Drag your sound file from the library onto the Stage for each state you desire sound.
  • To test: Control > Enable Simple Buttons.

Event Sounds

In the Property Inspector, you have four Sync Settings: Event, Start, Stop and Stream.

Event sounds play in their own timeline, playing until Flash reaches the end of the sound clip or encounters an instruction to stop playing. If your movie loops, every time the playhead passes a frame with the event sound, Flash starts another instance of that sound playing (WATCH OUT! You can get some weird effects when a sound keeps playing on top of itself.)  Also, use Event sounds for short clips. Flash pauses to load each sound, which interrupts play.

Start sounds are just like Event sounds EXCEPT Flash does NOT play a NEW instance of a start sound if that sound is already playing (no overlap). Use for Looped frames, especially.

Stream sounds are broken into smaller clips. They can be synchronized to specific frames of the movie. Flash stops streaming sound when playback reaches a new keyframe or an instruction to stop. Streaming sounds don't have to download fully to start playing, they start playing after a few frames have loaded. They are best for long sounds.

Stop forces a sound to stop at a specific keyframe.

Making a Streaming Sound

  • Insert a Blank Keyframe where you'd like your sound to start.
  • In the Property Inspector, choose Sound: File Name.
  • In the Property Inspector, choose Sync: Stream.
  • To see how the sound fits into the available time in your movie, click Edit… in the Property Inspector. The Edit Envelope window appears. A vertical line indicates where Flash cuts off the sound.
  • The truncated waveform appears in your timeline. Play the movie to hear it.
    • If you find the streaming sound cutting off too soon, switch the units of measure in the Edit Envelope window to FRAMES (lower right) to see how many frames to add to accommodate your sound.
    • You can scrub audio by dragging the playhead in the timeline. Use this to test image/sound sync. Then add or delete frames to better synchronize your images.

To STOP a Sound at a Certain Frame

  • Insert a new keyframe where you want the sound to stop playing.
  • In the Property Inspector, Sound: None, Sync: Stop; a square appears in that frame.
  • Play your movie to hear how sound stops at that frame. 

Looping Sound

  • In the Property Inspector, enter Loops: #; Flash extends the waveform in the timeline

Assigning a Predefined Volume Effect

  • Select the Keyframe that contains the sound you want to change
  • Property Inspector: Edit…
    • Edit Envelope window.
  • Effect: Choose effect.
    • Flash adjusts the sound envelope, shown by the box and vertical line.
  • Click Play button to hear effect.
    • You can also just choose an Effect: from the Property Inspector

 

Sound Objects: recommended for added control of audio

First, we need to remember that each sound clip has 3 names:

  1. The original file name
  2. Its library name
  3. Its linkage identifier

Using a Sound Object, There are 3 steps to follow:

  1. Define a sound object: my_sound = new Sound();
  2. Attach sound data to the object. There are 2 ways to do this:
    1. my_sound.attachSound("soundName"); // attaches a sound from the library
    2. my_sound.loadSound("soundName"); // attaches a sound from an external file
    • my_sound is the sound object's name
    • attachSound and loadSound are methods for attaching sound data
    • "soundName" is the linkage identifier or filename
  3. Use the object's methods to control the sound:

    EX:

    function playSound(){ // arbitrary function for demo purposes

    // starts sound at 0.5 seconds and loops 3 times
    // you don't need the linkage identifier for start

    my_sound.start(0.5, 3);

    }

    EX:

    function playSound(){ // arbitrary function for demo purposes

    // you do need the linkage identifier for stop
    // if you don't include it, all sounds will stop

    my_sound.stop("soundName");

    // before calling a sound to start, you should make a stop call, otherwise you
    // will fill the 8 sound channels with duplicates and end up with an echo

    my_sound.start(0.5, 3);

    }

More Sound Object Methods

  • Volume: my_sound.setVolume(0);
    • sets sound object's volume from 0% (silence) to 100% (maximum Sound)
  • Pan: my_sound.setPan(0); // 0 gives equal balance to right & left speakers

    my_sound.setPan(-100); // -100 gives full balance to left speaker

    my_sound.setPan(100); // 100 gives full balance to right speaker