react-native-nitro-onnx 0.1.0
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/NOTICE +241 -0
- package/NitroOnnxSpeech.podspec +51 -0
- package/Package.swift +52 -0
- package/README.md +398 -0
- package/android/CMakeLists.txt +117 -0
- package/android/build.gradle +65 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/assets/silero_vad.onnx +0 -0
- package/android/src/main/cpp/cpp-adapter.cpp +24 -0
- package/android/src/main/java/com/margelo/nitro/onnx/speech/OnnxSpeechPackage.kt +67 -0
- package/assets/silero_vad.onnx +0 -0
- package/cpp/AndroidPthreadCompat.cpp +16 -0
- package/cpp/AsrEngine.cpp +277 -0
- package/cpp/AsrEngine.hpp +110 -0
- package/cpp/AudioFileReader.cpp +177 -0
- package/cpp/AudioFileReader.hpp +26 -0
- package/cpp/AudioUtils.cpp +28 -0
- package/cpp/AudioUtils.hpp +38 -0
- package/cpp/ModelSingleton.hpp +51 -0
- package/cpp/NitroOnnxSpeech.cpp +68 -0
- package/cpp/NitroOnnxSpeech.hpp +42 -0
- package/cpp/OfflineAsr.cpp +81 -0
- package/cpp/OfflineAsr.hpp +33 -0
- package/cpp/ResourceDir.cpp +29 -0
- package/cpp/ResourceDir.hpp +18 -0
- package/cpp/SpeakerEngine.cpp +170 -0
- package/cpp/SpeakerEngine.hpp +70 -0
- package/cpp/SpeakerManager.cpp +93 -0
- package/cpp/SpeakerManager.hpp +43 -0
- package/cpp/StreamingAsr.cpp +123 -0
- package/cpp/StreamingAsr.hpp +55 -0
- package/cpp/ThreadPool.cpp +41 -0
- package/cpp/ThreadPool.hpp +62 -0
- package/cpp/Tts.cpp +132 -0
- package/cpp/Tts.hpp +38 -0
- package/cpp/TtsEngine.cpp +222 -0
- package/cpp/TtsEngine.hpp +77 -0
- package/cpp/Vad.cpp +126 -0
- package/cpp/Vad.hpp +62 -0
- package/cpp/VadEngine.cpp +217 -0
- package/cpp/VadEngine.hpp +126 -0
- package/ios/OnnxSpeechInitializer.mm +37 -0
- package/ios/PrivacyInfo.xcprivacy +14 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/specs/OnnxSpeech.nitro.d.ts +264 -0
- package/lib/specs/OnnxSpeech.nitro.d.ts.map +1 -0
- package/lib/specs/OnnxSpeech.nitro.js +6 -0
- package/lib/specs/OnnxSpeech.nitro.js.map +1 -0
- package/nitro.json +19 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroOnnxSpeech+autolinking.cmake +86 -0
- package/nitrogen/generated/android/NitroOnnxSpeech+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroOnnxSpeechOnLoad.cpp +49 -0
- package/nitrogen/generated/android/NitroOnnxSpeechOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/onnx/speech/NitroOnnxSpeechOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NitroOnnxSpeech+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroOnnxSpeech-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/NitroOnnxSpeech-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/NitroOnnxSpeech-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/NitroOnnxSpeechAutolinking.mm +35 -0
- package/nitrogen/generated/ios/NitroOnnxSpeechAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/AsrModelConfig.hpp +142 -0
- package/nitrogen/generated/shared/c++/AsrModelType.hpp +112 -0
- package/nitrogen/generated/shared/c++/AsrResult.hpp +105 -0
- package/nitrogen/generated/shared/c++/HybridOfflineAsrSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridOfflineAsrSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridOnnxSpeechSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridOnnxSpeechSpec.hpp +82 -0
- package/nitrogen/generated/shared/c++/HybridSpeakerManagerSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridSpeakerManagerSpec.hpp +77 -0
- package/nitrogen/generated/shared/c++/HybridStreamingAsrSpec.cpp +32 -0
- package/nitrogen/generated/shared/c++/HybridStreamingAsrSpec.hpp +81 -0
- package/nitrogen/generated/shared/c++/HybridTtsSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridTtsSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridVadSpec.cpp +31 -0
- package/nitrogen/generated/shared/c++/HybridVadSpec.hpp +81 -0
- package/nitrogen/generated/shared/c++/RegisteredSpeaker.hpp +91 -0
- package/nitrogen/generated/shared/c++/SpeakerEmbeddingConfig.hpp +91 -0
- package/nitrogen/generated/shared/c++/TtsModelConfig.hpp +178 -0
- package/nitrogen/generated/shared/c++/TtsModelType.hpp +88 -0
- package/nitrogen/generated/shared/c++/TtsResult.hpp +91 -0
- package/nitrogen/generated/shared/c++/VadConfig.hpp +100 -0
- package/nitrogen/generated/shared/c++/VadSegment.hpp +91 -0
- package/package.json +62 -0
- package/scripts/prepare-sherpa-onnx.js +236 -0
- package/scripts/test-cpp.js +24 -0
- package/src/index.ts +45 -0
- package/src/specs/OnnxSpeech.nitro.ts +326 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AsrResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
#include <optional>
|
|
35
|
+
#include <vector>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::onnx::speech {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (AsrResult).
|
|
41
|
+
*/
|
|
42
|
+
struct AsrResult final {
|
|
43
|
+
public:
|
|
44
|
+
std::string text SWIFT_PRIVATE;
|
|
45
|
+
std::optional<double> score SWIFT_PRIVATE;
|
|
46
|
+
std::optional<double> startMs SWIFT_PRIVATE;
|
|
47
|
+
std::optional<double> endMs SWIFT_PRIVATE;
|
|
48
|
+
std::optional<std::vector<double>> timestamps SWIFT_PRIVATE;
|
|
49
|
+
std::optional<std::string> json SWIFT_PRIVATE;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
AsrResult() = default;
|
|
53
|
+
explicit AsrResult(std::string text, std::optional<double> score, std::optional<double> startMs, std::optional<double> endMs, std::optional<std::vector<double>> timestamps, std::optional<std::string> json): text(text), score(score), startMs(startMs), endMs(endMs), timestamps(timestamps), json(json) {}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
friend bool operator==(const AsrResult& lhs, const AsrResult& rhs) = default;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::onnx::speech
|
|
60
|
+
|
|
61
|
+
namespace margelo::nitro {
|
|
62
|
+
|
|
63
|
+
// C++ AsrResult <> JS AsrResult (object)
|
|
64
|
+
template <>
|
|
65
|
+
struct JSIConverter<margelo::nitro::onnx::speech::AsrResult> final {
|
|
66
|
+
static inline margelo::nitro::onnx::speech::AsrResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
67
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
68
|
+
return margelo::nitro::onnx::speech::AsrResult(
|
|
69
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))),
|
|
70
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "score"))),
|
|
71
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startMs"))),
|
|
72
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endMs"))),
|
|
73
|
+
JSIConverter<std::optional<std::vector<double>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamps"))),
|
|
74
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "json")))
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::onnx::speech::AsrResult& arg) {
|
|
78
|
+
jsi::Object obj(runtime);
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter<std::string>::toJSI(runtime, arg.text));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "score"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.score));
|
|
81
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "startMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.startMs));
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "endMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.endMs));
|
|
83
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamps"), JSIConverter<std::optional<std::vector<double>>>::toJSI(runtime, arg.timestamps));
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "json"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.json));
|
|
85
|
+
return obj;
|
|
86
|
+
}
|
|
87
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
88
|
+
if (!value.isObject()) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
jsi::Object obj = value.getObject(runtime);
|
|
92
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false;
|
|
96
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "score")))) return false;
|
|
97
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startMs")))) return false;
|
|
98
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endMs")))) return false;
|
|
99
|
+
if (!JSIConverter<std::optional<std::vector<double>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamps")))) return false;
|
|
100
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "json")))) return false;
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridOfflineAsrSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridOfflineAsrSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::onnx::speech {
|
|
11
|
+
|
|
12
|
+
void HybridOfflineAsrSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("load", &HybridOfflineAsrSpec::load);
|
|
18
|
+
prototype.registerHybridMethod("isLoaded", &HybridOfflineAsrSpec::isLoaded);
|
|
19
|
+
prototype.registerHybridMethod("recognize", &HybridOfflineAsrSpec::recognize);
|
|
20
|
+
prototype.registerHybridMethod("recognizeFile", &HybridOfflineAsrSpec::recognizeFile);
|
|
21
|
+
prototype.registerHybridMethod("unload", &HybridOfflineAsrSpec::unload);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridOfflineAsrSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `AsrModelConfig` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::onnx::speech { struct AsrModelConfig; }
|
|
18
|
+
// Forward declaration of `AsrResult` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::onnx::speech { struct AsrResult; }
|
|
20
|
+
|
|
21
|
+
#include <NitroModules/Promise.hpp>
|
|
22
|
+
#include "AsrModelConfig.hpp"
|
|
23
|
+
#include "AsrResult.hpp"
|
|
24
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
25
|
+
#include <string>
|
|
26
|
+
|
|
27
|
+
namespace margelo::nitro::onnx::speech {
|
|
28
|
+
|
|
29
|
+
using namespace margelo::nitro;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An abstract base class for `OfflineAsr`
|
|
33
|
+
* Inherit this class to create instances of `HybridOfflineAsrSpec` in C++.
|
|
34
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
35
|
+
* @example
|
|
36
|
+
* ```cpp
|
|
37
|
+
* class HybridOfflineAsr: public HybridOfflineAsrSpec {
|
|
38
|
+
* public:
|
|
39
|
+
* HybridOfflineAsr(...): HybridObject(TAG) { ... }
|
|
40
|
+
* // ...
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
class HybridOfflineAsrSpec: public virtual HybridObject {
|
|
45
|
+
public:
|
|
46
|
+
// Constructor
|
|
47
|
+
explicit HybridOfflineAsrSpec(): HybridObject(TAG) { }
|
|
48
|
+
|
|
49
|
+
// Destructor
|
|
50
|
+
~HybridOfflineAsrSpec() override = default;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Properties
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Methods
|
|
58
|
+
virtual std::shared_ptr<Promise<void>> load(const AsrModelConfig& config) = 0;
|
|
59
|
+
virtual bool isLoaded() = 0;
|
|
60
|
+
virtual std::shared_ptr<Promise<AsrResult>> recognize(const std::shared_ptr<ArrayBuffer>& samples) = 0;
|
|
61
|
+
virtual std::shared_ptr<Promise<AsrResult>> recognizeFile(const std::string& path) = 0;
|
|
62
|
+
virtual std::shared_ptr<Promise<void>> unload() = 0;
|
|
63
|
+
|
|
64
|
+
protected:
|
|
65
|
+
// Hybrid Setup
|
|
66
|
+
void loadHybridMethods() override;
|
|
67
|
+
|
|
68
|
+
protected:
|
|
69
|
+
// Tag for logging
|
|
70
|
+
static constexpr auto TAG = "OfflineAsr";
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridOnnxSpeechSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridOnnxSpeechSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::onnx::speech {
|
|
11
|
+
|
|
12
|
+
void HybridOnnxSpeechSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("version", &HybridOnnxSpeechSpec::getVersion);
|
|
18
|
+
prototype.registerHybridMethod("createVad", &HybridOnnxSpeechSpec::createVad);
|
|
19
|
+
prototype.registerHybridMethod("createOfflineAsr", &HybridOnnxSpeechSpec::createOfflineAsr);
|
|
20
|
+
prototype.registerHybridMethod("createStreamingAsr", &HybridOnnxSpeechSpec::createStreamingAsr);
|
|
21
|
+
prototype.registerHybridMethod("createTts", &HybridOnnxSpeechSpec::createTts);
|
|
22
|
+
prototype.registerHybridMethod("createSpeakerManager", &HybridOnnxSpeechSpec::createSpeakerManager);
|
|
23
|
+
prototype.registerHybridMethod("isQualcommCpu", &HybridOnnxSpeechSpec::isQualcommCpu);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridOnnxSpeechSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `HybridVadSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::onnx::speech { class HybridVadSpec; }
|
|
18
|
+
// Forward declaration of `HybridOfflineAsrSpec` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::onnx::speech { class HybridOfflineAsrSpec; }
|
|
20
|
+
// Forward declaration of `HybridStreamingAsrSpec` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::onnx::speech { class HybridStreamingAsrSpec; }
|
|
22
|
+
// Forward declaration of `HybridTtsSpec` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::onnx::speech { class HybridTtsSpec; }
|
|
24
|
+
// Forward declaration of `HybridSpeakerManagerSpec` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::onnx::speech { class HybridSpeakerManagerSpec; }
|
|
26
|
+
|
|
27
|
+
#include <string>
|
|
28
|
+
#include <memory>
|
|
29
|
+
#include "HybridVadSpec.hpp"
|
|
30
|
+
#include "HybridOfflineAsrSpec.hpp"
|
|
31
|
+
#include "HybridStreamingAsrSpec.hpp"
|
|
32
|
+
#include "HybridTtsSpec.hpp"
|
|
33
|
+
#include "HybridSpeakerManagerSpec.hpp"
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::onnx::speech {
|
|
36
|
+
|
|
37
|
+
using namespace margelo::nitro;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An abstract base class for `OnnxSpeech`
|
|
41
|
+
* Inherit this class to create instances of `HybridOnnxSpeechSpec` in C++.
|
|
42
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
43
|
+
* @example
|
|
44
|
+
* ```cpp
|
|
45
|
+
* class HybridOnnxSpeech: public HybridOnnxSpeechSpec {
|
|
46
|
+
* public:
|
|
47
|
+
* HybridOnnxSpeech(...): HybridObject(TAG) { ... }
|
|
48
|
+
* // ...
|
|
49
|
+
* };
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
class HybridOnnxSpeechSpec: public virtual HybridObject {
|
|
53
|
+
public:
|
|
54
|
+
// Constructor
|
|
55
|
+
explicit HybridOnnxSpeechSpec(): HybridObject(TAG) { }
|
|
56
|
+
|
|
57
|
+
// Destructor
|
|
58
|
+
~HybridOnnxSpeechSpec() override = default;
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
// Properties
|
|
62
|
+
virtual std::string getVersion() = 0;
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
// Methods
|
|
66
|
+
virtual std::shared_ptr<HybridVadSpec> createVad() = 0;
|
|
67
|
+
virtual std::shared_ptr<HybridOfflineAsrSpec> createOfflineAsr() = 0;
|
|
68
|
+
virtual std::shared_ptr<HybridStreamingAsrSpec> createStreamingAsr() = 0;
|
|
69
|
+
virtual std::shared_ptr<HybridTtsSpec> createTts() = 0;
|
|
70
|
+
virtual std::shared_ptr<HybridSpeakerManagerSpec> createSpeakerManager() = 0;
|
|
71
|
+
virtual bool isQualcommCpu() = 0;
|
|
72
|
+
|
|
73
|
+
protected:
|
|
74
|
+
// Hybrid Setup
|
|
75
|
+
void loadHybridMethods() override;
|
|
76
|
+
|
|
77
|
+
protected:
|
|
78
|
+
// Tag for logging
|
|
79
|
+
static constexpr auto TAG = "OnnxSpeech";
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpeakerManagerSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridSpeakerManagerSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::onnx::speech {
|
|
11
|
+
|
|
12
|
+
void HybridSpeakerManagerSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("load", &HybridSpeakerManagerSpec::load);
|
|
18
|
+
prototype.registerHybridMethod("isLoaded", &HybridSpeakerManagerSpec::isLoaded);
|
|
19
|
+
prototype.registerHybridMethod("computeEmbedding", &HybridSpeakerManagerSpec::computeEmbedding);
|
|
20
|
+
prototype.registerHybridMethod("registerSpeaker", &HybridSpeakerManagerSpec::registerSpeaker);
|
|
21
|
+
prototype.registerHybridMethod("registerSpeakerFromFile", &HybridSpeakerManagerSpec::registerSpeakerFromFile);
|
|
22
|
+
prototype.registerHybridMethod("listSpeakers", &HybridSpeakerManagerSpec::listSpeakers);
|
|
23
|
+
prototype.registerHybridMethod("removeSpeaker", &HybridSpeakerManagerSpec::removeSpeaker);
|
|
24
|
+
prototype.registerHybridMethod("unload", &HybridSpeakerManagerSpec::unload);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpeakerManagerSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `SpeakerEmbeddingConfig` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::onnx::speech { struct SpeakerEmbeddingConfig; }
|
|
18
|
+
// Forward declaration of `RegisteredSpeaker` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::onnx::speech { struct RegisteredSpeaker; }
|
|
20
|
+
|
|
21
|
+
#include <NitroModules/Promise.hpp>
|
|
22
|
+
#include "SpeakerEmbeddingConfig.hpp"
|
|
23
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
24
|
+
#include "RegisteredSpeaker.hpp"
|
|
25
|
+
#include <string>
|
|
26
|
+
#include <vector>
|
|
27
|
+
|
|
28
|
+
namespace margelo::nitro::onnx::speech {
|
|
29
|
+
|
|
30
|
+
using namespace margelo::nitro;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* An abstract base class for `SpeakerManager`
|
|
34
|
+
* Inherit this class to create instances of `HybridSpeakerManagerSpec` in C++.
|
|
35
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
36
|
+
* @example
|
|
37
|
+
* ```cpp
|
|
38
|
+
* class HybridSpeakerManager: public HybridSpeakerManagerSpec {
|
|
39
|
+
* public:
|
|
40
|
+
* HybridSpeakerManager(...): HybridObject(TAG) { ... }
|
|
41
|
+
* // ...
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
class HybridSpeakerManagerSpec: public virtual HybridObject {
|
|
46
|
+
public:
|
|
47
|
+
// Constructor
|
|
48
|
+
explicit HybridSpeakerManagerSpec(): HybridObject(TAG) { }
|
|
49
|
+
|
|
50
|
+
// Destructor
|
|
51
|
+
~HybridSpeakerManagerSpec() override = default;
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
// Properties
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
// Methods
|
|
59
|
+
virtual std::shared_ptr<Promise<void>> load(const SpeakerEmbeddingConfig& config) = 0;
|
|
60
|
+
virtual bool isLoaded() = 0;
|
|
61
|
+
virtual std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> computeEmbedding(const std::shared_ptr<ArrayBuffer>& samples) = 0;
|
|
62
|
+
virtual std::shared_ptr<Promise<RegisteredSpeaker>> registerSpeaker(const std::string& id, const std::string& name, const std::shared_ptr<ArrayBuffer>& embedding) = 0;
|
|
63
|
+
virtual std::shared_ptr<Promise<RegisteredSpeaker>> registerSpeakerFromFile(const std::string& id, const std::string& name, const std::string& path) = 0;
|
|
64
|
+
virtual std::shared_ptr<Promise<std::vector<RegisteredSpeaker>>> listSpeakers() = 0;
|
|
65
|
+
virtual std::shared_ptr<Promise<void>> removeSpeaker(const std::string& id) = 0;
|
|
66
|
+
virtual std::shared_ptr<Promise<void>> unload() = 0;
|
|
67
|
+
|
|
68
|
+
protected:
|
|
69
|
+
// Hybrid Setup
|
|
70
|
+
void loadHybridMethods() override;
|
|
71
|
+
|
|
72
|
+
protected:
|
|
73
|
+
// Tag for logging
|
|
74
|
+
static constexpr auto TAG = "SpeakerManager";
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridStreamingAsrSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridStreamingAsrSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::onnx::speech {
|
|
11
|
+
|
|
12
|
+
void HybridStreamingAsrSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("onPartialResult", &HybridStreamingAsrSpec::getOnPartialResult);
|
|
18
|
+
prototype.registerHybridSetter("onPartialResult", &HybridStreamingAsrSpec::setOnPartialResult);
|
|
19
|
+
prototype.registerHybridGetter("onFinalResult", &HybridStreamingAsrSpec::getOnFinalResult);
|
|
20
|
+
prototype.registerHybridSetter("onFinalResult", &HybridStreamingAsrSpec::setOnFinalResult);
|
|
21
|
+
prototype.registerHybridGetter("onError", &HybridStreamingAsrSpec::getOnError);
|
|
22
|
+
prototype.registerHybridSetter("onError", &HybridStreamingAsrSpec::setOnError);
|
|
23
|
+
prototype.registerHybridMethod("load", &HybridStreamingAsrSpec::load);
|
|
24
|
+
prototype.registerHybridMethod("isLoaded", &HybridStreamingAsrSpec::isLoaded);
|
|
25
|
+
prototype.registerHybridMethod("acceptWaveform", &HybridStreamingAsrSpec::acceptWaveform);
|
|
26
|
+
prototype.registerHybridMethod("finalize", &HybridStreamingAsrSpec::finalize);
|
|
27
|
+
prototype.registerHybridMethod("reset", &HybridStreamingAsrSpec::reset);
|
|
28
|
+
prototype.registerHybridMethod("unload", &HybridStreamingAsrSpec::unload);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridStreamingAsrSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `AsrResult` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::onnx::speech { struct AsrResult; }
|
|
18
|
+
// Forward declaration of `AsrModelConfig` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::onnx::speech { struct AsrModelConfig; }
|
|
20
|
+
|
|
21
|
+
#include "AsrResult.hpp"
|
|
22
|
+
#include <functional>
|
|
23
|
+
#include <optional>
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <NitroModules/Promise.hpp>
|
|
26
|
+
#include "AsrModelConfig.hpp"
|
|
27
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
28
|
+
|
|
29
|
+
namespace margelo::nitro::onnx::speech {
|
|
30
|
+
|
|
31
|
+
using namespace margelo::nitro;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An abstract base class for `StreamingAsr`
|
|
35
|
+
* Inherit this class to create instances of `HybridStreamingAsrSpec` in C++.
|
|
36
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
37
|
+
* @example
|
|
38
|
+
* ```cpp
|
|
39
|
+
* class HybridStreamingAsr: public HybridStreamingAsrSpec {
|
|
40
|
+
* public:
|
|
41
|
+
* HybridStreamingAsr(...): HybridObject(TAG) { ... }
|
|
42
|
+
* // ...
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
class HybridStreamingAsrSpec: public virtual HybridObject {
|
|
47
|
+
public:
|
|
48
|
+
// Constructor
|
|
49
|
+
explicit HybridStreamingAsrSpec(): HybridObject(TAG) { }
|
|
50
|
+
|
|
51
|
+
// Destructor
|
|
52
|
+
~HybridStreamingAsrSpec() override = default;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Properties
|
|
56
|
+
virtual std::optional<std::function<void(const AsrResult& /* result */)>> getOnPartialResult() = 0;
|
|
57
|
+
virtual void setOnPartialResult(const std::optional<std::function<void(const AsrResult& /* result */)>>& onPartialResult) = 0;
|
|
58
|
+
virtual std::optional<std::function<void(const AsrResult& /* result */)>> getOnFinalResult() = 0;
|
|
59
|
+
virtual void setOnFinalResult(const std::optional<std::function<void(const AsrResult& /* result */)>>& onFinalResult) = 0;
|
|
60
|
+
virtual std::optional<std::function<void(const std::string& /* error */)>> getOnError() = 0;
|
|
61
|
+
virtual void setOnError(const std::optional<std::function<void(const std::string& /* error */)>>& onError) = 0;
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
// Methods
|
|
65
|
+
virtual std::shared_ptr<Promise<void>> load(const AsrModelConfig& config) = 0;
|
|
66
|
+
virtual bool isLoaded() = 0;
|
|
67
|
+
virtual std::shared_ptr<Promise<void>> acceptWaveform(const std::shared_ptr<ArrayBuffer>& samples) = 0;
|
|
68
|
+
virtual std::shared_ptr<Promise<AsrResult>> finalize() = 0;
|
|
69
|
+
virtual std::shared_ptr<Promise<void>> reset() = 0;
|
|
70
|
+
virtual std::shared_ptr<Promise<void>> unload() = 0;
|
|
71
|
+
|
|
72
|
+
protected:
|
|
73
|
+
// Hybrid Setup
|
|
74
|
+
void loadHybridMethods() override;
|
|
75
|
+
|
|
76
|
+
protected:
|
|
77
|
+
// Tag for logging
|
|
78
|
+
static constexpr auto TAG = "StreamingAsr";
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTtsSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridTtsSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::onnx::speech {
|
|
11
|
+
|
|
12
|
+
void HybridTtsSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("load", &HybridTtsSpec::load);
|
|
18
|
+
prototype.registerHybridMethod("isLoaded", &HybridTtsSpec::isLoaded);
|
|
19
|
+
prototype.registerHybridMethod("synthesize", &HybridTtsSpec::synthesize);
|
|
20
|
+
prototype.registerHybridMethod("synthesizeWithSpeaker", &HybridTtsSpec::synthesizeWithSpeaker);
|
|
21
|
+
prototype.registerHybridMethod("saveWav", &HybridTtsSpec::saveWav);
|
|
22
|
+
prototype.registerHybridMethod("unload", &HybridTtsSpec::unload);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTtsSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `TtsModelConfig` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::onnx::speech { struct TtsModelConfig; }
|
|
18
|
+
// Forward declaration of `TtsResult` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::onnx::speech { struct TtsResult; }
|
|
20
|
+
|
|
21
|
+
#include <NitroModules/Promise.hpp>
|
|
22
|
+
#include "TtsModelConfig.hpp"
|
|
23
|
+
#include "TtsResult.hpp"
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <optional>
|
|
26
|
+
|
|
27
|
+
namespace margelo::nitro::onnx::speech {
|
|
28
|
+
|
|
29
|
+
using namespace margelo::nitro;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An abstract base class for `Tts`
|
|
33
|
+
* Inherit this class to create instances of `HybridTtsSpec` in C++.
|
|
34
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
35
|
+
* @example
|
|
36
|
+
* ```cpp
|
|
37
|
+
* class HybridTts: public HybridTtsSpec {
|
|
38
|
+
* public:
|
|
39
|
+
* HybridTts(...): HybridObject(TAG) { ... }
|
|
40
|
+
* // ...
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
class HybridTtsSpec: public virtual HybridObject {
|
|
45
|
+
public:
|
|
46
|
+
// Constructor
|
|
47
|
+
explicit HybridTtsSpec(): HybridObject(TAG) { }
|
|
48
|
+
|
|
49
|
+
// Destructor
|
|
50
|
+
~HybridTtsSpec() override = default;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Properties
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Methods
|
|
58
|
+
virtual std::shared_ptr<Promise<void>> load(const TtsModelConfig& config) = 0;
|
|
59
|
+
virtual bool isLoaded() = 0;
|
|
60
|
+
virtual std::shared_ptr<Promise<TtsResult>> synthesize(const std::string& text, std::optional<double> speed) = 0;
|
|
61
|
+
virtual std::shared_ptr<Promise<TtsResult>> synthesizeWithSpeaker(const std::string& text, const std::string& speakerId, std::optional<double> speed) = 0;
|
|
62
|
+
virtual std::shared_ptr<Promise<void>> saveWav(const TtsResult& result, const std::string& path) = 0;
|
|
63
|
+
virtual std::shared_ptr<Promise<void>> unload() = 0;
|
|
64
|
+
|
|
65
|
+
protected:
|
|
66
|
+
// Hybrid Setup
|
|
67
|
+
void loadHybridMethods() override;
|
|
68
|
+
|
|
69
|
+
protected:
|
|
70
|
+
// Tag for logging
|
|
71
|
+
static constexpr auto TAG = "Tts";
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
} // namespace margelo::nitro::onnx::speech
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridVadSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridVadSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::onnx::speech {
|
|
11
|
+
|
|
12
|
+
void HybridVadSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("onSpeechStart", &HybridVadSpec::getOnSpeechStart);
|
|
18
|
+
prototype.registerHybridSetter("onSpeechStart", &HybridVadSpec::setOnSpeechStart);
|
|
19
|
+
prototype.registerHybridGetter("onSpeechEnd", &HybridVadSpec::getOnSpeechEnd);
|
|
20
|
+
prototype.registerHybridSetter("onSpeechEnd", &HybridVadSpec::setOnSpeechEnd);
|
|
21
|
+
prototype.registerHybridGetter("onError", &HybridVadSpec::getOnError);
|
|
22
|
+
prototype.registerHybridSetter("onError", &HybridVadSpec::setOnError);
|
|
23
|
+
prototype.registerHybridMethod("initialize", &HybridVadSpec::initialize);
|
|
24
|
+
prototype.registerHybridMethod("isInitialized", &HybridVadSpec::isInitialized);
|
|
25
|
+
prototype.registerHybridMethod("process", &HybridVadSpec::process);
|
|
26
|
+
prototype.registerHybridMethod("pullSegments", &HybridVadSpec::pullSegments);
|
|
27
|
+
prototype.registerHybridMethod("reset", &HybridVadSpec::reset);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
} // namespace margelo::nitro::onnx::speech
|