-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule-config.gen.js
166 lines (164 loc) · 5.5 KB
/
module-config.gen.js
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*********************************************************************
* This file is automatically generated by mmir-plugins-export tools *
* Do not modify: ANY CHANGES WILL GET DISCARDED *
*********************************************************************/
module.exports = {
pluginName: ["silenceDetector","webAudioInput"],
plugins: {
silenceDetector: {
pluginName: "silenceDetector",
config: [
/**
* @type integer
* @default 15
*/
"resetCount",
/**
* @type integer
* @default 3
*/
"pauseCount",
/**
* @type float from interval [0, 1]
* @default 0.1
*/
"noiseTreshold"
],
defaultValues: {
resetCount: 15,
pauseCount: 3,
noiseTreshold: 0.1
}
},
webAudioInput: {
pluginName: "webAudioInput",
config: [
/**
* custom encoder parameters (depends on encoder)
*/
"encoderParams",
/**
* size (~ number of audio chunks) for repeat-buffer:
*
* during encoding last n chunks get buffered, and on silence (~> end-of-speech)
* get prepended to the new audio data
* (in order to prepend audio that is really the next speech utterance but was
* still attached to the previous audio due to delay in end-of-speech detection
* )
*
* @default 3
*/
"repeatBufferSize",
/**
* whether or not request _noise supression_ when capturing/recording audio from microphone
*
* NOTE: may not be supported by environment
*
* @type boolean
* @default true
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSupportedConstraints/noiseSuppression
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/noiseSuppression
*/
"noiseSuppression",
/**
* whether or not request _echo cancellation_ when capturing/recording audio from microphone
*
* NOTE: may not be supported by environment
*
* @type boolean
* @default false
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSupportedConstraints/echoCancellation
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/echoCancellation
*/
"echoCancellation",
/**
* whether or not request _automatic gain (input volume) control_ when capturing/recording audio from microphone
*
* NOTE: may not be supported by environment
*
* @type boolean
* @default true
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSupportedConstraints/autoGainControl
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/autoGainControl
*/
"autoGainControl",
/**
* preferred sample rate for capturing/recording audio from microphone
*
* NOTE: may not be supported by environment
*
* @type number
* @default 44100
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSupportedConstraints/sampleRate
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/sampleRate
*/
"sampleRate",
/**
* preferred number of channels for capturing/recording audio from microphone
*
* NOTE: may not be supported by environment for capturing the audio,
* but internal recording/encoding will use this setting
*
* WARNING: currently, only recording/encoding for 1 channel is supported
* (since most speech recognition services require 1 channel/mono audio)
*
* @type number
* @default 1
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSupportedConstraints/channelCount
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/channelCount
*/
"channelCount"
],
defaultValues: {
encoderParams: null,
repeatBufferSize: 3,
noiseSuppression: true,
echoCancellation: false,
autoGainControl: true,
sampleRate: 44100,
channelCount: 1
}
}
},
buildConfigs: [
function(pluginConfig, _runtimeConfig, _pluginBuildConfigs) {
if(pluginConfig && pluginConfig.encoder){
var enc = pluginConfig.encoder;
if(enc === 'wav'){
return {
includeModules: ['mmir-plugin-encoder-core/workers/wavEncoder']
}
}
if(enc === 'amr' || enc === 'flac' || enc === 'opus' || enc === 'speex'){
return {
includePlugins: [{id: 'mmir-plugin-encoder-'+enc}]
}
}
}
}
],
/**
* Known encoders:
* can be specified via plugin-configuration
*
* @exmaple
* <pluginName>: {
* "encoder": "flac",
* ....
* }
*
* TODO extract this from implementation www/webAudioInput.js::_workerImpl
*/
defaultEncoders: {
wav: "mmir-plugin-encoder-core/workers/wavEncoder",
speex: "mmir-plugin-encoder-speex",
opus: "mmir-plugin-encoder-opus",
flac: "mmir-plugin-encoder-flac",
amr: "mmir-plugin-encoder-amr"
}
};