first of all, I really hope I'm in the right place, secondly, I know this is a difficult topic and many have tried figuring it out but can't find anything specific yet, so, here it goes:

From what I see, you guys are mainly creating music, so you do understand the idea of an emotional part to a song. What I am trying to do is build a service that accurately gives you the music that you want to listen (as other services tried but none has succeeded yet). One of the things I need in order to do that is a way to "calculate" the emotion that a song is exposing. For instance, I've read somewhere that usually a sad song will have it's key in Am.

The question is, is it possible to "read" the emotion of a song (happy, sad, etc..) by analysing the spectrum or other "technical" characteristics? If yes, can someone point me into the right direction?

An even bigger stretch would be doing the same thing with the genre(pretty sure this isn't possible but if I'm wrong, and I hope I am, please correct me).

Thank you all in advance and I really hope I'm in the right place. If not, please let me know and I'll delete the post straight away.

Edit For anyone interested in this topic you can also follow this discussion: https://music.stackexchange.com/questions/48549/reading-emotions-from-a-song

2 Answers 2


While it's safe to say that most minor scales sound sad opposed to major ones who appear to have a happier quality to them - both major and minor share the same notes (as in A minor scale is the same as C major).

Most music has a more complex musical structure and even has foley and sounds integrated nowadays so a mood detection algorithm should be pretty capable at identifying a scales and melodic characteristics as well as rhythmic patterns.

Though to do it might be easier through user preferences and statistics - like iTunes or Google's Play Music.

For more technical music stuff there's always music.stackexchange.com

  • cool, thanks a lot, I will also post this question there. I know that the easier way would be through user preferences, but that's part of the reason why these services aren't that good at it. The main 2 problems that most services have are: 1. Hitting a "radio" button on a song will do one of 2 things: either start a playlist with just that artist or start a radio which randomly adds songs into your playlist, but 10 songs later you're listening to something else (maybe because of wrong tags). 2. They are playlists so you end up listening to the same 50 songs when you could have thousands.
    – Spluf
    Sep 5, 2016 at 9:57

It won't be one property that will tell you the mood of a song. It will be an amalgamation of things. So I'm not saying each of these will 100% tell you the mood of the song. But they may, in part, give an indication.

  • key signature
  • chords present (amount of minor/major chords relitive/ratio)
  • chord changes present (amount/which chords are they?)
  • known chord progressions (known to evoke certain emotions)
  • overall loudness (+ other loudness statistics)
  • BPM + time signatures (e.g. are consistent time signatures less likely to be sad)
  • how the melody interacts with other elements (probably undetectable)
  • syncopation/swung quavers, semiquavers/rhythm...

These properties can be given a score of probable mood. Like the saddest chords given sad score of 100 and happy score of 0 etc.

I think the most important part of this will be testing it, adjusting it and narrowing it down through trial and error and usage feedback. Hopefully it will start to work as you want after a while.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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