Music written in all major or minor keys

There is a long tradition in classical music of writing music in sets of pieces that cover all the major and minor keys of the chromatic scale. These sets typically consist of 24 pieces, one for each of the major and minor keys (sets that comprise all the enharmonic variants include 30 pieces).
Examples include Johann Sebastian Bach's The Well-Tempered Clavier and Frédéric Chopin's 24 Preludes, Op. 28. Such sets are often organized as preludes and fugues or designated as preludes or études. Some composers have restricted their sets to cover only the 12 major keys or the 12 minor keys; or only the flat keys (Franz Liszt's Transcendental Études) or the sharp keys (Sergei Lyapunov's Op. 11 set). In yet another type, a single piece may progressively modulate through a set of tonalities, as occurs in Ludwig van Beethoven's Two Preludes through all twelve major keys, Op. 39.
The bulk of works of this type have been written for piano solo, but there also exist sets for piano 4-hands; two pianos; organ; guitar; two guitars; flute; recorder; oboe; violin solo; violin and piano; cello solo; cello and piano; voice and piano; and string quartet. There are examples of attempts to write full sets that, for one reason or another, were never completed (Josef Rheinberger's organ sonatas, Dmitri Shostakovich's string quartets, César Franck's L'Organiste).
Notable sets that cover all 24 keys
- Johann Sebastian Bach: The Well-Tempered Clavier, Books I and II (1722 and 1742) – two separate sets of 24 preludes and fugues, together known as "the 48".
- Frédéric Chopin: 24 Preludes, Op. 28 (1835–39)
- Franz Liszt: Transcendental Études, S. 139 (1826–52) cover only the keys in flats. Liszt did not realize his original intention to write the full suite of 24 études in all keys.
- In 1897–1905, Sergei Lyapunov wrote his 12 Études d'exécution transcendante, Op. 11, which cover the remaining keys, in sharps, and are dedicated to Liszt's memory.
- Charles-Valentin Alkan: 25 Preludes, Op. 31 (1847); 24 études in all the major and minor keys, Opp. 35, 39 (1848 and 1857)
- Alexander Scriabin: 24 Preludes, Op. 11 (1893–95) – Scriabin wrote a total of 90 preludes for piano (50 in major keys, 31 in minor keys, and 9 in indeterminate keys). These contained only one complete set of preludes in all 24 major and minor keys.
- Sergei Rachmaninoff: 24 Preludes, Opp. 3/2, 23, and 32 (1892, 1901–03, and 1910)
- Paul Hindemith: Ludus Tonalis (1942) – 12 fugues and 12 interludes covering all twelve keys, where the major/minor distinction does not apply, book-ended by a praeludium and a postludium.
- Dmitry Kabalevsky: Preludes, Op. 38 (1943–44) – each in a different key and each based on a folksong
- Dmitri Shostakovich: 24 Preludes and Fugues, Op. 87 (1950–51) – Shostakovich also wrote a separate set of 24 Preludes, Op. 34 in 1933.
Composers who wrote multiple sets

