Flash CS3 sound tutorial: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 63: Line 63:
; Configuration of sounds
; Configuration of sounds
In the configuration panel you can change certain parameters and also edit a bit.
In the configuration panel you can change certain parameters and also edit a bit.
* Sync: Sound is synchronized with the timeline. You may have to extend sound  time line. Hit F5 somewhere.
 
Sync: Will defined how sound is synchronized with the timeline.
* Event: Sound plays by itself until its done (independently of the rest)
* Event: Sound plays by itself until its done (independently of the rest)
* Start: Will only play the sound once.
* Start: Will only play the sound once when the first frame loads
* Stop : Will stop the sound (therefore include it before or after a sound frame.
* Stop : Will stop the sound (therefore include it before or after a sound frame.)
* Stream: Will try to match the length of sound until the end of the animation.
* Stream: Will try to match the length of sound until the end of the animation.
Repeat:
* You can repeat the sound as many times as you like (or even have it loop forever).


=== To use it ===
=== To use it ===
Line 76: Line 80:


; Getting the Edit Envelope editor
; Getting the Edit Envelope editor
* Click in the sound layer.
* Click in the sound layer in some frame where you have sound
* In the Properties Panel, Click the ''Edit ...'' button next to the ''Effect:'' field
* In the Properties Panel, Click the ''Edit ...'' button next to the ''Effect:'' field
* This opens the '''Edit Envelope''' editor.
* This opens the '''Edit Envelope''' editor.


; Manipulation of the sound envelope
; Manipulation of the sound envelope
* You can drag left/right Time In and Time Out controls in middle pane
* You can drag left/right Time In and Time Out controls in middle pane. I.e. you can cut of sound from the either the beginning or the end of the sound track.
* You can drag down volume controls (black lines on top). Click to insert a new distortion point.
* You can drag down volume controls (black lines on top).  
** Click to insert a new distortion point.
** Up: means louder / maxium sound
** Down: means more silent / no sound
* Use the arrow (down left) to test
* Bottom right, there are zoom buttons and switch that either shows seconds of frames.


[[image:flash-cs3-sound-envelope.png|thumb|600px|none|Flash CS3 Sound envelope editor]]
[[image:flash-cs3-sound-envelope.png|thumb|600px|none|Flash CS3 Sound envelope editor]]

Revision as of 16:37, 22 September 2007

<pageby nominor="false" comments="false"/>

Overview

This is part of Flash CS3 tutorials. Daniel K. Schneider 18:13, 9 September 2007 (MEST). It is not very complete

Learning goals
Learn how to use sound with Flash 9 (CS3) components
Learn a little bit of Action Script 3
Prerequisites
Flash CS3 desktop tutorial
Flash drawing tutorial
flash layers tutorial
flash button tutorial
Moving on
The Flash article has a list of other tutorials.
Flash Video component tutorial
Quality
This text should technical people get going and may not be good enough for self-learning beginners. It can be used as handout in a "hands-on" class. That is what Daniel K. Schneider made it for...
Level
It aims at beginners. More advanced features and tricks are not explained here.
Learning materials

Grab the various *.fla files from here:

http://tecfa.unige.ch/guides/flash/ex/sound-intro/ (not yet sorry)

Basics

Sound types

Flash can handle several sound formats:

  • AAC (Advanced Audio Coding):
  • AIFF (Audio Interchange File Format) - Mac only ?
  • MP3 (Moving Pictures Expert Group Level-Layer-3 Audio)
  • AVI (Audio Video Interleave)
  • WAV (Waveform Audio Format)
  • AU (Sun)

(Some formats may depend on whether QuickTime is installed on your computer).

Best bet is to use MP3 format, since it is very popular. E.g. it is easy to find music or sound textures on the Internet.

Import sounds into the swf file

Background sounds

To import (small) sound files
  • File->Import->Import To library (or drag and drop).

Attaching sound to a frame

Create a new layer and import sound to a frame
  • You can attach sound to any frame via the properties panel
  • Select a sound from the sound pull-down menu
  • Configure it in the same panel
Configuration of sounds

In the configuration panel you can change certain parameters and also edit a bit.

Sync: Will defined how sound is synchronized with the timeline.

  • Event: Sound plays by itself until its done (independently of the rest)
  • Start: Will only play the sound once when the first frame loads
  • Stop : Will stop the sound (therefore include it before or after a sound frame.)
  • Stream: Will try to match the length of sound until the end of the animation.

Repeat:

  • You can repeat the sound as many times as you like (or even have it loop forever).

To use it

As mentioned above, you can add sound to any frame you like. As always, we suggest that you add a new layer.

  • Then you can tune parameters or even edit the sounds a bit (see below)

Editing sounds

Getting the Edit Envelope editor
  • Click in the sound layer in some frame where you have sound
  • In the Properties Panel, Click the Edit ... button next to the Effect: field
  • This opens the Edit Envelope editor.
Manipulation of the sound envelope
  • You can drag left/right Time In and Time Out controls in middle pane. I.e. you can cut of sound from the either the beginning or the end of the sound track.
  • You can drag down volume controls (black lines on top).
    • Click to insert a new distortion point.
    • Up: means louder / maxium sound
    • Down: means more silent / no sound
  • Use the arrow (down left) to test
  • Bottom right, there are zoom buttons and switch that either shows seconds of frames.
Flash CS3 Sound envelope editor

Load and play sounds with ActionScript

ActionScript 2 example

This starts playing sound on load

var mySound:Sound= new Sound();
mySound.loadSound("track.mp3" , true);
mySound.onLoad = function() {
mySound.start();
}
Embedded ActionScript 3

Insert this kind of code with F9 in the same frame where you want to use it with other code.

To load a sound from an external file

var request:URLRequest = new URLRequest("track.mp3");
var your_sound:Sound = new Sound();
your_sound.load(request);

To play it:

your_sound.play();

To play 5 loops:

your_sound.play(0,5);

To stop all sounds (this is a static method, just insert the line as is).

SoundMixer.stopAll();

For an example, see Flash drag and drop tutorial, flash-cs3-drag-and-drop-matching-3.*

Links

Sound textures to download

Documentation

  • Sound (Adobe AS3 reference)