Inicial
Unidade 3

CAPÍTULO 9 -- ESTRUTURAS MUSICAIS CLÁSSICAS


UNITY AND VARIETY IN MUSIC--A SHORT COMPOSITION LESSON


To a creative artist, one of the scariest possible situations is to sit in front of a blank sheet of paper that needs to be filled. It takes on another dimension of fright altogether if your job depends on filling it.

For a musician, the process can be quite a formidable task. Like a writer, he has a story to tell. It might be to create a musical representation of a non musical event, such as tell the story of a famous military battle, paint a musical picture of a Roman god of war, or describe a love story like "Romeo and Juliet".

Perhaps he wishes to tell a story using the raw emotions conveyed solely by music, one that deals with the tensions and relaxations that come naturally in musical sound. It could be a story that ends in a blaze of triumph. Maybe it will be jovial and good natured, perhaps it will end with a feeling of quiet defeat.

In any of the above cases, the composer faces problems that a writer does not. For example, if a reader gets a little confused by the plot or loses track of a particular character, he can flip back a few pages. Besides, a book usually isn't meant to be read in a single sitting. Depending on the reader it can take days, even weeks to complete a book. Either way, the message will still have successfully gotten across.

A composer, however, has a very different task at hand. Borrowing a term from computer operations, music is very much a realtime operation--realtime meaning something synchronized to a clock. A one hour symphony generally takes one hour to listen to. There are no "speed listeners" here who will race through it in 35 minutes, or casual listeners who will take two days to get through the thing. Unlike an author, a composer usually gets only one shot to get his point across. If he loses his listeners' attention for even a few moments, then perhaps his whole point might be lost on his audience. Most people aren't in the habit of stopping a tape or CD and relistening to some parts to clarify what the composer is driving at.

The composer's purpose is a clear one if not an easy one--keep the listener interested without boring him or getting him lost during the piece of music.

So--how is this Herculean task accomplished? The last few thousand years or so of musical practices have more or less dictated a common approach that musicians usually follow, regardless if they're composing a piece of music that lasts for three minutes or one that lasts for three hours. The tried and true way to keep a listener involved lies in the element of form. As discussed in "Chapter 2", form is "the mixture of familiar material with new or unexpected material in a composition."

Oftentimes a composer will go to great pains to establish some familiar reference point with the listener. It's not a trivial concept--after all, this process is the backbone of our listening habits that have been established over the last five hundred or so years. The typical way to go about this is to create a good melody that catches the listener's attention, get away from it, come back to it, get away again, return, etc. In vocal music, the combination of lyrics returning with music is often a very powerful one, and a relatively easy reference point to establish with the listener. More esoteric ways will involve a harmony being established as the reference point, sometimes a certain combination of instruments, sometimes a specific rhythm.

Sometimes this "home base" of repeated material can be very short. It can be a few seconds long, perhaps a couple of measures, perhaps a phrase or two--anything that will create distinct impression on the listener. Quite often a piece of music will have these unifying elements scattered throughout it, ensuring that the listener will have something to "latch on to". Even if that unifying element is weak or not very striking, it can take on a powerful effect when repeated a number of times.

In the popular music business, that part that first catches your attention is called the "hook". When you have an entire industry (and a very large one at that!) grow up around getting a listener to like a song enough to want to buy a recording of it, musicians want to make sure their point gets across to the listener in a minimum number of hearings. That becomes doubly important when airplay is limited or difficult to get, as is often the case with new or unknown artists.

Why is this need for repetition so pervasive? To a psychologist, it would seem to be one of those areas deeply tied in with one of our basic needs as human beings--a sense of constancy--a sense of unity.

While it is much more so in Western music than in music of other cultures, we somehow tend to find the return of that familiar melody satisfying, giving us a pleasant feeling of continuity, if not a deeper feeling of security. Repetition of the familiar is important. . . but like many other things, too much of a good thing can be very bad.

