pythonmacospygamewinsound

Play a WAV melody on Mac


I'm looking for an alternative to winsound that works on macOS so that I can create a melody. I've already tried it with:

import pygame

pygame.init()
pygame.mixer.init()
sounda = pygame.mixer.Sound("desert_rustle.wav")
sounda.play()

but it doesn't work...


Solution

  • I do not have ability to test that on macOS, but after searching on PyPI I found boombox which might work for you, first install it

    pip install boombox
    

    then check if it does work on your machine

    from boombox import BoomBox
    boombox = BoomBox("desert_rustle.wav")
    boombox.play()
    

    If you need packages to work with macOS, you might filter by operating system in PyPI browse - PyPI packages with MacOS label