You will want to look into MML. Its code that allows you to create songs by setting instruments, notes, octaves, tempo, and note length. Its quite powerful, but it takes some getting useful.
What you do is a combination of
bgmclear, bgmset, bgmplayand the mml as DATA.