Gagaku (雅楽, literally "elegant music") is a type of Japanese classical music that has been performed at the Imperial Court in Kyoto for several centuries. It consists of three primary repertoires:
Gagaku, like shomyo, employs the yo scale, a pentatonic scale with ascending intervals of two, three, two, two, and three semitones between the five scale tones.
By the 7th century, the gakuso (a zither) and the gakubiwa (a short-necked lute) had been introduced in Japan from China. Various instruments including these two were the earliest used to play gagaku.
Gagaku, the oldest classical music in Japan, was introduced into Japan with Buddhism from the China. In 589, Japanese official diplomatic delegations were sent to China (during the Sui dynasty) to learn Chinese culture, including Chinese court music, Gagaku.
Komagaku and togaku arrived in South Japan during the Nara period (710-794), and settled into the basic modern divisions during the Heian period (794-1185). Gagaku performances were played by musicians who belonged to hereditary guilds. During the Kamakura period (1185-1333), military rule was imposed and gagaku was performed in the homes of the aristocracy, but rarely at court. At this time, there were three guilds based in Osaka, Nara and Kyoto.