Mathematical theory of music