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 2 Preludes through all the Major Keys, Op. 39.