Does anyone know an alternative to ALSA that can be used on windows, with gstreamer, and how to install it, and w开发者_JAVA技巧here to find python bindings for it if it needs it? thanks xxx
SDL does a decent job of abstracting sound interfaces in a platform-independent way. PyGame contains an interface to SDL and works on many platforms. Such abstraction, of course, sets many limitations, but maybe it will still do for you.
Converted from a comment.
not sure if this is still relevant, but I had the exact same problem today. I got around it by using "autoaudiosink".
That way I got the minimal example on the following website to work in Windows XP
http://www.jonobacon.org/2006/08/28/getting-started-with-gstreamer-with-python/
Here is my version of the code (essentially the same except for the alsasink)
#!/usr/bin/python
import pygst
pygst.require("0.10")
import gst
import pygtk
import gtk
class Main:
def __init__(self):
self.pipeline = gst.Pipeline("mypipeline")
self.audiotestsrc = gst.element_factory_make("audiotestsrc", "audio")
self.pipeline.add(self.audiotestsrc)
self.sink = gst.element_factory_make("autoaudiosink", "sink")
self.pipeline.add(self.sink)
self.audiotestsrc.link(self.sink)
self.pipeline.set_state(gst.STATE_PLAYING)
start=Main()
gtk.main()
I hope that helps.
It seems that on Windows the SDK installer doesn't actually install the bindings to any location visible to the Python interpreter. You can find the files at sdk\bindings\python\v2.6\lib\site-packages
. Copy the contents of the directory to your Python installation's site-packages
, and you should be able to import the library.
9000's answer, sdl, and autoaudiosrc/sink are the answer :)
精彩评论