-1

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...

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • What exactly do you mean by "it doesn't work"? – mkrieger1 Oct 04 '21 at 12:50
  • ```import pygame pygame.init() sound = pygame.mixer.Sound('desert_rustle.wav') pygame.mixer.Sound.play(sound) pygame.time.wait(int(sound.get_length() * 1000))``` – Oo.oO Oct 04 '21 at 13:18

1 Answers1

0

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

Daweo
  • 31,313
  • 3
  • 12
  • 25