• Keep in touch:
  • Linked In
  • Twitter
  • RSS

How do I add a soundtrack to a movie?

Adding a soundtrack for a movie is extremely easy. The SoundFactory provides all the information you need to define the sound then generate the blocks that are played in each frame of the movie:

final SoundFactory factory = new SoundFactory();
factory.read(new File(soundFile));


while ((block = factory.streamSound()) != null) {

One technique to make it easier to create movies with soundtracks is that you can add the sound using the Layer class or even create a movie clip that plays the sound. This keeps the sound objects separate from the objects that are displayed and so you avoid having to interleave the streaming sound objects with those displayed on each frame.