If a listener hears repeated material too much, he will often find it boring. Most of the other times, he will find it just plain annoying, and the final effect is that the composer will have lost the attention of the listener, failing to get his point across.

Without a sense of the new, the unexpected, a composer has little chance of keeping his audience involved--and maybe even awake. Again, a few thousand years of musical tradition suggests the answer to that--the element of variety in a piece of music. Along with something constant to give us that feeling of a home base we also need a sense of variety to keep us involved, to create a sense of drama and give us a feeling of the unexpected.

Variety in a piece of music can come from new material being thrown at the listener; it could even be a new treatment of the familiar. In any case, that change will help to keep a listener's attention, and create a sense of anticipation, even a sense of drama.

The formula for successful composition sounds reasonably straightforward--hold a listener's attention through unity and keep his interest through variety. In reality, keeping a good balance between the two can be, as mentioned earlier, a task of monumental proportions. Too much similar material and a piece of music sounds boring and repetitive. Too much new material and it can sound chaotic and pointless. How can a composer know when enough is enough?

There are several important factors to take into account. These include the type of musical form the composer might wish to use, (see below), the emotions that will be conveyed, as well as the instrumentation used--a few more sins can be gotten away with when using a large number of diverse instruments (such as an orchestra) than when using the relatively monochromatic tone color of a single instrument (such as a piano).

Certainly not the least important in the balance of unity and variety are other factors like the purpose of the music (is it to be background or clearly heard?), the audience, the medium over which it is heard, and whether or not it contains lyrics. When lyrics are involved, you can sometimes toss the rules out the window and still create a reasonably successful composition. A lot of ballads and folksongs have exactly the same music repeated with lyrics that cause the listener to focus on the story being told.

Perhaps the most important factor in this balance is the length of a piece of music. Short compositions can only hold so much variety before they begin to sound chaotic. To hold a listener's attention in a longer piece of music, a good bit of variety is quite necessary. This relationship is very similar to the differences between a short story and a novel. The difference between the two is not just length, but complexity as well. A short story will usually have only one plot, less characterization, etc. A novel will generally contain much more detail, more intricate plots, and oftentimes several subplots to keep the reader's attention. Pretty much the same comparison can be made between a song and a symphony.

Putting it succinctly, shorter forms will often sacrifice depth for efficiency at getting their point across.

Other types of music will try for more depth and content and give the listener something new after many hearings. Compositions of this type are usually longer in duration as there is more that can be said in a longer period. They often go to greater emotional heights. They will warrant more listening, more exploration.

This, however, is not meant as a value judgement, as there's a certain basic talent needed to compose any type of music. The author needs to know when a plot idea will be good for a novel and when it can only sustain interest for a short story. The same applies to music. Good composers in any generation or era will be equally adept at pieces of music of different lengths and styles.

The balance point between unity and variety in a composition is often a precarious one, but not necessarily an exact one. The quality of a composer's music can also determine how many times he can get away with repeating it before an audience gets annoyed. In many cases, a composer's particular style will be as much of a determining factor of a unity/variety balance as anything else named above. There are often many avant-garde or experimental compositions that purposely break what would seem commonsense rules of repetition--and succeed in getting their points across.

To even further complicate the issue, most music is written so that the listener won't fully absorb and understand the piece of music in one hearing. Sometimes it's a trade off of profundity for accessibility. Sometimes, a rare few can capture both. Over the course of your life you may run into a number of compositions that you will listen to fifty or more times--and still find they have new things to say.

The following are several categories of typical unity/variety treatments and a description of several common forms that often come up in different kinds of music. Most of them apply to purely instrumental music, but the ideas and formulas are oftentimes a fascinating glimpse into the simple mechanics of the creative process. While many of these typical forms apply to 'classical' compositions, the basic ideas are used in many different types and categories of musical sound.


SECTIONAL FORMS -- "COMPOSITION BY XEROX"


