python: update python examples to modern python, Gst, and Glib versions
[experiments/gstreamer.git] / shell / gst-vocoder.sh
1 #!/bin/sh
2
3 FORMANT="autoaudiosrc"
4
5 # Connect your hardware MIDI device, or launch a virtual MIDI device like
6 # this:
7 #
8 #   $ xset -r && vkeybd; xset r on
9 #
10 # Find out the port of the input MIDI device:
11 #
12 #   $ aconnect -l
13 #   ...
14 #   client 128: 'Virtual Keyboard' [type=user,pid=25939]
15 #       0 'Virtual Keyboard'
16 #
17 # and have a lot of fun vocoding the crap out of your formant channel.
18 CARRIER_TONE="alsamidisrc ports=128:0 ! fluiddec synth-gain=1 ! audioconvert"
19
20 # Add some white noise to the carrier
21 CARRIER_PARAMS="$CARRIER_TONE ! carrier. audiotestsrc wave=5 volume=0.1 ! carrier."
22 CARRIER="adder name=carrier"
23
24 SINK="autoaudiosink"
25 #SINK="wavenc ! filesink location=audio-vocoder-test.wav"
26
27 # Using vocoder_1337.so, in Debian it's available in the swh-plugins package.
28 gst-launch-1.0 -v interleave name=i ! \
29   capssetter caps="audio/x-raw,channels=2,channel-mask=(bitmask)0x3" ! audioconvert ! audioresample ! \
30   ladspa-vocoder-1337-so-vocoder \
31     number-of-bands=16 \
32     left-right=0 \
33     band-1-level=1 \
34     band-2-level=1 \
35     band-3-level=1 \
36     band-4-level=1 \
37     band-5-level=1 \
38     band-6-level=1 \
39     band-7-level=1 \
40     band-8-level=1 \
41     band-9-level=1 \
42     band-10-level=1 \
43     band-11-level=1 \
44     band-12-level=1 \
45     band-13-level=1 \
46     band-14-level=1 \
47     band-15-level=1 \
48     band-16-level=1 \
49   ! $SINK \
50   $FORMANT ! audioconvert ! audioresample ! audio/x-raw, rate=44100, format=S16LE, channels=1 ! queue ! i.sink_0 \
51   $CARRIER ! audioconvert ! audioresample ! audio/x-raw, rate=44100, format=S16LE, channels=1 ! queue ! i.sink_1 \
52   $CARRIER_PARAMS