If you plan to make a project and share it privately with a few friends, then copyright is not really in effect. Nobody can stop you from doing that.
If you plan to share the project with friends, but also make it available to the public (as in a portfolio), then you do need to follow copyright. It doesn’t matter if you sell the project or not.
I think I see what you mean now. If you want to have a specific library (and not allow any song, only ones you’ve already configured) then the best course of action is to get the license from some songs, use these and include them in the base game. If the creator of a song doesn’t want their creation in your game, there is nothing you can do about that.
You could try to implement the mechanism in such way to generate the game based on any song, which would allow users to upload any song without limitations, and as long as your game doesn’t have a copy of the song, you don’t need any license. This puts the “responsibility” on the user to get a legal copy of the song they want.
Keep in mind programs that download YouTube videos are in violation of YouTube’s ToS (at least it used to be, not sure if something has changed). I don’t know the details of, if YouTube has taken any actions against it, but if you decide to do something similar and YouTube comes after you, you can’t use the defense “but others are doing it too”. For all we know, they may have a license from YouTube to do that.