Is anyone aware of any formulas that can be used to calculate consonance or dissonance from a list of frequencies (in hertz)?

I realize consonance/dissonance is a somewhat nebulous concept. What I mean is what the human ear perceives as a need for resolution (I realize this is probably even more nebulous).

So for example, in 440 hz equal temperament, a C major triad starting on C5 (C5 - 523.2511 hz, E5 - 659.2551, G5 - 783.9909) would be perceived as mostly consonant (not in need of resolution), whereas a C diminished triad (C5 - 523.2511 hz, Eb5 - 622.2540 hz, Gb5 - 739.9888) would be perceived as quite dissonant (and in need of resolution). One can imagine upper chord extensions, which would generally (always?) add dissonance. This feels to me like a phenomena which should be able to be approximated with a formula.

For context: I'm working on an application which randomly generates chromatic contexts (sets of possible notes in hertz), scales based upon that chromatic context, and chords based upon those scales. I'm in need of a formula which will allow me to programmatically predict which chord cadences may prove pleasing to the human ear (moving from consonance, to dissonance, and back to consonance).

I realize that this is a difficult problem. Anything you can do to point me in the right direction would be helpful.

  • 1
    I sense you'll run into many of the same problems as here - the awkward part is that, in a given key in equal temperament, a plain old major chord (e.g. the Neapolitan or bII) may very well be more dissonant than a diminished 7th chord (e.g. vii°7).
    – Dekkadeci
    Commented Aug 4, 2019 at 6:15
  • You should definitely have a chat with that user (Seery) - he seems to have a similar project on the go! Commented Aug 4, 2019 at 7:39
  • 1
    It's likely not to be productive, as we all listen to harmonic changes differently. That apart, more often than not, it's the interaction between a series of harmonies (chords if you like) that produce consonance/dissonance, not merely one chord following another. But there's still that subjectivity.
    – Tim
    Commented Aug 4, 2019 at 10:17

1 Answer 1


Momentary consonance/dissonance has been studied and somewhat formalised - if you click through the links on this answer by endolith, you will find some code that can calculate dissonance of an interval based on a particular harmonic structure.

However, you're right to say that that's not the same thing as what the human ear perceives as a need for resolution. One particular reason for that is that our perception of tension and resolution is strongly influenced by our perception of where the tonic of the piece is, rather than just the instantaneous harmonic structure.

A more general reason is that perception of tension and resolution is very much a question of each lister's expectations, will be different for every person based on their listening experience - and even their own character and psychological make-up! Not the kind of thing that can be reduced to a formula.

One direction you could take is to analyse a corpus of works and build some probability chains of certain harmonic motions to get an idea of what listener expectations might be (at least for listeners who have listened to the works in your corpus!).

Another problem is that if you only follow a listener's expectations, they're likely to stop feeling tension and resolution, and start feeling boredom...

And taking a step back, you can't only consider tension and resolution in terms of which chord follows which - you have to consider phrasing, rhythmic feel, changes in timbre, lyrics, and so on. Some genres of music have very little in the way of chord changes, and yet still manage to build tension and resolution and take the listener on a journey.

Not the answer you're looking for? Browse other questions tagged or ask your own question.