As discussed a little earlier, form in music is the practice of establishing a "home base", or a musical "main character" that the listener can identify with. The usual process is to then get away from that point of security, come back, and maybe cycle through that journey a few more times. A typical procedure is to establish a dominant musical theme and then make it interesting by giving us some new material between repetitions.

There are several effective approaches. The simplest and most effective way for shorter compositions is to use a sectional form. Compositions written in sectional form are composed in large blocks of music. Those blocks are then repeated wholesale with little or no change.

The following is an exaggeration, but it's possible to write just three pages of music and then head for a photocopier. I might then make four copies of the first section (which we'll call "A"), two copies of the second section (called "B"), and only one of the "C" section. I will go home and then paste them together in the following pattern: ABACABA. If nothing else, I will at least have a good balance of unity and variety. (I will also have a Rondo--see below).

Common sectional forms include a simple AB (with repeats it is usually AABB; the structure really isn't changed much) known as a binary form because it has two sections (as binary arithmetic only has two numbers, 1 and 0).

A more common and often useful one is an ABA form, also known as a ternary form. The ternary form begins to get a little more sense of drama in musical sound as we start with an idea, get away from it, and come back to it, giving a feeling of closure. The first A section is often repeated, giving a structure of AABA, not significantly changing the form.

A sectional form known as a rondo is more of a concept than a definite pattern. The idea behind a rondo form is for the composer to present a main melody--usually a very strong one that sticks in the listener's mind. He will then give us new material, then return to the rondo theme. Often you will hear another new section, followed by the old material.

Rondos will vary in length and in the number of sections, but they accomplish their goal of keeping the listener involved and engaged with new material. Importantly, they give a sense of expectation by conditioning the listener to anticipate the return of the main theme.

When a section in a rondo repeats, it's usually restated with few changes. This gives the structure its unity element. The variety element comes from new material being presented between statements of the old material (rondo section). Typical examples of a rondo pattern might be ABACA, ABACABA, or ABACADABA, etc. The first section quite necessarily is the most important and is often repeated at the beginning. That first theme will usually end the movement, leading into a section called a "coda". "Coda" is the name given to the final part of any composition that tells the listener that the piece is coming to an end, maybe even summing up the piece of music.

The rondo form is fairly simple and effective. A trade off is that it usually doesn't lend itself to intense musical drama very well. It is often found in the last movement of a Sonata Cycle.

A lot of short self-contained compositions are in rondo form.

Along with the above three forms, there is a category called free sectional form which is basically a catchall for everything else that is sectional and not one of the above named common forms.

Strophic is the name given to the form of music that repeats over and over, perhaps in a verse/chorus formula. Many hymns and folksongs do this.

Many songs, both new and very old are in free sectional form as this format lends itself to compositions of shorter length. Although it's difficult to get much drama or profundity in simple sectional form, it is very effective and efficient, getting its point across fast. The fact that it lends itself to shorter compositions makes it ideal for the mass medium of the radio.

THE SUITE

While sectional forms don't work too well in extended compositions (it will be rare to find sectional compositions able to hold an audience's attention for more than ten minutes), sometimes a number of them are grouped together to create a longer work.

The most common type of this "macro-sectional" is the suite.

Before 1750 (when the Baroque era ended), musicians would commonly write a series of sectional dance pieces and lump them together under the heading of a suite. These dances included the pavane, galliard, allemande, gigue, and were usually presented in alternation between slow and fast numbers. A lot of these were in simple ABA form. Then, as now, dance music often makes use of the simplest forms. Even though they were examples of dance music, they were usually only listened to, rather than used for dancing. Suites were often composed for chamber orchestra, solo harpsichord, or harpsichord and another instrument.

