# Calculate tonal tension of triads

I'm trying to implement and calculate the tonal tension of a triad (and its harmonics) following the definition given here: https://pdfs.semanticscholar.org/f05e/56c9548fa18c64efeed248742e3a6afb0c02.pdf

The tension of a single triad is given by: `t=v*exp[-((y-x)/alpha)^2]`, where `y=log(f3/f2)` and `x=log(f2/f1)` and `f3>f2>f1` where `f1,f2,f3` are the frequencies of the 3 components of the triad.

So far i've implemented this Matlab code:

``````    function [tension] = tension(f1,f2,f3)
Fdif1 = log(f2/f1);
Fdif2 = log(f3/f2);
alpha = 0.60;
tension = exp(-(((Fdif2 - Fdif1)/alpha))^2);
end
``````

Which seems right to me, but following the experimental data in the paper mentioned above (for example the tension for a single triad of 3 notes without overtones, so 3 simple sinusoids) I don't get at all the value mentioned in the graph (figure 6 of the paper).

What am i doing wrong? I thought it could be a mismatch of domain: the definition of tension works over a pure frequency difference, while (in figure 5 of the paper) the gaussian function of the tension works over semitones difference.

Could it be the problem?

PS: I took inspiration from this answer: Is there a way to measure the consonance or dissonance of a chord? and i wanted to extend the search implementing the other algorithms mentioned in the various papers.

• If you don't get an answer here, you could try dsp.stackexchange.com – Your Uncle Bob Aug 10 at 13:06
• @YourUncleBob Done! I hope someone can help me, i cannot figure out what is the problem, and the only source i found are based on this paper (so they basically explain and exploit the same process). – Mattia Surricchio Aug 10 at 13:11
• "I don't get at all the value mentioned in the graph (figure 6 of the paper)." (Ask the author.) – Randy Zeitman Aug 10 at 14:33
• – Randy Zeitman Aug 10 at 15:03
• As interesting as this is it is not a fair question for either stack exchange and I'd be surprised if you got a straight answer. You state simply that you used the data in the paper and the equation but don't get figure 6. Did you try replicating other results first? How exactly did you use the data and how was the Gaussian model incorporated? You are asking someone to go through the paper and implement the whole thing to validate your work. It would help if you provided more detail and possibly your version of the graph for comparison. – ggcg Aug 16 at 18:39

I don't know if OP is still working on this, but this seems to be a simple error in the formula given in the paper. The OP was on the right track with the "mismatch in domain." That is, the value of alpha (~0.6) that the authors state seems to be based on x and y in their equation being the number of semitones for each interval, as they then use in their scale on their graphs.

The formulas for x and y are wrong for that value of alpha and those graphs. I think what they actually mean is: x = 12*log2(f2/f1) and y = 12*log2(f3/f2). You need base 2 logarithms to convert frequencies to standard pitch scales based around repetition at the octave, and you need the factor of 12 to convert those fractions of an octave to numbers of semitones.

I haven't tried to see whether this matches their model for overtones as well, but it seems to be very close to (if not exactly) what their basic gaussian curve for only fundamental frequencies is based on (in figure 5 and the "F0 only" lines in figures 6-8).

I'd say if you want to calculate the tonal tension of triads, find a better model. (There are plenty of attempts out there.)

• Interesting point of discussion. I've been working on it and I solved all the problems/incoherence between domains, i'll update my code with explanations as soon as possible. Regarding the second part, i did not actually "test" the model proposed, i'm a simple college student (i don't even know how would i do that to be honest). Do you think it's not valid? Do you have any suggestions for better models? It would be great – Mattia Surricchio Oct 25 at 8:57
• @MattiaSurricchio - No, I personally don't think the given model reflects a realistic understanding of musical tension. Basically, it only seems to work at all within equal temperament and the fact that the authors only mention cases where the lower interval of a triad is fixed at 3, 4, or 5 ET semitones. If you start calculating tension with any other intervals (including slightly detuned non-ET intervals), the results seem very counterintuitive. As for the rest, there are lots of mathy models of "dissonance" or musical "distance" out there; all of them have benefits and drawbacks. – Athanasius Oct 27 at 4:10
• Regarding dissonance, there's a psychoacoustic model, which is based on the "bandpass filters" of the ear, but doesn't explain phenomenon like triads ecc... it only relies on the physical meaning of dissonance (we're not capable of separate frequencies that are too close to each other). I thought that the paper i mentioned above, relied on the assumption of 12 semitones scale (the common one in western culture). Isn't it enough as assumption? – Mattia Surricchio Oct 27 at 10:50
• @MattiaSurricchio: Yes, it relies on a 12-tone equal tempered scale, but the problem is that the "tension" curves they provide in their paper appear to give tension values to the frequencies in-between those scale steps. And my point is that when you begin to adjust what they call the "1st interval" to other values other than the integers 3, 4, and 5 that they use in their graphs, the model gives really weird results. (Honestly, the graphs for 3, 4, and 5 also don't model dissonance/tension well either, from my perspective; they just happen to line up well for a handful of intervals.) – Athanasius Oct 27 at 12:35
• For example: Look at fig. 7. Assume the lower pitches are C-E. Fig. 7 has a peak for the aug. triad C-E-G#, which makes sense. It has local min. at C-E-G for triad. That's good. But the "minor 1st. inv." minimum occurs not at C-E-A; the curve goes down so the min. is between A and Bb, which makes little sense. C-E-Bb is "tense," though only (?) about as tense as a minor triad (C-E-A), but C-E-B is even less tense than C-E-A(!?). Basically, the graphs show the very tiny number of vaguely correct places the model sort of works, while ignoring the vast majority of situations where it wouldn't. – Athanasius Oct 27 at 12:48

They used six partials and you only use the fundamental. That's the problem. Anyway, their approach doesn't make any sense to me. The basic assumptions are not supported by any evidence and unnecessarily complicated. The elusive partial tones, which do not have to exist in reality, introduce a high degree of ambiguity. If I understand it right, "tension" is an artifact they introduced in order to get their wrong model to behave like reality for the case of three tone intervals. In their model, the central note of a triad behaves different to the outer tones, which is just absurd. So the question is anyway, what their concept of tension means musically. I quess it doesn't mean anything.

The consonance of an interval indeed depends on the overtone intensity distribution, but I found adding the sums of the prime factors of nominator and numerator for an interval gives a reasonable estimation for its dissonance. A chord's dissonance is the average of dissonance of its composite intervals. E.g. the major triad = 4:5:6 = 3:2 + 5:4 + 6:5 = 3:2 + 5:(2*2) + (3*2):5 Dissonance = (3+2 + 5+2+2 + 3+2+5)/3 = 8

Not applicable for extremely dissonant chords though, as the while sound more consonant due to the similarity to nearby more consonant chords. This is a result of our ear's limited frequency resolution. One can get extend the model essentially by calculating the consonance as the inverse of the dissonance and applying a smoothing and get a smooth n-dimensional consonance function for a chord containing n+1 notes.