I need music files I can use for testing my program that I can put in my git repo.
Can I copy the test music files from other open source projects? Do I have to attribute them and if so how?
Generally, I would expect that a program that manipulates audio is a separate work, under copyright law, from any sample audio files that are supplied to be used optionally as input to that program. Therefore nearly any licensing terms that allow redistribution of the audio generally will allow redistribution alongside your program.
Artists who wish to make their artwork (including music) free to redistribute often license their work under a Creative Commons license. The Creative Commons organization maintains a list of sites that host music under various Creative Commons licenses.
Since you plan to use the music as input, and not distribute the songs in a way that includes a derivative work of the music within the distribution, I think your open source project can safely use works under any Creative Commons license terms except NonCommercial (NC) terms. NC terms are not immediately problematic for you if your distribution is non-commercial, but any time a downstream recipient wanted to distribute the repository under commercial terms, they would need to remove those NC-licensed files. If you expect to include sample output as well, you should also avoid NoDerivs (ND) terms, if your program creates a derivative under copyright law (note that simply changing the file format is allowed by ND terms).
Attribution (BY) terms are fine (so long as you do preserve attribution alongside or within the files) and ShareAlike (SA) terms will not affect your program (since the program and sample input are separate works), but would mean that sample output derived from SA input that you include must be under the same SA terms.