After 1750, the types of compositions called suites began to expand in their definition. What a composer called a suite would often include extractions of music from a larger work such as an opera or a ballet. They were often composed for the keyboard or orchestra. For example, "The Nutcracker" is a ballet by Tschaikovsky lasting nearly an hour and a half. The "Nutcracker Suite" is a collection of certain of those movements which lasts only about 25 minutes. There is a very wide variety in the nature of the music and structure of the music found in suites.

"The Planets" by Gustav Holst (1874-1934) and "Pictures at an Exhibition" by Modeste Mussorgsky (1839-1881) are two modern suites that still keep their multi-movement structures. "The Planets", written for a very large orchestra, is a remarkable piece of music that is virtually the grandfather of science-fiction film music. It contains seven movements, each one representing one of the planets, Earth and Pluto not included. This composition was many years ahead of its time, still influencing modern film score composers, who occasionally can't resist ripping off a few pages here and there.

"Pictures at an Exhibition" was inspired by the posthumous art exhibition of Mussorgsky's friend, Viktor Hartmann. Originally written for piano solo and later orchestrated by Maurice Ravel, it is a series of movements musically depicting Hartmann's paintings. This music eventually went on to inspire an electronic rock arrangement by Emerson, Lake, and Palmer and a synthesizer arrangement by Isao Tomita.


METAMORPHIC FORMS -- VARIETY THROUGH TRANSFORMATION


While sectional forms are very direct and quickly understood by the listener, they do have quite a few limitations in the drama they can express. A second way of dealing with the unity and variety problem can be found in the the use of Metamorphic forms, which deal with them in a manner much different from sectional forms.

Metamorphic forms will often proceed by establishing a musical idea in the listener's mind. Many of them will still hang on to the very effective approach of then presenting new or contrasting material, and then returning to the main idea.

The difference between a sectional and a metamorphic form is that in a metamorphic composition, each time that idea returns it is often slightly different. This difference might be in the tempo, orchestration, harmony, or perhaps the character presented by the music.

This approach is much closer to the approach of a writer or a playwright. Much classical drama consists of a main character (the protagonist) who goes through a series of episodes and situations. At the end of the drama, we see that the protagonist has been changed or transformed. If it is possible to describe music verbally, this is a fairly accurate summary of a metamorphic composition. Same dramatic character (unity)--with differing character building episodes (variety). In musical terms, it is the same theme (unity), going through a series of changes (variety).

Usually associated with larger scale compositions, metamorphic forms tend to be a little more abstract and difficult for the average listener to understand without detailed study or repeated hearings. Keep in mind that much of music's effects are subliminal in the first place.

A second reason they are sometimes difficult is that the average listener is a bit out of practice--metamorphic forms are much less commonly heard than sectional forms.

It has been observed that a lot of drama (in any medium) consists of the audience losing its identity with the main character. We become involved with the emotions, the goals, the desires of the protagonist, the frustrations, allowing ourselves to become slightly "mixed up" with the character we see on the screen, the stage, or the one in the book in front of us. The more an author can get the audience concerned about the character, the more involving the process becomes, and it (hopefully) becomes a best-seller or a hit movie or play.

Even though they happen to be four centuries old, the plays of William Shakespeare still deeply involve audiences and those who present them. When we successfully peer into the soul of Hamlet and identify with his fears and frustrations, we become touched by the tragedy in his life. Audiences will for many years to come--until we have changed so much as human beings that we have nothing in common to bond with Hamlet.

Similarly, much music works this way, giving us an emotion or ideas that we enjoy and identify with. Instead of dealing with a complex plot and characterization, music might well represent drama with all the superfluous details torn away and presented in its most refined form--that of pure emotions.

In a sense, both music and drama represent an emotional program of highs and lows "stored" in a series of words or notes. It is up to the technical skill of the author or composer to keep the audience involved by his storytelling or musical phrasing while he sneaks his emotional program across.

TWO COMMON METAMORPHIC FORMS

I. THE THEME AND VARIATIONS

