Controlling Sound with ActionScript

Although most of us can enjoy listening to music without thinking too much about what we're hearing, the vibrations that make up even the most elementary sounds are actually far from simplea fact made evident by the processing-power requirements of most audio-editing programs. Despite the complexity of even the simplest audio clip, however, sounds can be broken down into three basic characteristics:

  • Length. A sound's length can provide sensory cues about size (the short chirp of a small-car horn compared to the roar of a semi-truck's horn) and urgency (the tinkle of a viciously shaken dinner bell compared to the long bong of a lazy Sunday church bell).

  • Volume. A sound's volume provides clues about distance. Louder sounds give the feeling of closeness, whereas quiet sounds imply distance. A sound that gradually goes from quiet to loud or vice versa creates a sense of movement.

  • Panning. Panning represents the position of the sound from left to right or right to left. Like volume, panning allows you to determine the relative position of the element making the sound. If you were to close your eyes at a tennis match, you could accurately determine the position of the ball (left or right of the net) simply by the "pop" of the ball being smacked by the racket.

With Flash, you can control sound characteristics simply by editing sound instances on the timelinea solution that works well for presentations that don't require audience or user participation. However, if you want to give your user controlallowing the user to move and slide things aroundyou need a more dynamic solution. Fortunately, you can easily emulate and control all of these sound characteristics via ActionScript.