forked from hcmlab/vadnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vad.pipeline
120 lines (105 loc) · 3.93 KB
/
vad.pipeline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0" ?>
<pipeline ssi-v="1">
<register>
<load name="graphic" />
<load name="audio" depend="ssidialog.dll"/>
<load name="ioput"/>
<load name="signal"/>
<load name="python"/>
<load name="control"/>
</register>
<!-- live -->
<gate open="$(audio:live)">
<gate open="$(audio:live:mic)">
<sensor create="Audio" option="options\microphone" sr="48000" scale="true" blockInSamples="512">
<output channel="audio" pin="audio"/>
</sensor>
</gate>
<gate close="$(audio:live:mic)">
<sensor create="AudioLoopBack" option="options\loopback" scale="true">
<output channel="audio" pin="audio">
<transformer create="Selector" indices="0"/>
</output>
</sensor>
</gate>
</gate>
<!-- file -->
<gate close="$(audio:live)">
<sensor create="WavReader:reader" path="data\speech.wav" loop="true">
<output channel="audio" pin="speech_raw" size="2.0s"/>
</sensor>
<sensor create="WavReader:reader" path="data\noise.wav" loop="true">
<output channel="audio" pin="noise_raw" size="2.0s"/>
</sensor>
<!-- volume -->
<transformer create="Multiply:speech" factor="0.0">
<input pin="speech_raw" frame="4800"/>
<output pin="speech"/>
</transformer>
<transformer create="Multiply:noise" factor="0.0">
<input pin="noise_raw" frame="4800"/>
<output pin="noise"/>
</transformer>
<!-- mixer -->
<transformer create="STKAudioMixer:mixer">
<input pin="speech;noise" frame="4800"/>
<output pin="audio"/>
</transformer>
<!-- slider -->
<runnable create="ControlSlider:slider" title="SPEECH" id="speech" name="factor" defval="0.0" minval="0.0" maxval="1.0"/>
<runnable create="ControlSlider:slider" title="NOISE" id="noise" name="factor" defval="0.0" minval="0.0" maxval="0.25"/>
</gate>
<!-- vad -->
<transformer create="PythonFeature" script="model" syspath="." optsstr="path=$(model:path)">
<input pin="audio" frame="8000" delta="40000"/>
<output pin="vad_raw"/>
</transformer>
<transformer create="MvgAvgVar" format="1" method="2" win="3.0">
<input pin="vad_raw" frame="1"/>
<output pin="vad"/>
</transformer>
<!-- event sender -->
<gate open="$(send:do)">
<consumer create="XMLEventSender:monitor" address="vad@xml" path="vad.xml" monitor="true" mname="XML" console="false" update="100" coldelim=" ">
<input pin="vad" frame="1"/>
</consumer>
<object create="SocketEventWriter" url="$(send:url)" xml="false">
<listen address="vad@xml"/>
</object>
</gate>
<!-- visualization -->
<consumer create="SignalPainter:plot" title="AUDIO" size="10" type="2">
<input pin="audio" frame="0.2s" delta="0"/>
</consumer>
<consumer create="SignalPainter:plot" title="VAD" type="5" autoscale="false" fix="1,1" barNames="NOISE,VOICE">
<input pin="vad" frame="1" />
</consumer>
<!-- player -->
<gate close="$(audio:live)">
<consumer create="AudioPlayer" option="options\aplayer">
<input pin="audio" frame="0.1s"/>
</consumer>
</gate>
<!-- record -->
<gate open="$(record:do)">
<register>
<load name="camera"/>
</register>
<sensor create="CameraScreen" resize="true" sr="25" region="400,0,800,600" mouse="true" flip="false">
<output channel="video" pin="camera" size="2.0s"/>
</sensor>
<consumer create="CameraWriter" option="options\camscreenwriter" overwrite="true" path="$(record:path).avi">
<input pin="camera" frame="1" delta="0"/>
</consumer>
<consumer create="WavWriter" option="options\wavscreenwriter" overwrite="true" path="$(record:path).wav">
<input pin="audio" frame="0.04s" delta="0"/>
</consumer>
</gate>
<!-- decoration -->
<object create="Decorator" icon="true" title="Pipeline">
<area pos="0,0,400,600">console</area>
<area pos="400,0,400,600">plot*</area>
<area pos="800,0,400,200" nh="1">slider*</area>
<area pos="800,300,400,300">monitor</area>
</object>
</pipeline>