Python audio just makes the windows ding noises
Question: So, I am using Python3 making something that plays songs. I have it working so
if I press 1, it plays the playlist, if I press 2, it plays the first song,
and if I press 3, it plays the second song. It works with Circles, but in the
playlist once it gets to Bullseye, it just dings (Like when a notification
comes up and you click somewhere else) constantly. When you press 3, it dings
once and sits there. I think it may be a connection with the song
(BullsEye.mp3) is this my code or has anyone else had this issue before?

    
    
    from time import *
    import winsound
    from winsound import *
    input = input('1 for playlist - 2 for Circles - 3 for BullsEye ')
    var = int(input)
    while var==1:
        winsound.PlaySound("Circles.mp3", winsound.SND_ALIAS)
        winsound.PlaySound("BullsEye.mp3", winsound.SND_ALIAS)
    if var==2:
        winsound.PlaySound("Circles.mp3", winsound.SND_ALIAS)
    if var==3:
        winsound.PlaySound("BullsEye.mp3", winsound.SND_ALIAS)
    


Answer: Use `winsound.SND_FILENAME` instead of `winsound.SND_ALIAS` if you want to
pass a filename instead of a predefined alias such as `'SystemExit'` otherwise
it just plays a default sound if you pass unrecognized alias (that is likely
for an arbitrary filename):

    
    
    #!/usr/bin/env python3
    
    audio_files = ["Circles.wav", "BullsEye.wav"]
    
    def play(filename):
        winsound.PlaySound(filename, winsound.SND_FILENAME)
    
    choice = int(input('1 for playlist - 2 for Circles - 3 for BullsEye '))
    if choice == 1:
        for filename in audio_files:
            play(filename)
    elif choice in {2, 3}:
        play(audio_files[choice-2])
    else:
        assert 0
    

Note: `PlaySound` plays wav files, not mp3. To play mp3 using a default
player, you could use `os.startfile()`.

