-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathspeech-to-text.html
132 lines (120 loc) · 4.82 KB
/
speech-to-text.html
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
121
122
123
124
125
126
127
128
129
130
131
132
<!--
Copyright 2019 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/html" data-template-name="google-cloud-speech-to-text">
<!--Name-->
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
<!--Credentials-->
<div class="form-row">
<label for="node-input-account"><i class="fa fa-user"></i> Credentials</label>
<input type="text" id="node-input-account">
</div>
<!--Key File-->
<div class="form-row">
<label for="node-input-keyFilename"><i class="fa fa-user"></i> Key File</label>
<input type="text" id="node-input-keyFilename">
</div>
<!--Language-->
<div class="form-row">
<label for="node-input-languageCode"><i class="fa fa-language"></i> Language</label>
<input type="text" id="node-input-languageCode">
</div>
<!--Sample Rate-->
<div class="form-row">
<label for="node-input-sampleRate"><i class="fa fa-gear"></i> Sample Rate</label>
<input type="number" min="0" step="1000" id="node-input-sampleRate">
</div>
<!--Encoding-->
<div class="form-row">
<label for="node-input-encoding"><i class="fa fa-gear"></i> Encoding</label>
<select type="text" id="node-input-encoding">
<option value="LINEAR16">LINEAR16</option>
<option value="FLAC">FLAC</option>
<option value="MULAW">MULAW</option>
<option value="AMR">AMR</option>
<option value="AMR_WB">AMR_WB</option>
<option value="OGG_OPUS">OGG_OPUS</option>
<option value="MP3">MP3</option>
</select>
</div>
</script>
<script type="text/html" data-help-name="google-cloud-speech-to-text">
<p>
Convert audio speech to text.
</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg.payload
<span class="property-type">Buffer</span>
</dt>
<dd>Audio data to be parsed.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>msg.payload
<span class="property-type">RecognizeResponse</span>
</dt>
<dd>Recognized text from the audio.</dd>
</dl>
<h3>Details</h3>
<p>
The speech to text node accepts a Buffer of data representing a fragment of audio. This is supplied in msg.payload. When the node executes,
the audio is parsed through a speech recognition algorithm and the corresponding text representation is returned in the new msg.payload value.
The structure of the response is defined by the GCP Speech to Text API and is an instance of a
<a href="https://googleapis.dev/nodejs/speech/latest/google.cloud.speech.v1p1beta1.html#.RecognizeResponse">RecognizeResponse</a> object.
</p>
<p>
Processing an audio fragment takes time. A status visualization is associated with the node which is visible when the node is processing audio.
</p>
<p>
The node has configuration options including:
<ul>
<li>Language Code - The language code to be used for processing. The set of allowed codes can be found <a href="https://cloud.google.com/speech-to-text/docs/languages">here</a>. The default is en-US.</li>
<li>Sample Rate - The sampling rate of the audio input.</li>
<li>Encoding - One of:
<ul>
<li>LINEAR16</li>
<li>FLAC</li>
<li>MULAW</li>
<li>AMR</li>
<li>AMR_WB</li>
<li>OGG_OPUS</li>
<li>MP3</li>
</ul>
<ul>
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType("google-cloud-speech-to-text", {
category: "GCP",
defaults: {
account: { type: "google-cloud-credentials", required: false },
keyFilename: {value: "", required: false },
name: { value: "", required: false },
sampleRate: { value: 16000, required: false},
encoding: { value: "LINEAR16", required: false},
languageCode: { value: "en-US", required: false}
},
inputs: 1,
outputs: 1,
icon: "speech-to-text.png",
align: "left",
color: "#3FADB5",
label: function () {
return this.name || "Speech To Text";
},
paletteLabel: "Speech To Text"
});
</script>