It’s legal if the music is in the public domain. What’s in the public domain? Any song published in 1922 or earlier.
There’s a good chance you aren’t trying to use a song from 100 years ago. If that’s the case you need to obtain a license to use it. Also keep it mind that many recordings have not only a copyright for the song, but also for the recording of the song itself. If that’s the case, you’ll need to obtain two licenses.
Looking for further clarification on copyrights? Visitto set up a free consultation with a skilled IP attorney!