How it works
を (object) marks 音楽 (music) as what's heard, and 聞く (listen) is the verb. Then の (that) turns the whole phrase "listening to music" into a noun, which が (subject) marks as the subject of 好き (like) — literally "listening-to-music is liked." Plain, casual, no copula at the end.