Skip to content Skip to sidebar Skip to footer

Using Pygame To Load Mp3 And Fade Out

I am trying to incorporate sounds in our GoPigo and I am using Python. I installed PyGame and was trying to use fadeout but it seems not working. It doesn't generate an error but f

Solution 1:

The unit of the time parameter to pygame.mixer.music.fadeout() is milliseconds. 10 seconds are 10000 milliseconds:

pygame.mixer.music.load(audio1)
pygame.mixer.music.play()

# play for 12.5 seconds
pygame.time.wait(12500)

# fade out for 10 seconds
pygame.mixer.music.fadeout(10000) 
pygame.time.wait(10000)

Post a Comment for "Using Pygame To Load Mp3 And Fade Out"