Computer Programming
Mac OS

How do you play sound affects with python on a Macintosh?

012

Answer

User Avatar
Wiki User
07/29/2008

Install PyObjC, and check out the NSSound module.

Example:

from AppKit import NSSound

play = NSSound.alloc()

play.initWithContentsOfFile_byReference_('/mysound.mp3′, True)

play.play()

play.stop()