I have an array of Song class objects that I created and I'm having problem playing music with pygame mixer.
as you can see, I have 4 songs in the working directory, I created an array of Songs object which have information about the different song.
on particular function that I have created is getIndexName()
which returns the name of the file.
the name of the array is songsData
.
If I would call the function:
mixer.music.load("song1.mp3)
and then mixer.music.play()
it works fine, however if I would call:
mixer.music.load(songsData[1].getIndexName())
and then mixer.music.play()
I'm getting an error:
mixer.music.load(songsData[1].getIndexName()) pygame.error: Couldn't open 'song2.mp3
I think that I have to determine which file I want to play at compilation time, but I don't know If I think right. If I'm right is there any module that can play mp3 files (or wav) and I can determine which file at run-time? (like calling random).
thanks for youre help!