The form called theme and variations takes an unusual approach to the problem of meeting the needs of unity and variety. It creates unity by taking the theme (melody) and repeating the basic idea over and over, unifying the whole composition. This theme could be a folksong, a melody by the composer, or perhaps a melody by another composer.

The variety element comes from the fact that each time this theme is replayed, it is changed somewhat. These changes might be mild, or drastic transformations in some cases. It is a simple process, but often a very effective one.

Some of the elements changed include tempo, dynamics, register (how high or low the melody is sounded), harmony (perhaps a shift from major to minor or vice versa), phrasing (becoming choppy or smooth), tone color or instrumentation if played by an ensemble, texture, meter, rhythmic elements, etc. Additional melodies can also be added in counterpoint with the original.

Composers are generally careful with how much they change the original melody, as this element is basically the song itself. If the melody is changed drastically, the rest of the musical fabric remains fairly true to the original--otherwise the variation will sound like it has nothing to do with the melody.

The extremes in the number of variations are two at the lowest to about 30 at the highest (although a few successful examples of more that 30 variations do exist). Most of the time a theme and variations will have only one primary melody, but on occasion will have two that alternate.

The theme and variations format has been found very useful from the Renaissance era up to the present. They tend to have limitations on how long they can hold a listener's attention--it has to be a very good composer to be able to create a successful theme and variations longer than twelve to fifteen minutes, although Bach and Beethoven each did one that lasts close to an hour.

Quite often one of the four movements of a symphony is in a theme and variations form. Many, however, are independent standalone pieces.

II. THE FUGUE

Defined as simply as possible, a fugue is a one-movement, highly polyphonic composition based on the metamorphic treatment of a single theme. There are many rules governing what happens musically in a fugue, and it remains one of the most complex types of compositions in music.

The fugue also represents one of the most scientific types of compositions there is. The main theme (usually known as the subject) is sometimes inverted (turned upside down), stretched out in length (called "augmentation"), or shortened (called "diminution"). Occasionally, it will even be used backwards.

Occasionally a fugue will have two important musical themes and will be called a 'double fugue'.

Because of the complexity involved in the process, fugues are often best appreciated by musicians, and have a reputation--an unjust one--of being very boring. While the process can be a very academic one, few musical devices have the potential for capturing and holding the attention of a listener.

Although a few fugues are still composed today, the Baroque era (1600 - 1750) represents their peak of popularity. Many times fugues will be accompanied by another piece of music in contrasting character--such as a prelude or a toccata (a very free, improvisatory type of short piece).

Outside of the Baroque era full-blown fugues are somewhat rare, but many compositions will have sections that sound like a part of a fugue--a number of polyphonic lines acting independently, pulling your ear in a number of directions simultaneously. Such a segment of a piece of music is described as a "fugal section".

The fugue begins with a section called the "exposition". The exposition of a fugue consists of each voice ('voice' is the name given to each melody line whether it is sung or played) introducing the main melody of the fugue, called the subject. Usually one voice will introduce the subject, then as soon as it is finished, a second voice will 'state' the melody, this time called the answer. The first voice, instead of dropping out, will often play a counter melody, sometimes called a 'countersubject'.

As each successive voice introduces the melody, all of the previous voices continue and the texture gets thicker and thicker. Composing one of these requires that the composer be able to think in terms of several lines running simultaneously. Below is a diagram of a four voice fugue exposition. The exposition can be done many different ways, but this represents a typical way of structuring one.

After all of the voices have introduced the subject/answer, the typical fugue will have a section called an episode. Episode is the name given to any section in the fugue where the subject is not heard. Many times the episodes of a fugue are based on the countersubject, and are the chief variety element in the fugue.

At some point the subject will return, but transformed or changed a little. This variation also adds to the variety element heard by the listener. Like the theme and variations, the fugue creates variety in its unity.

The cycle of episode and subject will often happen several more times until the drama has worked itself toward the climax of the fugue, called the stretto.

