I have two terminals open on my ubuntu machine. The idea is to speak into the microphone and then play it back over the speaker. On the first terminal I set up a gstreamer speaker with the command:
gst-launch-0.10 pulsesrc ! audioconvert ! audio/x-raw-int,channels=1,depth=16,width=16,rate=22000 ! rtpL16pay ! udpsink host=localhost port=5000
the listener on the other terminal i use this command
gst-launch-0.10 -v udpsrc port=5000 ! "application/x-rtp,media=(string)audio, clock-rate=(int)22000, width=16, height=16, encoding-name=(string)L16, encoding-params=(string)1, channels=(int)1, channel-positions=(int)1, payload=(int)96" ! rtpL16depay ! audioconvert ! alsasink sync=false
What i want to now do is start the code, and automatically stop the stream when there is no sound for about 2 second. How should i go about doing this?