Intellectual property law, especially around music, is complicated. But it is based on a simple notion: enabling all artists and creators to control and earn a living through their creations. Respect other artists in your creation process, and when in doubt, ask for permission.
The more you learn about how to run your music business legally, the more opportunities you have for long term success. Educate yourself by reading about the music business and related laws. Online materials created by public sources (such as the Copyright Office), public service organizations, or by academic institutions tend to be more reliable. If you need more help, reach out to a volunteer legal organization in your state focused on supporting artists, such as: