What is a good package for playing MP3 files in python? It would need to be something that is maintained and is cross platform (Win, Mac, Linux) and something with a simple and repeatable call structure, rather than having to perform complex setup every time the same file is opened (I use the sounds in various loops and need to not have to constantly worry about if a channel is full or other factors). It also needs to be relatively small; I don't want to import an entire GUI toolkit just so I can play a small bell and alert sounds. Lastly, it needs to be non-blocking; I need it to play the file once and move on without locking up the entire program.
I had been using PyAudiere in order to play MP3 files from python, as it used to meet all these criteria. Unfortunately, the package has been abandoned, and so I need to find a replacement (PyAudiere was updated to python 2.6 and still works in 2.7 if you hack it by manually changing the version check, but this is not a long term solution, especially since finding a copy of the package is now difficult).
Hi Try the following libraries:
PyMedia
pygame
PyAudio
pyglet
Related
I have tried many times to use a compiler like cx_freeze and other programs, but for some reason nothing seems to be working. I made a little game which I want to send to a friend, but he needs python installed.
Can't I just put python.exe and pygame into the folder that I will send my friend and won't python be installed then, and all he needs to do is run the program .py and it will work? Sorry if I'm not being clear.. I'm just trying to find a simple way to compile my code to let users not waste time on downloading pygame and python.
py2exe allows you to package python applications for Windows. Right now it supports everything from 2.4 - 3.1 of python. You do however need to be able to redistribute MSVCR90.dll.
There are a range of distribution tools and you can find a list here.
Since you've had difficultly with several tools now updating your question with error codes and speific problems will yeild better responses.
From my knowledge, just putting a bunch of your stuff in one folder and sending doesn't work. It would be easier to make a .exe
That way your stuff will be protected, and users can easily start it. Otherwise idk. Try using pyinstaller again. It should work if you have a python.x
CX_Freeze is known for having many bugs and problems, Pyg.exe is new to me also. Your best bet is just keep trying until you find a solution.
Putting python.exe and your script together in a folder will not work for distribution. You require all Python dependencies - at best your would need to include all of your Python folder, and it still might not work. The best method would be compilation or packaging with programs such as py2exe, cx_freeze, Cython, pyg.exe, etc.
I've searched for this around, and every answer seems to include an external Python library, such as Pygame, Snack, etc, for playing sounds.
Is there not a simple pure pythonic way from the built in modules to play, say, a .wav file without the use for external modules? I know that Python doesn't natively support .mp3 files.
The most I've found in that regard is winsound. Nothing extra to install; just import it. However, as you might have guessed, it only works on Windows. I use Pygame's mixer when I want sound. Its support for mp3 files is limited, and it requires an installation (unless you package your application), but it's the most straightforward of the third-party audio modules I've looked into.
I don't get what Clyther is or how to use it.
My stuff:
ATI OpenCl SDK (just dl'd)
clyther beta (just dl'd)
windows 7 pro 64 bit
active python 3.1.2
Xfxs Ati radeon 5850 video card
I downloaded the ATI OpenCl SDK and the clyther beta from sourceforge. Then I tooke the sample 'reduce' function from the sourceforge documents and pasted the code into notepad and named it clythersample.py. When I double-click the file or open it in the interactiveshell, it gives an error message on the first line.
Is naming the file .py wrong? I guess clyther is its own lqnguage and not really python? Can I write python code and in the middle of the program, write a chunk of clyther code? Will python IDEs (esp. Wing understand and debug it?) Will it work with python 3 or do I need 2.6? Is 64 bit os ok?
(I'm not a programme or technically competent, so things like its a python API for OpenCl or it had C bindings for python don't mean a whole lot).
Clyther is a Python package for High-Performance Computing (HPC) using, for example, video cards with multiple Graphics Packaging Units (GPUs) or (less frequently) multi-core processors. Clyther is for parallel processing of algorithms or data sets that would normally take a lot of time to process serially. Meaning, if you have a problem that can be split into many smaller problems, then Clyther is a useful package to use. Additionally, your problem must be something that can use numpy arrays.
Clyther is a nice package to use if you have the problem it is intended to solve. It makes it fairly easy to write Python code to run on multiple processes.
If that's not the problem you need to solve, then Clyther probably won't help you.
When you name the file .py (the file extension associated with python.exe) and double-click it, how is windows supposed to know it's supposed to run the file with CLyther?
Is naming the file .py wrong? I guess clyther is its own lqnguage and not really python?
Documentation compares it with Cython - so I suppose it's an extension to the language, i.e. they take Python and bolt more features on it.
Can I write python code and in the middle of the program, write a chunk of clyther code?
From the goals of the project, it should (like Cython) ultimately be able to accept all or most Python code. So, yes - but of course you'd have to run the whole program with CLyther.
Will python IDEs (esp. Wing understand and debug it?)
Not natively, I suppose.
Side note: The project is in a very early stage of developement (very first beta-release), so don't expect things to run smoothly right now.
First things first, I am a Python beginner, with a typical C++/Java background for object oriented stuff.
I was convinced to try Python for this current endeavor I am working on, and so far I like it. One issue I am having though is finding a good mp3 module.
I have tried TkSnack, which installed and ran fine with no errors(as long as my audio device wasn't busy) but it could never actually produce a sound, it just did nothing... I went online for help, and was disappointed with the amount of documentation.
So I decided to switch. I tried PyMad because it is in the standard repositories for Ubuntu as well. There was even less documentation on this, but I could make it play a sound. The only problem is that it requires a loop to constantly write/play the audio buffer. This makes it particularly hairy to handle playback control(in my opinion) cause I would have to run this in a separate thread or process, and somehow control the seek position for pause and such. This is a little too low level for why I am using Python. I liked the simplicity of TkSnack for its easy commands like "mysound.play()" or "mysound.pause()" rather than controlling a loop.
I also looked at pyMedia, which looks like it is the most up to date with documentation, but I can't get it to install on my machine. I get a "gcc exited with value 1" error or something like that when running the "python setup.py build" command.
So I am looking for any suggestions or help on one of these modules, or a completely different one, that is high level and easy to use for mp3s(and preferably other formats too) I am trying to have basic playback control(pause, stop, skip, seek) and I may also be streaming files too eventually(if I ever get there).
EDIT: I like the python bindings for Gstreamer, but is this a cross-platform solution?? I forgot to mention that as a requirement. But I always just associated GStreamer with Linux, would this work on other OSs?
EDIT: Wikipedia says yes.
Sorry I can't help you with PyMad or pyMedia, but I have other suggestions.
Existing music players written in Python:
Exaile
FUPlayer
Listen
All of the above use the Python bindings for the GStreamer multimedia framework. Docs for the bindings are scarce, but check here, here, here, and examples from the source distribution here.
I just had to deal with this, and from my research I think your best bets are pyglet and pygame. They're interface packages with built-in a/v support.
I want to distribute a Python application to windows users who don't have Python or the correct Python version.
I have tried py2exe conversion but my Python program is really complex and involve code import on the fly by xmlrpc process so it is not suitable for py2exe.
The complete Python folder takes around 80MB but this includes docs and a lot of non-essential things.
Do you know if there exists a small package of a minimal Python interpreter I can include with my program ? Include a folder of 80MB is a bit big ;)
PyInstaller is a py2exe "competitor" that has many extras (such as being cross-platform, supporting popular third party packages "out of the box", and explicitly supporting advanced importing options) -- it might meet your needs. Just be sure to install the SVN trunk -- the existing (1.3) release is way, WAY obsolete (PyInstaller is under active development again since quite a while, but I can't convince the current maintainers to stop and do a RELEASE already -- they're kind of perfectionists and keep piling more and more great goodies, optimizations, enhancements, etc, into the SVN trunk instead;-).
Have a look at Portable Python. This will install a Python programming environment in a local folder. I am sure that you could strip many unwanted things off.
I recommend however that you give py2exe another chance.
..involve code import on the fly by xmlrpc process so it is not suitable for py2exe
Py2exe can deal with situations like this. You just have to tell it which modules are being imported at runtime, so that it includes them in the distribution. Your code should then be able to import from these modules dynamically.
püy2exe is bad and incompabilite to Windows 10 now.
I suggest you use BoxedApp Packer until 22 mb small without runtimes....
enter link description here
It is almost better than py2exe because py2exe need many py files and opened data files...