Dynamic Audio Trilogy, part III: Getting Creative with Sound Effects

Introduction

Welcome to the final chapter in our Dynamic Audio Trilogy. In the first two tutorials we focused on using Chunked audio and Layered audio components to create more compelling and dynamic background soundtracks with a reduction in file size of up to 80%. Using these two component-based audio approaches, developers can mix and arrange tailored soundtracks within Flash by using it as a music sequencer. The benefit is to produce more interactive and custom-like soundtracks with greater impact than can be achieved with loops or streaming audio.

Chunks (inter-related, pre-mixed audio phrases) and Layers (individual instrument tracks which make up a groove) can be hard to come by. Traditional production music is "flat" and pre-mixed, and doesn't give you access to the raw audio components necessary to customize and reduce file size. Moreover, the overabundance of loops that are available on the internet cannot provide the breadth nor flexibility to create truly compelling audio.

If you are a musician, you can create component-based audio in a variety of music software packages, including Sonic Foundry's Acid, which does much of the compositional work for you and is already component, or loop-based. If you're not a musician, or don't have the time to create your own original score, you can purchase Sound Families(tm) from DoReMedia. Sound Families are composed by professional musicians, and have solved the tedious problems of properly editing and mastering your component audio files so that they transition seamlessly into the frame-based timing environment of Flash and other multimedia production tools. Sound Families provide the following time-saving advantages:

  • Sample accurate timing of components in multiples of length
  • Specific BPM (beats-per-minute) rates which are optimized for frame-based tools
  • Tools for determining compatible frame-rates, and synchronization and arranging tools to help Flash work as a music sequencer.
  • Modular phrasing which allows for Lego-like musical arranging
  • Mastered specifically for layered applications to reduce clipping and provide ease of mixing
  • Integrated sound effects which blend with chunks and layers and provide the element of interactivity

The last feature, integrated sound effects, is the topic of this tutorial.


Integrated Sound Effects

The sound effects that come with each Sound Family are short riffs or clips that are extracted directly from the instrument Layers. Every sound effect is, therefore, in the same key, timbre, instrumentation, and style as the overall piece. By using these integrated sounds for mouse events and transitions, rather than using unrelated sound effects, you can create much more cohesive and professional sounding interactive scores. Using stock sound effects such as booms, whooshes, and hits, that have no correlation to your background music and were not mastered to be sonically compatible, just makes your soundtrack sound shabby.


Event Sounds: Mouse-overs and Transitions

Generally speaking, there are two types of event sounds: 1) Mouse-over events, which occur, you guessed it, when the user mouses over a hot spot, and 2) Transitions, which occur most commonly on mouse clicks, but also can happen programmatically. The distinction between these two types of sounds is based on three sonic attributes: attack, rhythm, and blend.

Mouse-overs usually need to be soft-attacked, arrhythmic and high-blend, whereas transition sounds are usually more effective with hard-attack, and have more flexibility with regard to rhythm and blend. Of course, there are no hard and fast rules. This model assumes that you are working with a background music track and thus want mouse-overs to occur smoothly, on top of the music. Transition sounds, on the other hand, are often used to change scenes, and benefit by having a hard attack, which acts as a distraction to cover up the abruptness of a sudden stop or change in the background music.

The following is a simple illustration of this concept:

First, lets create a button with a soft-attack mouse-over sound attached to the "over" state of the button, and a hard attack transition sound to the mouse "hit" state. For the sake of illustration, I have imported two chunks and assigned one to frame one, and the other to frame five. Set the number of loops for each sound to a high number, so it will play continuously. On the next frame following each sound keyframe, insert a stop action. This will stop the playhead in order to wait for user interaction, but the sound will have already been triggered and continue to play. I have also added an instance of the button we just created at frame one and frame five. The frame one instance includes a "goto and play(frame 5)" action, and the frame five instance includes a "goto and play(frame 1)" action.

There's one more important thing we need to do. We need to tell the current playing loop to stop playing when the button is clicked so that we don't end up with a cachaphony of loops layering over one another. We could use a" stop all sounds" action for our button, but that would negate the mouse hit sound we just created. Instead, place the sound you wish to stop on the timeline, and set it's sync method to "stop".

