play audio on OSX?

N

Nick Parker

I'm attempting to play an mp3 file on OSX, but am running into some
difficulty. When using py-mad and py-ao, I only get static with the
following code (which is derived off another mailing that I found from
this list's archives):

#!/usr/bin/env python

'''Requires:
py-mad (mp3 ability)
py-ao (system audio ability)
'''
import mad, ao, sys
mf = mad.MadFile(sys.argv[1])
dev = ao.AudioDevice('macosx')#osx device, linux: use "oss" or "alsa"
while 1:
buf = mf.read()
if buf is None:
break
dev.play(buf, len(buf))

Does anyone know why this produces static, or whether there's a better
method of producing audio output that's also cross-platform (OSX,
linux)? I've looked at pymedia, but they do not support OSX at the moment.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top