The stretto is very much a parallel to the exposition where all of the voices again reintroduce the subject. This time, the voices will introduce it in more rapid-fire order, sounding as if they are "piling up" on each other.

Reintroducing the main theme at the climax of the music is a very powerful compositional tool, giving a subliminal suggestion that all of the elements of the plot are finally coming together. Again, this is pretty close to the procedure used by writers.

The fugue usually ends with the coda section, again "summing up" the piece of music, and giving a signal to the listener that the piece of music is coming to an end.

For an untrained musician, a fugue could well be the most difficult type of music to compose.

Below is the form of a typical fugue. There is a very large amount of flexibility in the process, so any specific fugue might have more or fewer sections, there might be another subject-episode combination before the coda, etc.

In general, it will be rare that you will hear a purely metamorphic form last more than 12 - 15 minutes. They are a bit harder to grasp than a sectional form, especially on the first hearing. They balance this off by having variety that will last through many hearings.

Each one of these forms will have a certain set of strength and weaknesses. It is up to a composer to know which type of composition will be the best for what he wishes to accomplish.

Strengths of sectional forms: very good for shorter compositions; don't overwhelm the listener with variety; easily grasped on first or second hearing.

Strengths of metamorphic forms: keeps interest over a greater number of hearings; can convey more of a sense of drama and complexity.


THE SONATA FORM -- A SECTIONAL/METAMORPHIC HYBRID


It might be logical to expect that there are compositional forms that combine the best of both worlds--having the complexity of metamorphic forms, but the relatively easy accessibility of sectional forms.

There are several of them, but the most common and useful one of them is the sonata form.

The sonata form was one of the most important musical developments of all time. It allows a composer to create a musical drama that can easily be understood and appreciated by an audience familiar with the form--and even easily get its point across on a subliminal level to an audience not familiar with the form.

Also called "first movement form" or "sonata-allegro form", the sonata form is an example of a musical pattern or formula that a composer would find very useful, especially someone who needs to write a lot of music in a very short time. Musicians can find it very scary while waiting for creative inspiration to hit, even worse when a job depends on it.

Franz Joseph Haydn was a composer who found himself in such a position. Hired by the Esterhazy court as court composer in the 1700s, Haydn's work necessitated that he be able to come up with a lot of music to keep his job.

Haydn is often called the father of the string quartet, the symphony, and the sonata form among other. He was able to work with new ideas, refine them, experiment, leaving some musical structures and forms that aided and influenced musicians for more than a century after his death.

The sonata form combined the best of the sectional and metamorphic forms--giving repeated blocks that are easy to grasp, while also having the process of transformation to allow subtlety and drama.

There are three principal sections that make up a sonata form. The first is called the exposition where, like the fugue, the musical ideas are first presented to the listener. The sonata form generally makes use of two themes, labeled the A theme and the B theme. The A theme is generally more rhythmic and bouncy or choppy, while the B theme is generally smoother and more song-like. They are also in two slightly different keys, meaning that they are based around a different set of notes. There will often be a short transitional theme between the A and B themes to move from one to the other smoothly and a 'closing theme' to make a smooth transition from the B theme to the next section. Sometimes the movement begins with a short introduction before getting down to business in the exposition.

In the dramatic structure, the exposition often serves to set up a feeling of opposition--two opposing forces that create a little (or maybe a lot) of tension for the listener. Oftentimes, the exposition is repeated wholesale for the purpose of making sure the listeners are familiar with the two themes.

The second important section is called the development. If the exposition gives a feeling of opposition, then the development is responsible for containing the conflict of the movement. Musically, the development is very free with few, if any, rules. Themes will be broken into pieces, given different harmonies, different tone colors, etc. On occasion, a new musical theme is introduced.

The development is where the most tension occurs in the sonata form. Much of what we call "drama" is a series of tense moments and relaxed moments created by the writer, musician, playwright, etc. If the creator can successfully manipulate the listener through a well paced program of these tense and relaxed moments, he will come up with a very effective and pleasing vehicle.

