I see that pygame.mixer.Sound supports OGG, I guess I should try that. I've never used OGG before, and I wonder if it supports OGG if MP3 would be an easy addition?
Well so much for using OGG (and probably MP3) to speed up preloading. With my 13 minute mono soundfiles, it takes 7.3 seconds to preload the wav file (44.1hz, 16 bit, mono) and 43.6 seconds to preload the OGG file... I have a feeling it's uncompressing it during preload.
My project needs polyphony, but really only the ability to play two sounds at once. I'm currently using this method because it supports that:
channel = 1 # or 2
sound_obj = pygame.mixer.Sound("whatever.wav") # long preload at this step
channel = pygame.mixer.Channel(channel)
channel.play(sound_obj)
This method of playing MP3 works beautifully without preloading, but can only play one sound at a time:
pygame.mixer.init()
pygame.mixer.music.load("whatever.mp3")
pygame.mixer.music.play()
pygame.event.wait()
I don't imagine anyone knows of a way to play two sound files simultaneously using pygame.mixer.music? Or some other solution in Python under Linux that would do it reliably? I suppose I could slave two instances of mplayer, but I'd of course prefer to not be forking out processes.
If anyone's curious about the files I'm trying to load, I posted some test files here: