Foundations of Diatonic Theory