From b5108c364900bdf5b036010574f40e68a76fa16a Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Tue, 28 Aug 2018 17:41:20 +0200 Subject: [PATCH] Add gst-spectrascope-test.sh Add an example of how to display audio spectrograms. --- shell/gst-spectrascope-test.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 shell/gst-spectrascope-test.sh diff --git a/shell/gst-spectrascope-test.sh b/shell/gst-spectrascope-test.sh new file mode 100755 index 0000000..a1b6a52 --- /dev/null +++ b/shell/gst-spectrascope-test.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +set -e + +# Monitor the default sink +DEFAULT_OUTPUT_MONITOR="$(pacmd stat | grep "Default sink" | cut -d ':' -f 2 | tail -c+2).monitor" + +# Take the most recent source as the microphone (in my case it's a USB +# microphone I plugged in after pulseaudio started). +MICROPHONE=$(pactl list short sources | tail -1 | cut -f 2) + +set -x +gst-launch-1.0 -v -e \ + compositor name=mix sink_1::xpos=256 sink_2::ypos=256 \ + ! 'video/x-raw, width=512, height=512, framerate=(fraction)30/1' \ + ! videoconvert \ + ! autovideosink \ + pulsesrc device="$DEFAULT_OUTPUT_MONITOR" \ + ! deinterleave name=deint \ + deint. \ + ! audioconvert \ + ! spectrascope \ + ! 'video/x-raw, width=256, height=256, framerate=(fraction)30/1' \ + ! textoverlay valignment=center font-desc='Sans, 50' text='Left speaker' \ + ! queue \ + ! mix. \ + deint. \ + ! audioconvert \ + ! spectrascope \ + ! 'video/x-raw, width=256, height=256, framerate=(fraction)30/1' \ + ! textoverlay valignment=center font-desc='Sans, 50' text='Right speaker' \ + ! queue \ + ! mix. \ + pulsesrc device="$MICROPHONE" \ + ! audioconvert \ + ! spectrascope \ + ! 'video/x-raw, width=512, height=256, framerate=(fraction)30/1' \ + ! textoverlay valignment=center font-desc='Sans, 50' text='Microphone' \ + ! queue \ + ! mix. -- 2.1.4