[PD] pyext~

patrick puredata at 11h11.com
Sat Oct 13 19:56:51 CEST 2007


hi,

what about using gstreamer via pyext. here's a simple "playbin" that 
auto-detect and connect to oss, alsa, jack for playing mp3 file over http.

WITH JACK:
when clicking on [playpreview], pd disconnect and disappear from the 
client list. GStreamer got in and play the mp3 file. i tried [detach 
0-1-2] with no success. anyone knows how to keep pd while GStreamer play 
the mp3 file?

WITH ALSA:
since alsa can have only 1 client - GStreamer is not able to play the 
mp3 if compute audio is on. but it's working when turning compute audio 
off and clicking [playpreview] again.


try:
    import pyext
except:
    print "ERROR: This script must be loaded by the PD/Max pyext external"

try:
    import pygst
    pygst.require("0.10")
    import gst
except:
    print "ERROR: You need pygst (gstreamer)"

class preview(pyext._class):
    # number of inlets and outlets
    _inlets=1
    _outlets=0


    def playpreview_1(self,a):
            print("Playing preview")
           
            player = gst.element_factory_make("playbin", "player")
            player.set_property('uri', 
"http://freesound.iua.upf.edu/data/40/previews/40563__genghis_attenborough__Sedge_Warbler_call_preview.mp3")
            player.set_state(gst.STATE_PLAYING)
           




More information about the Pd-list mailing list