A Derivation of the Tonal Hierarchy from Basic Perceptual Processes