GStreamer Level Plugin Monitoring

So you have an audio stream where you'd like to get a human-friendly readout of the current audio level. You add a level component, but how do you actually get the level messages it generates?

            bus.add_signal_watch()
            bus.connect( 'message', self.on_level )

It really seems that you *should* be able to use element.connect(), but there doesn't seem to be an available event to which to connect on the level. So, you wind up having to process all of the events and look for your level event...

    def on_level( self, bus, message ):
        """Level message was received"""
        if message.src == self.monitor and message.type==gst.MESSAGE_ELEMENT:
            self.send( {
                'type':'level',
                'level': message.structure['rms'][0],
            })

Next problem, the "level" is not particularly human friendly. It appears to be a decibel attenuation (from 0 negative), where e.g. -17 seems to be a pretty loud voice and ~-40 is background noise... but that's just what *my* setup produces. Still trying to figure out if there's a formal "what pocketsphinx wants for dictation" definition somewhere. The "vader" element has a value of 0.0078125 as the default for volume cut-off, but no idea what that means.

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.