@digipair/skill-web-voice-activity-detection 0.58.10 → 0.58.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +17 -2
- package/index.esm.js +22 -8
- package/package.json +1 -1
- package/src/lib/skill-web-voice-activity-detection.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var engine = require('@digipair/engine');
|
|
6
|
-
require('https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/bundle.min.js');
|
|
7
6
|
|
|
8
7
|
function _extends() {
|
|
9
8
|
_extends = Object.assign || function assign(target) {
|
|
@@ -16,7 +15,16 @@ function _extends() {
|
|
|
16
15
|
return _extends.apply(this, arguments);
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
// add a script tag to the document
|
|
19
|
+
async function addScript(src) {
|
|
20
|
+
const script = document.createElement('script');
|
|
21
|
+
script.src = src;
|
|
22
|
+
script.async = false;
|
|
23
|
+
document.body.appendChild(script);
|
|
24
|
+
return new Promise((resolve)=>{
|
|
25
|
+
script.onload = resolve;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
20
28
|
let VADService = class VADService {
|
|
21
29
|
async listen(params, _pinsSettingsList, context) {
|
|
22
30
|
const { stream = await navigator.mediaDevices.getUserMedia({
|
|
@@ -27,6 +35,13 @@ let VADService = class VADService {
|
|
|
27
35
|
noiseSuppression: true
|
|
28
36
|
}
|
|
29
37
|
}), onFrameProcessed = [], onVADMisfire = [], onSpeechStart = [], onSpeechEnd = [], model = 'legacy', additionalAudioConstraints = {}, baseAssetPath = 'https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/', onnxWASMBasePath = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.18.0/dist/', submitUserSpeechOnPause = false, positiveSpeechThreshold = 0.5, negativeSpeechThreshold = 0.35, preSpeechPadFrames = 1, redemptionFrames = 8, frameSamples = 1536, minSpeechFrames = 3 } = params;
|
|
38
|
+
if (!document.querySelector(`script[src="${onnxWASMBasePath}ort.js"]`)) {
|
|
39
|
+
await addScript(`${onnxWASMBasePath}ort.js`);
|
|
40
|
+
}
|
|
41
|
+
if (!document.querySelector(`script[src="${baseAssetPath}bundle.min.js"]`)) {
|
|
42
|
+
await addScript(`${baseAssetPath}bundle.min.js`);
|
|
43
|
+
}
|
|
44
|
+
const { MicVAD, utils } = window['vad'];
|
|
30
45
|
const vad = await MicVAD.new({
|
|
31
46
|
stream,
|
|
32
47
|
onFrameProcessed: (probabilities, frame)=>{
|
package/index.esm.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import 'https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/bundle.min.js';
|
|
2
|
-
|
|
3
1
|
function _extends() {
|
|
4
2
|
_extends = Object.assign || function assign(target) {
|
|
5
3
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -23901,14 +23899,14 @@ function indent(str, spaces) {
|
|
|
23901
23899
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23902
23900
|
// match is required
|
|
23903
23901
|
if (!match) {
|
|
23904
|
-
return
|
|
23902
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
23905
23903
|
v: nextMatch1
|
|
23906
23904
|
};
|
|
23907
23905
|
}
|
|
23908
23906
|
var token = match.token, offset = match.offset;
|
|
23909
23907
|
i1 += offset;
|
|
23910
23908
|
if (token === " ") {
|
|
23911
|
-
return
|
|
23909
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
23912
23910
|
}
|
|
23913
23911
|
tokens1 = _to_consumable_array$1(tokens1).concat([
|
|
23914
23912
|
token
|
|
@@ -23927,7 +23925,7 @@ function indent(str, spaces) {
|
|
|
23927
23925
|
if (contextKeys.some(function(el) {
|
|
23928
23926
|
return el.startsWith(name);
|
|
23929
23927
|
})) {
|
|
23930
|
-
return
|
|
23928
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
23931
23929
|
}
|
|
23932
23930
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23933
23931
|
return el === name;
|
|
@@ -23946,9 +23944,9 @@ function indent(str, spaces) {
|
|
|
23946
23944
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23947
23945
|
return el.startsWith(name);
|
|
23948
23946
|
})) {
|
|
23949
|
-
return
|
|
23947
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
23950
23948
|
}
|
|
23951
|
-
return
|
|
23949
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
23952
23950
|
v: nextMatch1
|
|
23953
23951
|
};
|
|
23954
23952
|
};
|
|
@@ -27955,7 +27953,16 @@ const preparePinsSettings = async (settings, context)=>{
|
|
|
27955
27953
|
});
|
|
27956
27954
|
};
|
|
27957
27955
|
|
|
27958
|
-
|
|
27956
|
+
// add a script tag to the document
|
|
27957
|
+
async function addScript(src) {
|
|
27958
|
+
const script = document.createElement('script');
|
|
27959
|
+
script.src = src;
|
|
27960
|
+
script.async = false;
|
|
27961
|
+
document.body.appendChild(script);
|
|
27962
|
+
return new Promise((resolve)=>{
|
|
27963
|
+
script.onload = resolve;
|
|
27964
|
+
});
|
|
27965
|
+
}
|
|
27959
27966
|
let VADService = class VADService {
|
|
27960
27967
|
async listen(params, _pinsSettingsList, context) {
|
|
27961
27968
|
const { stream = await navigator.mediaDevices.getUserMedia({
|
|
@@ -27966,6 +27973,13 @@ let VADService = class VADService {
|
|
|
27966
27973
|
noiseSuppression: true
|
|
27967
27974
|
}
|
|
27968
27975
|
}), onFrameProcessed = [], onVADMisfire = [], onSpeechStart = [], onSpeechEnd = [], model = 'legacy', additionalAudioConstraints = {}, baseAssetPath = 'https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/', onnxWASMBasePath = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.18.0/dist/', submitUserSpeechOnPause = false, positiveSpeechThreshold = 0.5, negativeSpeechThreshold = 0.35, preSpeechPadFrames = 1, redemptionFrames = 8, frameSamples = 1536, minSpeechFrames = 3 } = params;
|
|
27976
|
+
if (!document.querySelector(`script[src="${onnxWASMBasePath}ort.js"]`)) {
|
|
27977
|
+
await addScript(`${onnxWASMBasePath}ort.js`);
|
|
27978
|
+
}
|
|
27979
|
+
if (!document.querySelector(`script[src="${baseAssetPath}bundle.min.js"]`)) {
|
|
27980
|
+
await addScript(`${baseAssetPath}bundle.min.js`);
|
|
27981
|
+
}
|
|
27982
|
+
const { MicVAD, utils } = window['vad'];
|
|
27969
27983
|
const vad = await MicVAD.new({
|
|
27970
27984
|
stream,
|
|
27971
27985
|
onFrameProcessed: (probabilities, frame)=>{
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PinsSettings } from '@digipair/engine';
|
|
2
|
-
import 'https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.22/dist/bundle.min.js';
|
|
3
2
|
export declare const listen: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
4
3
|
export declare const start: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|
|
5
4
|
export declare const pause: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
|