Does using the word ain’t in a song make it slang, whereas using it in a speech make it colloquial?
From your comments about register, you seem to be talking about affecting a colloquialism.
If a songwriter who would naturally use the word in speaking their own dialect, or if it is written from the perspective of a narrator-character who would use it, then it's still a colloquialism.
Now, if a conservative politician who generally used a very formal register and whose background was such that ain't wouldn't come naturally to them, said in a speech "you ain't seen nothing yet", then that would still be a colloquialism. The difference is that it's affected rather than just coming naturally.
And I could just about conceive that happening in a song, though I'd be surprised.
It still ain't slang.
Edit: For that matter, some might argue that since it's "colloquial" to more places than it isn't "colloquial" to, that it's not really colloquial at all, but that gets into more complicated issues about what does and doesn't get to considered "standard".
As far as I know, "ain't" is a colloquialism and is frowned upon by quite a few native speakers as 'nonstandard'. But I don't think it is considered slang anywhere. Then again, there isn't much difference between colloquialism and slang, is there?
The OED labels ain’t as “dialectic and colloquial”. It is certainly not slang. They also mention that it is in “general informal use”.
So it is not formal. It is extremely common, however, in some dialects and registers.