A number of composers have written multiple sets of works covering all the keys of the scale.
- 14 sets: Niels Viggo Bentzon (1919–2000) wrote 14 complete sets of 24 Preludes and Fugues, a total of 336 pieces in this genre alone. The contemporary composer Roberto Novegno (b. 1981) has also written 14 complete sets of preludes so far, each using a different sequence of keys.
- 8 sets: Carl Czerny
- 5 sets: Charles-Valentin Alkan, Joachim Andersen
- 4 sets: Richard Hofmann, Franciszek Zachara
- 3 sets: Adolf von Henselt, Charles Koechlin, Christian Heinrich Rinck
- 2 sets: Lera Auerbach, David Cope, Johann Baptist Cramer, Ferdinand David, Hans Gál, Stefano Golinelli, Johann Nepomuk Hummel, Aaron Andrew Hunt, Friedrich Kalkbrenner, Nikolai Kapustin, Joseph Christoph Kessler, Craig Sellar Lang, Trygve Madsen, Désiré Magnus, Ignaz Moscheles, Rob Peters, Jaan Rääts, Igor Rekhin, Dmitri Shostakovich (he also left unfinished a set of string quartets in all keys), Sir Charles Villiers Stanford, Sulkhan Tsintsadze, Louis Vierne, Vsevolod Zaderatsky
- other: Franz Liszt wrote only one set of his own, but he also transcribed for piano solo a set for violin and piano by Ferdinand David. Josef Rheinberger wrote one full set, and died before completing a further set of organ sonatas.
Full details are shown in the tables below.
Variants
Single pieces that modulate through many keys
Ludwig van Beethoven wrote 2 Preludes through all 12 Major Keys, Op. 39 for piano (1789). These two preludes each progressively traverse the 12 major keys. In Prelude No. 1, each key occupies from 2 to 26 bars. The keys of C# and D♭, which are enharmonically equivalent, are both represented. C major both opens and closes the set. In Prelude No. 2, the cycle of keys appears twice; in the first cycle, the number of bars per key ranges from 1 to 8; in the second half, after C every new key signature lasts for only one bar; the cycle concludes with 15 bars of C major. There is no evidence that Beethoven intended to write similar sets in the 12 minor keys.
Giovanni Battista Vitali (1632–1692) included in Artificii musicali, Op. 13 (1689) a passacaglia which modulates through eight major keys (out of twelve) from E♭ major to E major through the cycle of fifths.
Fugue No. 8 from Anton Reicha's Trente six Fugues pour le Piano-Forté composées d'après un nouveau systême (subtitled Cercle harmonique) modulates through all keys.
The rondo theme of Darius Milhaud's Le bœuf sur le toit is played fifteen times in all 12 major keys (twice in A major and three times in the tonic, C major). It also passes through every minor key except E minor and B minor.
Works covering all eight church modes
Around 1704, Johann Pachelbel completed his 95 Magnificat Fugues, which covered all eight of the church modes.
Charles-Valentin Alkan composed Petits préludes sur les huit gammes du plain-chant, for organ (1859, no opus number), a sequence of eight organ preludes covering each of the church modes.
In the music of the Eastern Orthodox Church, the doxasticon for Vespers of the Dormition is notable as a single hymn that includes passages in all eight tones of the Byzantine Octoechos.
Other sets of 24 pieces
Not all sets of 24 pieces belong in this category. For example, there was no intention in Niccolò Paganini's 24 Caprices for solo violin, Claude Debussy's 24 Préludes for piano, or Pavel Zemek Novak's 24 Preludes and Fugues for piano to cover all the keys. (Paganini may not have been aware of Pierre Rode's 24 Caprices for violin, which did span the 24 keys and were written almost at the same time as Paganini's.)
Chopin's 24 Études, Opp. 10 & 25 might have originally been planned to be in all 24 keys. In fact, apart from Nos. 7 and 8, the first series (Op. 10) is made of couples of études in a major key and its relative minor (the major key either preceding the minor key or following it) with none of the tonalities occurring twice (except for C major, which appears in No. 1 and then in the only couple which is not major-minor, i.e. Nos. 7 and 8). But in the second series (Op. 25) this tonal scheme gets more and more loose. It is still possible to see connections on a tonal basis between the couples of études in Op. 25, but they are not based on one principle (e.g. Nos. 3 and 4 in F major – A minor, two tonalities which Chopin likes to put together very often, as in his second Ballade). One might suppose that Chopin considered writing the études in all the tonalities but eventually came to the conclusion that it wasn't practical, and turned back to it later, for the 24 Preludes, Op. 28. The fact that the first étude of Op. 10 is made of arpeggios in C major draws a connection to Bach's first book of The Well-Tempered Clavier and makes it clear that Chopin had the tradition on his mind.[original research?]
Keys
There are 12 notes in the octave, and each of them can be the tonic of one major and one minor key. This gives 24 possible keys, but each note can be represented by several enharmonic note names (note names which designate the same actual note in the 12 note octave such as G# and A♭) and so each key can be represented by several enharmonic key names (e.g. G# minor and A♭ minor).
In practice, the choice of key name is restricted to the 30 keys whose signatures have no double flats or double sharps. (Such key signatures are used for so-called theoretical keys which are almost never encountered outside music-theoretical exercises.) Keys with 6 flats and 6 sharps, with 7 flats and 5 sharps and with 5 flats and 7 sharps are enharmonic to one another. Composers will, in most (though not all) cases, choose only one key from each enharmonic pair. But there are also cases of sets covering all 30 keys, which, in other words, include all enharmonic variants.
The table below outlines the choices made in the various collections listed here. The keys are in the order that J.S. Bach used.
Order of keys in published works
The circle of fifths, whereby each major key is followed by its relative minor key, and the sequence proceeds in fifths (C, a, G, e, D, b ...) is a commonly used schema. Angelo Michele Bartolotti used this approach as early as 1640, and it was also adopted by such later composers as Rode, Hummel, Chopin, Heller, Busoni, Scriabin, Shostakovich, Kabalevsky and Kapustin.
In J.S. Bach's The Well-Tempered Clavier and some other earlier sets, major keys were followed by their parallel minor keys, and the sequence ascends chromatically (C, c, C#/D♭, c#, D, d, ...). The Bach order was adopted by Arensky, Glière, York Bowen and others.
Other composers derived their own schemas based on certain logical rationales. For example, in Alkan’s 25 Preludes, Op. 31, the sequence of keys moves alternately up a fourth and down a third: the major keys take the odd-numbered positions in the cycle, proceeding chromatically upwards from C to C again, and each major key is followed by its subdominant minor.
Yet others used no systematic ordering. Palmgren, Rachmaninoff and Castelnuovo-Tedesco's works are examples of this.
History
Bach and his precursors
Johann Sebastian Bach's The Well-Tempered Clavier, two complete sets of 24 Preludes and Fugues written for keyboard in 1722 and 1742, and often known as "the 48", is generally considered the greatest example of music traversing all 24 keys. Many later composers clearly modelled their sets on Bach's, including the order of the keys.
It was long believed that Bach had taken the title The Well-Tempered Clavier from a similarly named set of 24 Preludes and Fugues in all the keys, for which a manuscript dated 1689 was found in the library of the Brussels Conservatoire. It was later shown that this was the work of a composer who was not even born by 1689: Bernhard Christian Weber (1712–1758). In fact, the work was written in 1745–50 in imitation of Bach's example. While Bach can safely claim the title The Well-Tempered Clavier, he was not the earliest composer to write sets of pieces in all the keys:
As early as 1567, Giacomo GorzanisVincenzo Galilei, father of Galileo Galilei, wrote a Codex of pieces illustrating the use of all 24 major and minor keys.
(c.1520–c.1577) composed twelve settings of the passamezzo antico and passamezzo moderno, each followed by a saltarello, in all 24 keys. In 1584,In 1640, Angelo Michele Bartolotti wrote Libro primo di chitarra spagnola, a cycle of passacaglias that moves through all 24 major and minor keys according to the circle of fifths. Also in 1640, Antonio Carbonchi wrote Sonate di chitarra spagnola con intavolatura franzese for guitar.
In 1702, Johann Caspar Ferdinand Fischer wrote a cycle of 20 organ pieces all in different keys in his Ariadne musica. These included E major as well as E in Phrygian mode and again in Dorian mode, but not E minor per se. They also excluded C#/D♭ major, D#/E♭ minor, F#/G♭ major, G#/A♭ minor, and A#/B♭ minor. Bach modelled the sequence of his 48 Preludes on Fischer's example.
In 1735, between Bach's two sets, Johann Christian Schickhardt wrote his L'alphabet de la musique, Op. 30, which contained 24 sonatas for flute, violin, or recorder in all keys. In 1749, the year before Bach's death, Johann Gottlieb Goldberg, the inspiration for J.S. Bach's Goldberg Variations, wrote his own 24 polonaises for keyboard, one in each of the major and minor keys. Other examples include works by John Wilson (1595–1674), Daniel Croner (1682), Christoph Graupner (1718), Johann Mattheson (1719), Friedrich Suppig (1722), and Johann David Heinichen (1683–1729).
After Bach
The following is an incomplete list of works of this type that have been written since the death of J.S. Bach.
Legend: AC = ascending chromatic; C5 = circle of fifths, major followed by relative minor; C5* = circle of fifths, major followed by parallel minor