play audio on OSX?

Discussion in 'Python' started by Nick Parker, Sep 30, 2005.

  1. Nick Parker

    Nick Parker Guest

    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!
     
    Nick Parker, Sep 30, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lola
    Replies:
    34
    Views:
    14,642
    Oldmancolorado_deleted
    Jun 16, 2010
  2. Ron Provost
    Replies:
    1
    Views:
    445
  3. Replies:
    13
    Views:
    6,340
    GNightOwl
    Dec 3, 2008
  4. chump
    Replies:
    7
    Views:
    1,010
    Andrew Thompson
    Jan 19, 2007
  5. sick dick
    Replies:
    0
    Views:
    406
    sick dick
    Apr 3, 2006
Loading...

Share This Page