Practical Web Projects, May, 2005.
This is an article on how to use Flash to create a dynamically generated soundtrack. Using a careful blend of musical elements, with matching tempos, one could transition between different feelings and intensities of music, without a seams in the transition.
Making a dynamic soundtrack where music seamlessly shifts to match the visual subject matter.
Music is perhaps the most powerful tool we have at our disposal, as web and Flash developers, for drawing an emotional response from our visitors. For years, Hollywood has used music to enhance a scene and give it maximum emotional impact. In fact, music in movies often strictly guides our emotions along, making us feel certain ways from moment to moment; suspense, relief, suspense again, relief, more suspense, disaster, relief.
The ability of the composer to move the music smoothly from one state to another is something that we can imitate when we create dynamic soundtracks in our websites. Essentially, we’re going to be using several pieces of music and tying them smoothly together, changing based upon what we’re viewing on the main site. The music will be seamlessly transitioned from one piece to another.
The trick here is that all the pieces of music must have several fundamental things in common. First, they must all be in the same key. In order to transition from one piece to another, crossfading smoothly, we can’t use two pieces in harshly opposing keys, otherwise, as they fade, the sound will be jarring. Secondly, all the pieces must have the same tempo, or speed. This is necessary for them to “line up” properly.
In Flash, we’ll be using the Sound object extensively. We can have up to 8 sounds playing at once in Flash, and we’re going to take advantage of this. Our dynamic soundtrack will consist of 7 possible genres of music. Each genre consists of a single looping piece of music, 16 seconds in length. At the launch of the Flash site, all 7 pieces will be started, and set to loop indefinitely. The volume of all these will be set to zero (silent). We then smoothly fade between them to create our dynamic soundtrack.