I have done some work on this. I think the best way to tune a system for playing diatonic music is to ensure that the major and minor chords on tonic, dominant and sub-dominant are perfectly tuned in harmony. This sets exact frequencies for every note of the 12 except for the diminished dominant, which is not used much except in modulation or more atonal music. This tuning gives very good sounding harmonies. If the tune modulates, the best thing to do is to change the tuning of all the notes to match the new key. You might also shift the pitch of the new key note to its equal-tempered value, or to the value in the original "base" key, to which your piece will probably be returning. This will give excellent sounding music. Even the chromatic scales sound really brilliant with proper harmonic tuning like this, if you listen to a random segment of a chromatic scale, you can get a feel for where the tonic note is! equal-tempered scales just don't give that. I have written a simple computer-keyboard app that implements this tuning and modulation, it not complete, a work in progress.