hi,all
My function is
press keyboard then in the event "KEYDOWN" play the sound (*.midi *.wav ...)
I need the sound play immediately but it seems always has about 1 second delay
how to solve these?
my code like these:
pickUpSound = pygame.mixer.Sound('/home/yu/work/symphony/pickup.wav')
#pygame.mixer.music.load('/home/yu/work/symphony/background.mid')
#pygame.mixer.music.play(-1, 0.0)
# run the game loop
while True:
# check for the QUIT event
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == KEYDOWN:
# change the keyboard variables
if event.key == K_LEFT or event.key == ord('a'):
pickUpSound.play()
regards
yu