Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7758195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:17:44+00:00 2026-06-01T13:17:44+00:00

Anyone have experience playing audio (right now specifically mp3s) with python using a any

  • 0

Anyone have experience playing audio (right now specifically mp3s) with python using a any libs?

Details:

Use is in a wxPython app (yes I have tried wx.media.MediaCtrl)

Ok now is here things I have tried.

tried code like http://www.daniweb.com/software-development/python/code/216465/play-mp3-files-via-pythons-win32com-support

Doesn’t work (no audio what so ever)

tried wxPython MediaCtrl: Works sometimes but recently only file playback works, urls play for a couple seconds and then no audio (but track keeps going, I know the file is downloaded fully also so it isn’t the media not being downloaded).
I was able to fix this with restarting then it worked for a bit then broke, tried restarting again and this time that didn’t fix it, however other player that use windows media apis (a C# .NET app) work just fine and so does Windows Media Player. So it is some bug in the wxWidgets libs I guess

tried using mplayer, example: http://www.blog.pythonlibrary.org/2010/07/24/wxpython-creating-a-simple-media-player/ major problems mplayer doesn’t like setting properties and so I can’t ever pause because if I do it then won’t let me set the state back to play (see code I use here http://paste.pocoo.org/show/574269/ )

On Linux I have used gstreamer, works after some headaches (though still has its problems also), MacOS X hasn’t been tested yet but I am going to try quicktime and wx.media.MediaCtrl hoping that works)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:17:45+00:00Added an answer on June 1, 2026 at 1:17 pm

    I’ve used PortAudio in a couple of projects, which is a free-cross-platform-open-source-audio library, but never with python. Don’t worry, there are bindings for it:

    PyAudio provides Python bindings for PortAudio.

    """ Play a WAVE file. """
    
    import pyaudio
    import wave
    import sys
    
    chunk = 1024
    
    if len(sys.argv) < 2:
        print "Plays a wave file.\n\n" +\
              "Usage: %s filename.wav" % sys.argv[0]
        sys.exit(-1)
    
    wf = wave.open(sys.argv[1], 'rb')
    
    p = pyaudio.PyAudio()
    
    # open stream
    stream = p.open(format =
                    p.get_format_from_width(wf.getsampwidth()),
                    channels = wf.getnchannels(),
                    rate = wf.getframerate(),
                    output = True)
    
    # read data
    data = wf.readframes(chunk)
    
    # play stream
    while data != '':
        stream.write(data)
        data = wf.readframes(chunk)
    
    stream.close()
    p.terminate()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone have experience with algorithmic trading (like stocks)? Any good services to use to
Does anyone have experience using the URL Rewrite Module (see here )? Can it
Does anyone have experience using makefiles for Visual Studio C++ builds (under VS 2005)
Does anyone have experience collaborating with someone using a different version of Visual Studio?
Anyone have experience with adding a ReSharper profile to the VS2008 solution and share
Anyone have experience with this plugin? I have it installed but I have no
anyone have experience doing this? when i say imaginary i mean the square root
Does anyone have experience with LLVM , llvm-gcc , or Clang ? The whole
Does anyone have experience with algorithms for evaluating hypergeometric functions? I would be interested
Does anyone have experience with implementing OpenID on a non technical website? If you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.