melancholically or melancholic

Yes, you can use melancholically if you want in that place, without changes to the sentence structure. As the sentence is right now I would not use melancholic, as that is the wrong form, but with editing it could be a useable alternative.

If you really want to use melancholic, then I would suggest the following, although without context it is hard.

The music begins playing in a melancholic mood, sorrowfully wafting over the dance floor.

Basically, melancholic is an adjective, and has to describe a noun or pronoun. Over is not either of these, so it would be incorrect usage. You need to edit the sentence to include one of these if you want to use that word.