How are movie soundtacks so synchronized with the scenes from the movie ? I've noticed that some movies fit perfectly with their soundtracks in terms of synchronization. For example something scary happens and loud notes are being played exactly that time. In what order does the process of making a soundtrack happen? Does the soundtrack get created first and then the actual scenes in the movie? Does the opposite happen?
I believe that soundtracks are usually written as the movie is made, with input from the director. I think that synchronization occurs though cutting the footage of the film to make it match the music in length. You'll also notice that in most scenes, the music is not synchronized because there is nothing to synchronize it with, but a few scenes will stand out because there is something to synchronize music with, and the music has been synchronized. For example, in Gettysburg, the talking and panning scenes have general music that is not synchronized with anything. However, during the battles, particularly the Battle of Little Round Top, they clearly cut some footage to fit the soundtrack exactly. I think that particular scene was designed with the music in mind.
Other times, they might cut the music. I believe this is generally done when the track was not specifically designed for the theme. When only one event must by synchronized (like the scary sight and loud note), they might just change the start and end times of the track to synchronize it. If you listen to the music several minutes before the event, you might notice that it changes (a new track starts) at a somewhat odd time. For example, in Gettysburg, the track for the Battle of Little Round Top starts in the middle of a sentence so that they could synchronize the shouting of "Bayonets" and the swell in the music.