Sorry if I just did something stupid, I have never used pygame before. I'm trying to make pygame play morse code by looking at a string and playing the sound accordingly, although when I run it, it only plays the short beep 3 times and the long beep once. is this because multiple beeps are playing at the same time? can someone help, because I have no experience whatsoever with pygame. Here is my code:
from pygame import mixer
import os
import time
CURR_DIR = os.path.dirname(os.path.realpath(__file__))
mixer.init()
l = ".... . .-.. ---"
h = list(l)
print(h)
def play(CURR_DIR, l):
for i in l:
if i == ".":
mixer.music.load(CURR_DIR + "\short beep.mp3")
mixer.music.set_volume(0.7)
mixer.music.play()
print(".")
elif i == "-":
mixer.music.load(CURR_DIR + "\long beep.mp3")
mixer.music.set_volume(0.7)
mixer.music.play()
print("-")
elif i == " ":
time.sleep(1)
print(" ")
play(CURR_DIR, l)