Platform independent way to play an mp3 file

Pete Shinners pete at shinners.org
Thu Aug 19 10:54:35 EDT 2004


Gandalf wrote:
> Oh, okay. That's fine. At least I can tell something to my bosses. :-D
> But what about FreeBSD?

You can go with pygame, but it comes with a bit of overhead for simply 
playing MP3 audio. I'll also warn you that the decoder it depends on 
isn't spectacular, it won't parse files with ID3V2 tags might be your 
biggest problem.

     import pygame
     pygame.mixer.init()
     pygame.mixer.music.load("music.mp3")
     pygame.mixer.music.play(-1) #loop infinitely

     #music will play indefinitely until program ends




More information about the Python-list mailing list