Reply
Thread Tools
Posts: 52 | Thanked: 41 times | Joined on Sep 2010
#1
Hello! Im looking for code that enable me to recieve sound output level od the phone. Main purpose is to build visualisation app in maemo. You can read about my problem here - http://talk.maemo.org/showthread.php?t=63124 Since then I managed to wrote some code which is working, but its not too smooth:
Code:
#!/usr/bin/python

import pygst
pygst.require("0.10")
import gst
import os
import pygtk
import gtk
import audioop

class Main:
	def __init__(self):
		self.pipeline = gst.Pipeline("mypipeline")
		self.audiotestsrc = gst.element_factory_make("alsasrc")
		self.pipeline.add(self.audiotestsrc)
		self.sink = gst.element_factory_make("appsink", "sink")
                self.sink.set_property('caps', gst.Caps('audio/x-raw-int, width=16, depth=16, signed=true'))
                self.sink.set_property('drop', False)
                self.sink.set_property('max-buffers', 5)
                self.sink.set_property('sync', False)
                self.pipeline.add(self.sink)
                print('starting...')
		self.audiotestsrc.link(self.sink)
		self.pipeline.set_state(gst.STATE_PLAYING)
                for i in range(1, 999999):
                    pipa = abs(audioop.avg(self.sink.emit('pull-buffer'), 2))
                    print(pipa*'x')
start=Main()
gtk.main()
I didnt managed to get self.sink.connect('new-buffer', self._new_buffer) working.
How can I create an infinite loop which could provide me that information?
How to get this done in more smooth way? I need decimal representation of sound level.
What is the name of input to the gstreamer pipeline which contains not only microphone input, but all mixer devices (such as music playing in other apps)
I have lack of knowledge in python programming, please help. If I manage to get this done I will try to make some OpenGL visualisations for Maemo, and I will share them with you.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 12:18.