updated 27 sept 2002 | brown | green | blue | grey
daryl croke
research diary
edim 2002

Week 9:

Audio Narration Using Flash MX.

During the week narration for the web site project was recorded at Victoria University. I would like to thank and acknowledge the following people.

Ben Dudding: Sound Technician
Jennie Swain: Direction
Leon Teague: Male Voice Actor
Suzi Dougherty: Female Voice Actor

The audio recorded was of excellent quality apart from some digital distortion. I was able to clean up the audio in Pro Tools. Below is a screen grab from Pro Tools showing an example of digital distortion. Notice how the top of the wave appears to have been chopped off. It should like a hill with a round top.

Distorted Wave.
Distorted wave

I was able to use the pencil tool to redraw the wave and eliminate the distortion.

Redrawing wave
Redrawing wave

Redrawn wave.
Redrawn

Building an audio console

I thought it would be nice to build a function in flash that would allow the user to play, pause, restart, step rewind and step forward. In other words I wanted to build the classic audio control console.
First step is to create a sound function.

function playSound() {
mySound=new Sound();
mySound.attachSound("MusicID");
mySound.start(secondOffset, loops);
}

The sound is assigned to the variable "mySound" and attached to an audio file with the value "MusicID".

Next step is to call the function when a button is released

// Action on play button
on (release) {
playSound();
}

Now we add a stop button and add a stop script

// To stop the sound
on (release) {
mySound.stop();
}

Simple enough but pausing and resuming the narration form that point is a bit tricky. We need to track the time and when the pause button is pressed capture the time taken and pass it to a variable, say "timeTaken". To resume playing at the desired point the start time of sound file should be the same as the variable "timeTaken".

Eg.
mySound.start(timeTaken, 0);

The actual maths to achieve this is a bit more complicated. Fortunately Flash MX comes with an example of a timer movie. The function used to track the time is called getTimer().

Below is the section of the script that displays the time.

function _root.onEnterFrame = function() {
totalTime = getTimer()/1000-pauseLength;
goTime = totalTime-buttonPressTime;
//
if (timing) {
hours = Math.floor(goTime/3600);
minutes = Math.floor((goTime/3600-hours)*60);
seconds = Math.floor(((goTime/3600-hours)*60-minutes)*60);
milli = Math.floor((gotime-(seconds+(minutes*60)+(hours*3600)))*100);
if (seconds<10) {
seconds = "0"+seconds;
}
if (minutes<10) {
minutes = "0"+minutes;
}
if (hours<10) {
hours = "0"+hours;
}
if (milli<10) {
milli = "0"+milli;
}
}
};

FlashMX Timer Movie.