The last of the three sections in a sonata form is the recapitulation. As its name suggests, the recapitulation summarizes or 'recaps' the movement. The A and B themes are presented again, but this time in the same key, giving a feeling of resolution to the drama.

This is a very effective dramatic tool in many different mediums--returning to the opening scene, using the opening characters, which we then see in a new light--transformed by the circumstances. There are many fine examples of this. "The Return of the Native" by Thomas Hardy is a fine one, with the first and last chapter taking place in the same setting. To help give a feeling of closure, the novel ended exactly one year and one day after it began. You can probably think of many books, plays, or movie plots that do something almost exactly the same.

Such exact detail cannot be conveyed through instrumental music alone, but the feeling behind it--of a drama summary--is very easy to convey by the return of the familiar.

A coda section will usually bring the movement to a close. Some composers after Haydn began using this coda as an opportunity to create yet a little more drama. Beethoven often used the coda as almost a second development section.

An overture (in the modern sense) is a name given to a one-movement composition heard at the beginning of a play, a ballet, or an opera. One of its functions is to give the audience preparation for the mood or drama that will be presented. In addition to setting the mood, the overture will often present a brief summary of the drama that will be seen. Many of these overtures are in sonata form--a structure that seems to be a perfect match with much non-musical drama!

The sonata form allows creative elements to be used to a very efficient potential within a solid working structure. This doesn't mean that any clown off the street could sit down and compose a good symphony if he knew the form--there are still important creative gifts necessary. It just makes things a little easier for those who had those gifts. While Haydn had the good fortune of living a long lifespan, his invention helped make him one of the most prolific composers in history.

Again, the sonata form involves some elements of sectional forms which allow easy accessibility, and it contains metamorphic elements which make it more engaging, even on a subconscious level. In spite of how easy it is to describe it in symbolic or non-musical terms, it nevertheless is an example of absolute music. It tells a story using the very expressive language of music.

RELATED KEYS AND THE SONATA FORM

Much Western music has grown up around the practice of using a set of 7 of the 12 possible notes in each composition. This is another way of saying that a piece of music is in a particular "key" and is closely related to the function of a key signature.

In simpler music the notes of the melody are taken only from that set. Combinations (subsets) of notes from that set give us the principal harmonies of that key.

Let's say that our set consists of the notes D, E, F#, G, A, B, C#. Musicians would recognize this as the D major scale. D-F#-A, G-B-D, and A-C#-E are three important harmonies related to the key of D major, and you can see that all three draw from combinations of elements of the D major set (i.e., the D major scale).

The key/set/scale of A major consists of the notes A, B, C#, D, E, F#, G#. Six of the seven notes in each of these sets is common to the other one--G and G# are the only two dissimilar elements. Because of this, we would call these two "closely related keys". The three most important harmonies in this key are A-C#-E, D-F#-A, and E-G#-B. Two of these three harmonies are also important in the key of D major.

Let's take the key of B flat major which contains the notes Bb, C, D, Eb, F, G, A and compare it to the key of D major. Only the notes D, G, and A are common to the two keys and none of the important harmonies are common to both. These are distantly related keys.

One more example: let's take the natural minor scale built on F: the notes will be F, B, Ab, Bb, C, Db, and Eb.

Compare it to the major scale built on Ab: Ab, Bb, C, Db, and Eb. You might notice that these are the same set of notes. These two are very closely related! One just emphasizes certain notes and harmonies to create the a focus on F, and the other focuses on Ab.

The sonata form makes a creative use of these different scales. By having the A theme and the B theme of the exposition in different but closely related keys--for example Eb and Bb--the composer creates a subliminal feeling of opposition. When the two themes reappear in the recapitulation in the same key, it gives a feeling of return to some home base--the differences have been ironed out. The result is a feeling of some satisfactory ending.