Comedians will tell you that jocularity depends on timing. Knowing when to put in that quip for maximum effect is a key skill; conversely saying the light hearted comment at the wrong time can be disastrous.
know your audience, know the occasion and the timing will flow.