Pygame sound effects do not play for a few seconds if the corresponding buttons (to play the sound effect) is pressed for four consecutive times. I'm currently trying to experiment with different keys of the piano.
I've tried removing the pygame clock object. I've tried making the Sound.play() into a function, as found in the code.
import pygame
pygame.init()
###LordKeys###
A5 = pygame.mixer.Sound('PianoKeys/A5.wav')
A6 = pygame.mixer.Sound('PianoKeys/A6.wav')
def A56():
A5.play()
A6.play()
###############################################
run = True
win = pygame.display.set_mode((700,700))
pygame.display.set_caption("Piano Gen")
while run:
win.fill((255,255,255))
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_a:
A56()
pygame.display.update()
Expected Results: the sound effect to play when the key is pressed, regardless of frequency.