Skip to content

Instantly share code, notes, and snippets.

@andreztz
Created November 4, 2016 23:46
Show Gist options
  • Select an option

  • Save andreztz/afc1bf104f81039204e1cf62af0750cc to your computer and use it in GitHub Desktop.

Select an option

Save andreztz/afc1bf104f81039204e1cf62af0750cc to your computer and use it in GitHub Desktop.
import pygame
class Player(object):
def __init__(self, localmp3):
self.localmp3 = localmp3
self.play()
def play(self):
pygame.mixer.init()
pygame.mixer.pre_init(44100, 16, 2, 5000)
pygame.mixer_music.load(self.localmp3)
pygame.mixer_music.play(-1)
while pygame.mixer_music.get_busy():
pygame.time.Clock().tick(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment