[gst-devel] Python, sound recording, pull buffer

Jan Martinek honza at dp.fce.vutbr.cz
Fri Jul 31 12:45:54 CEST 2009


Hello,

I am trying to record sound and store the data into a string. The 
documentation recommends using appsink for this purpose, which can 
trigger an event when the buffer is full. So far it works fine.

But how do I access the buffer? What is the method to read the data? 
There is no such method as pull_buffer().

Thank you
Jan Martinek

#!/usr/bin/env python

import gst, gtk


class Sound:
     def __init__(self):
         self.pipeline = gst.parse_launch('gconfaudiosrc ! capsfilter 
caps=audio/x-raw-int,rate=44100,channels=1,depth=16 ! appsink name=sink 
emit-signals=true')
         self.sink = self.pipeline.get_by_name('sink')
         self.sink.connect('new-buffer', self.nextbuffer)
         self.pipeline.set_state(gst.STATE_PLAYING)
         gtk.main()

     def nextbuffer(self, buff):
         print 'New data is here - but how to read it?'




More information about the gstreamer-devel mailing list