I am building an application in pyQt4 and I want it to be able to play audio files. I was considering doing this through pyMedia as I could not get anywhere with the documentation, although the QAudio classes did initially look promising. It is important that the solution be cross-platform. Does anyone have any suggestions?
As alex said, Phonon looks like your best bet because you can use it with Pyqt. You can find lots of examples of using phonon using google. This one, http://forum.kde.org/viewtopic.php?f=14&t=84275, for example is a command line tool to play audio using phonon. You might also want to take a look at the QSound class. QAudioInput looks interesting for adding support for a mike.
I hope this helps.
P.S.:
The riverbank site does mention the phonon module :)
I found a question on using Phonon + Pyqt - Play mp3 using Python, PyQt, and Phonon
Use Phonon ( http://phonon.kde.org/ ). I used it from Java with success, so I expect it will work even better in Python/Linux.
This might also help:
http://0pointer.de/blog/projects/guide-to-sound-apis.html
Related
I am learning Pyprocessing. It comes with the regular processing platform that originally was written in Java. Many of the example projects that come bundled with processing have also been written in Python but not any of the audio libraries/examples.
I tried searching google but haven't found anything as of yet.
Does anyone know of a good resource where I can learn to do basic things with the audio library in pyprocessing such as playing audio and filtering audio?
I've used pyaudio and SWMixer for basic audio needs on a project.
Other python-audio resources I found useful at the time:
Scott W Harden's blog post on FFT analysis in Python (lots of neat things there)
PyAudioMixer
python-sounddevice
I hadn't used these exhaustively though to be able to advise on which one is most stable and easy to use.
I'm writing a simple window manager as a hobby project, and I've chosen python and xlib to implement it. I'd like to have some fancy effects like windows sliding from left and right, and from what I've been able to dig up, the best way to go about this is to use the composite extension to render windows to offscreen buffers, and then manipulate those buffers and paint them however I want.
However, with python-xlib documentation somewhat lacking, I found no way to do this, and I haven't found any examples of using python-xlib with the composite extension. Where can I find this information, and has anyone used python-xlib with composite?
I suppose I could always switch to xcb which seems to support composite for python, but I'd prefer not having to rewrite the whole thing and figure out a different API with somewhat lacking python documentation.
To summarize, my questions are:
Is there a way to use composite with python-xlib?
Would it be a better idea to switch to xcb for this?
Any additional suggestions and advice are welcome.
Yes, there is support for Composite extension in python-xlib. Take a look at extension client implementation You'll probably need composite_redirect_window and composite_name_window_pixmap
Actually working on a project in python with PyQT, we choose to create widgets that were "unpleasant" or that didn't have a good enough behaviour.
So, we finally found that QToolbox, QDate and some others had a behaviour non acceptable for the project, so we had to adapt these.
We had also to create a complete new widget : A scheduler.
As we were creating these, it has been decided that it took too much time. So we were asked to think about other libraries.
I actually found a project of a scheduler in wxPython, that actually looks like what we want ( but we believe that we'll have to adapt it a lot ). Here it is : http://code.google.com/p/wxscheduler/
So, I ask everyone that have some more experience than me in GUI programming in python : Do we need to start again the project in anything other than PyQT? I know the question is weird, but what you need to know is :
The project has now been going on for 2 months
I know only PyQT, and started working in python 2 month ago
We are currently 3 in the project, and we currently know only PyQT
We have currently managed a lot of the PyQT widgets, and were starting to code these new widgets.
Please help us =)
Thanks
Edit : I should have add that the project is opensource and multi-platform
Feel free to look at other libraries if you like. Robin Dunn, the creator of wxPython, recently started working on PySide and he found it somewhat similar to wx, so you might find that wxPython will fit your brain fairly well too. I certainly think wx's class names are more intuitive than PyQt's. The only way to know for certain is to actually experiment a little and see if it works. I will say that the wxPython community is one of the best Python communities I've dealt with over the years.
One possibility would be to use an HTML scheduler control via QtWebKit. If your UI can accommodate a QWebView in the place where you'd otherwise have a custom scheduler widget, there are probably a number of excellent scheduler widgets (implemented as jQuery plugins, etc.) you could choose from.
we choose to create widgets that were "unpleasant" or that didn't have
a good enough behaviour.
Why don't you create "pleasant" widgets ?
so we had to adapt these.
Yes. It is the solution.
it has been decided that it took too much time
Don't you think it would take much more time if you change the whole GUI API ?
As for i know, there is not such native Scheduler in any Python GUI library, especially one you could use with Qt. I don't think it would be so long to recreate one, unless you have very specific needs, that would confirm you wouldn't find a such existing thing in an existing library.
Concerning wxScheduler, i guess you can have a look to the code, even it uses wxWidget and you're working with Qt, to get an idea how to do it.
I've seen most of the questions on this topic but almost all of them are outdated. (This is not a dupe)
My requirement is a preferably light weight library for simply playing audio files such as mp3,etc from Python (2.7)
These are the libraries that I've so far looked into and I'm listing what are the things that are stopping me from using each of them:
PyMedia: it was last updated in Feb, 2006
Mp3Play: supports only XP and was last updated in 2008.
I've also tried Pyglet but even this doesn't look good.
Also heard that wx has support for mp3 and I'm trying it. Any comments about the same?
Which reliable lightweight library do others use these days?
PS: please post one library only per answer
I'm not sure what your issue is with pyglet. Playing an mp3 using that couldn't be simpler:
import pyglet
sound = pyglet.media.load('mysound.mp3', streaming=False)
sound.play()
pyglet.app.run()
pyglet is well-maintained, cross-platform, and very small for a multimedia library.
I know this is late but anyway...
Try just_playback. It's a wrapper around miniaudio that can read multiple file formats including mp3 and provides playback control functionality like pausing, resuming, seeking and setting the playback volume.
I started coding an RPG engine in python and I want it to be very scripted(buffs, events). I am experimenting with events and hooking. I would appreciate if you could tell me some matured opensource projects(so i can inspect the code) to learn from. Not necessarily python, but it would be ideal.
Thanks in advance.
As Daenyth suggested, pygame is a great place to start. There are plenty of projects linked to on their page.
The other library that is quite lovely for this type of thing is Panda3D. Though I haven't yet used it, the library comes with samples, and it looks like there is a list of projects using it somewhere.
Have fun.
You might have a look at pygame, it's pretty common for this sort of thing.