Answers for "pygame mixer"

7

pygame play sound

import pygame

pygame.mixer.init()
crash_sound = pygame.mixer.Sound("crash.wav")
crash_sound.play()
Posted by: Guest on July-14-2020
0

how to put song in pygame

#has to be in .mp3 format
#has to be in same folder
#load the music
pygame.mixer.music.load('song.mp3')
#play the music infinite
pygame.mixer.music.play(-1)
#or play it one time
pygame.mixer.music.play(0)
Posted by: Guest on May-15-2020
0

pygame mixer documentation

# Pygame mixer is a pygame module for loading and playing sounds
# Docs:
https://www.pygame.org/docs/ref/mixer.html
Posted by: Guest on May-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language