[Python] Recording with valve in my gstreamer pipeline

Discussão em 'Python' iniciado por Stack, Fevereiro 5, 2025.

  1. Stack

    Stack Membro Participativo

    I have a problem with the valve in my pipeline :

    self.pipeline = gst.parse_launch(' ! '.join(['autoaudiosrc',
    'queue silent=false leaky=2 max-size-buffers=0 max-size-time=0 max-size-bytes=0',
    'audioconvert',
    'audioresample',
    'audio/x-raw-int, rate=16000, width=16, depth=16, channels=1',
    'tee name=t',
    'queue',
    'audioresample',
    'audio/x-raw-int, rate=8000',
    'vader name=vader auto-threshold=true',
    'pocketsphinx lm=%s dict=%s name=listener' % (dir_path + '/pocketsphinx/lisa.lm',dir_path + '/pocketsphinx/lisa.dic'),
    'fakesink dump=1 t.',
    'valve name=valve drop=0',
    'queue',
    'flacenc',
    'filesink async=0 location=' + self.recording]))


    I know it's not the best pythonic way to create the pipeline, but it's the most readable.

    Setting it to 0 record the mic flow in my file and everything is okay. But I want to drop it by default, and open the valve on the fly depending an event (listen a keyword with pocketsphinx), then close this valve again. But it don't seems to work : my file remains at 0 bytes.

    Once pocketsphinx listen the keyword, I enable the valve with :

    self.recording_valve.set_property('drop',False)


    I tried to give a very very short example of the problem. Maybe it's not located in this part but that's where my debug lead me.

    To view the entire project : https://github.com/Seraf/LISA-CLIENT-Linux/blob/pocketsphinx/lisa.tac

    that call this class : https://github.com/Seraf/LISA-CLIENT-Linux/blob/pocketsphinx/lib/listener.py

    that call this class : github /Seraf/LISA-CLIENT-Linux/blob/pocketsphinx/lib/recorder.py

    Thanks for your help !

    Continue reading...

Compartilhe esta Página