That's why it is hard writing Chinese lyrics .... rather hard for Mandarin songs (4 tones) .... and very hard for Cantonese songs (9 tones). And don't forget to maintain the rhyme.
If the tone of a character do not match the tone of song, it is easy to be mistaken as another character. Experienced singers may tweak the tone slightly as the last remedy. In most cases, native speakers could deduce the correct character by the term or the whole sentence when listening to such songs.
Many hymns in Hong Kong were filled with Cantonese lyrics of the wrong tones. They all sound extremely odd to native Cantonese speakers. Luckily, the vocabulary used are quite predictable and most people can understand the hymns.
People also make jokes through lyrics with deliberate wrong tones. "Mcdull Kindergarden Song" (春田花花幼稚園校歌) is a good example. There is even a wiki page. To translate the first sentence:
我們是快樂的好兒童 (written) = We are happy good kids
鵝-滿-是-快-烙-滴-好耳痛 (sounded) = groose-full-is-quick-sear-drop-very painful ear
Funny, isn't it?