[Watch Movie]

hint: In case you were wondering why we did this on the main timeline rather than attaching the stop sounds to the over or hit state of our button, the answer is that buttons do not allow multiple layers of sound, and therefore cannot render both our mouse-hit sound and stop sounds.


Using the Sound Object for Event Sounds

Event sounds make for ideal usages of Flash's sound object. When creating background music soundtracks, I prefer using the timeline, because it gives me a visual interface for aligning and synchronizing sounds with graphics. With event sounds, on the other hand, this is not as crucial, and action script gives us much greater control. The above example can be created more easily and with greater flexibility than by using the timeline. Here's how:

Create your buttons the same way as in the previous example, with the mouse-over and mouse-hit sounds attached to the corresponding button states. In order for sounds to be used by the sound object, they need to be "linked" and given a name. Select the the first chunk in the library and goto the menu OPTIONS>LINKAGE. Select EXPORT THIS SYMBOL and give it the identifier "loop1". Do the same for any other loops you will be using. Now we need to assign variables and fill them with the linked sounds we just identified.

On frame one, we need to add a new layer called "actions" and add a keyframe where we will insert some action script. Make sure frame one is selected and choose WINDOW>ACTIONS. Change to expert mode by clicking on the arrow at the top right corner of the actions window. Type in the following code:

s1 = new Sound( );
s1.attachSound("loop1");

Do this for each sound you want to control in your movie. Now, you can tell a sound to do any of the actions provided by the sound object. In our case, we are going to tell a sound to stop on a mouse release action. Click on the button instance on frame one, and goto the actions window. Type in the following code (make sure you are in expert mode):

on (release) {
s1.stop( );
gotoAndPlay (5);
}

Do the same for the other button instance on frame 5, only subsituting correct variable name and goto frame number, like so:

on (release) {
s2.stop( );
gotoAndPlay (1);
}

We used the sound object in this example just to render the STOP actions, but you can use it to trigger your buttons mouse over and mouse hit sounds as well.

Example: Here's a piece by ACI Telecentrics that is a good real-world illustration of transition sounds, as well as using chunks and layers to dramatically reduce file size. The original movie size was 348k. After using a Sound Family to sonify the piece, file size was cut to 148k. Audio file size was reduced by over 75%, and total movie size by over 50%. Here, we show a combination of mouse-over and transition sounds. We talked about transition sounds being used either on a mouse-click or programmatically. You can witness both approaches by either letting the movie play (programmatic) or clicking the "skip movie" button (interactive).

[Watch Movie]


More Tips and Tricks
  • Colliding Mouse Over Sounds - If you have many buttons with mouse-over sounds on your page, a user can cause multiple instances of event sounds to play at the same time by mousing quickly over the buttons. This can be a desired effect if the sounds blend, such as with harmonized vocals riffs [watch example]. Usually, however, this creates an undesirable commotion which can even cause clipping (digital distortion) to occur. This can be avoided by setting the mouse-over sound to the "start" method (rather than "event" method) when you are using the same sound for all buttons. The start method makes sure that not more than one instance of a sound is playing at a given time. If you are using different sounds for each button, you will need to use the stop sync method or the sound object as explained above.
  • Soundtrack looping - One thing Flash is not so good at, is seamlessly looping back to the beginning of a movie clip. If you have ever inserted an audio clip and tried to make it loop by using a goto and play action, you know what I mean. Even in forced frame mode, Flash glitches just a bit as it repeats. There is a nifty work around for this problem if you have access to layered audio and integrated event sounds.


In the following example, we constructed a soundtrack that begins with drums only, and builds gradually to full instrumentation. At the end of the soundtrack, we wanted it to smoothly loop back to the beginning, as if it were a continuous stream of music. In order to "mask" the seam that would occur when the playhead returned to the beginning, we used an event sound that was a slide guitar riff taken from the guitar instrument layer. We programmed the slide guitar to happen as a transition at the end of the song. Just after the slide guitar is triggered, the movie returns to the beginning and starts the drum beat underneath the sustaining slide guitar. Viola!

[Watch Movie] (let play for 1 minute 15 seconds to hear looping transition effect)

 

[ back ]