FredGarvin said:
I think you are going to have to derive a very exact definition of what you consider to be disonant. You can have disonance between two tones that are slightly out of tune, or a full half step off.
You have not described dissonance. You are describing what, from what I have seen, happens naturally when you have a tone with a lot of harmonics. In looking at an FFT of a signal, the base frequency is usually the strongest with interval peaks decreasing in amplitude with frequency. Of course there are always exceptions.
Is an FFT what you were eluding to when you said "peaks?"
Perhaps it's best if I rephrase my question. I'm looking for an expression that will determine the consonance between certain pitches. Here's a rough idea of what I'm looking for:
There was this physics experiment we did in class about a year ago where a current-carrying wire would be driven to oscillate by having an alternating current move through it while a permanent magnet was fixed near the end. The amplitude of the wire would be greatest when the AC frequency matched the frequency at which the string as a whole would vibrate when plucked (it would have 2 nodes at the endpoints). The amplitude was second-highest when the AC frequency was such that the string would have 3 nodes. And so on. Let f_a = the base frequency, f_b = another frequency, and A(f) = the amplitude of the string vibration for a certain frequency divided by the maximum amplitude (at f_a, so that 0 <= A(f) <= 1 for any f).
I think A(f) could be a good measure of the consonance between two notes, but I don't remember what A(f) should be. I imagine it'd be 0 in most places, but peaking at 1/1, 2/1, 3/1, 3/2, 4/3, etc. frequency ratios.
(An FFT isn't quite what I want. Let's say we have two functions sin(at) and sin(bt). If a = b, these two pitches would be very consonant, and an FFT would have a spike here, but if a = 2b, there'd also be consonance, and the FFT would just show 0.)
(I might as well explain that I'm trying to find some way to create melodies using differential equations or some other type of model. If I had an expression for consonance, I could mathematically show the tendency of a note to approach certain other frequencies.)