Humour is an evolved mechanism that helps us to recognise when our feelings about something are wrong.
(I originally published this theory at http://www.1729.com/column/9June2000-humour.html.)
Often humour happens when evidence is presented, and this evidence provides overwhelming proof that our prior beliefs must be wrong.
Humour brings us closer to the truth, to a more correct understanding of reality.
Music, on the other hand, motivates us to imagine altered realities.
Music motivates our imaginations to ignore some of the evidence.
Music allows us to move away from the truth, to consider hypothetical realities that are better, or worse, or more interesting, or more dramatic than the actual reality that we know of.
The Opposition of Music and Humour
Humour motivates the search for truth.
Music motivates construction of alternative truth.
In practice humour and music do not directly conflict, because humour relates more to our perception of reality, and music relates more to our imagination, and to the construction of hypothetical realities.
The Co-existence of Music and Humour
There are, of course, many humorous songs in the world.
However these songs are usually not the most intense emotional songs.
The conflict between the truthiness of humour and the falsiness of music can be a basis for a particular type of musical humour.
With this type of humour, music is used as the setup. Music is used to set up our feelings where we (hypothetically) believe that something is true. Our belief in this musically-supported truth is sustained by the motivation that music gives us to ignore some of the evidence. But then humour comes in, and humour demolishes the false truth set up by the music.
One way to understand the co-existence of music and humour is that, in the end, they cannot co-exist, and one or the other has to "win".
Transitional and Non-Transitional Humour
Music tends to reflect a single unchanging situation.
Humour normally involves a transition. There is an initial state where the perception of reality is wrong in some way. This is followed by a presentation of the evidence, and a transition to a state in which there is a more correct perception of reality.
Sometimes there is no explicit presentation of evidence, and the humour depends more on the recipient gradually realising for themselves that what they are feeling about a situation must actually be wrong.
With this type of humour there can be an on-going uncomfortable co-existence between the false feelings and the logical realisation that those feelings must be false, and we might call this type of humour "non-transitional", or perhaps "less transitional".
With the more transitional humour, music wins at the start, but then the transition happens, and humour wins.
With the less transitional humour, music wins to start with, and the humour fights against the music, and even after we get to the end of the song, we may not be too sure which of the two has won.