A scale information inputting section receives an input of scale
information of a musical composition. Based on the scale information of
the musical composition inputted to the scale information inputting
section, an appearance probability calculating section calculates
appearance probabilities of pitch names included in the scale information
for each of the pitch names. A template storing section stores 24 types
of previously created templates respectively corresponding to 24 types of
keys. Based on an appearance probability distribution of the musical
composition calculated by the appearance probability calculating section
and each of the templates stored in the template storing section, a load
ratio calculating section calculates load ratios respectively
corresponding to the templates. A tonal information detecting section
detects, as tonal information of the musical composition, information
indicating the load ratios calculated by the load ratio calculating
section as a set, or information calculated based on the set of the load
ratios.