react-native-sherpa-onnx 0.3.8 → 0.4.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/README.md +20 -5
- package/SherpaOnnx.podspec +5 -1
- package/android/prebuilt-download.gradle +89 -49
- package/android/prebuilt-versions.gradle +1 -1
- package/android/src/main/assets/model_licenses/asr-models-license-status.csv +1 -0
- package/android/src/main/assets/model_licenses/speech-enhancement-models-license-status.csv +7 -0
- package/android/src/main/cpp/CMakeLists.txt +3 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-enhancement-wrapper.cpp +68 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-enhancement-wrapper.h +17 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect-enhancement.cpp +119 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect-helper.cpp +23 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect-helper.h +9 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect-stt.cpp +51 -8
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-model-detect.h +41 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-stt-wrapper.cpp +5 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-validate-enhancement.cpp +68 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-validate-enhancement.h +30 -0
- package/android/src/main/cpp/jni/model_detect/sherpa-onnx-validate-stt.cpp +11 -0
- package/android/src/main/cpp/jni/module/sherpa-onnx-module-jni.cpp +21 -0
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxArchiveHelper.kt +110 -35
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxAssetHelper.kt +6 -0
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxEnhancementHelper.kt +377 -0
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxExtractionNotificationHelper.kt +102 -0
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxModule.kt +198 -18
- package/android/src/main/java/com/sherpaonnx/SherpaOnnxSttHelper.kt +22 -0
- package/ios/Resources/model_licenses/asr-models-license-status.csv +1 -0
- package/ios/Resources/model_licenses/speech-enhancement-models-license-status.csv +7 -0
- package/ios/SherpaOnnx+Assets.mm +5 -0
- package/ios/SherpaOnnx+Enhancement.mm +435 -0
- package/ios/SherpaOnnx+STT.mm +13 -1
- package/ios/SherpaOnnx.mm +87 -17
- package/ios/enhancement/sherpa-onnx-enhancement-wrapper.h +85 -0
- package/ios/enhancement/sherpa-onnx-enhancement-wrapper.mm +218 -0
- package/ios/model_detect/sherpa-onnx-model-detect-enhancement.mm +92 -0
- package/ios/model_detect/sherpa-onnx-model-detect-helper.h +5 -0
- package/ios/model_detect/sherpa-onnx-model-detect-helper.mm +23 -0
- package/ios/model_detect/sherpa-onnx-model-detect-stt.mm +51 -7
- package/ios/model_detect/sherpa-onnx-model-detect.h +33 -0
- package/ios/model_detect/sherpa-onnx-validate-enhancement.h +30 -0
- package/ios/model_detect/sherpa-onnx-validate-enhancement.mm +69 -0
- package/ios/model_detect/sherpa-onnx-validate-stt.mm +11 -0
- package/ios/stt/sherpa-onnx-stt-wrapper.h +11 -1
- package/ios/stt/sherpa-onnx-stt-wrapper.mm +30 -2
- package/ios/tts/sherpa-onnx-tts-wrapper.mm +16 -0
- package/lib/module/NativeSherpaOnnx.js.map +1 -1
- package/lib/module/download/localModels.js +2 -3
- package/lib/module/download/localModels.js.map +1 -1
- package/lib/module/download/paths.js +2 -1
- package/lib/module/download/paths.js.map +1 -1
- package/lib/module/download/postDownloadProcessing.js +17 -4
- package/lib/module/download/postDownloadProcessing.js.map +1 -1
- package/lib/module/enhancement/index.js +63 -48
- package/lib/module/enhancement/index.js.map +1 -1
- package/lib/module/enhancement/streaming.js +60 -0
- package/lib/module/enhancement/streaming.js.map +1 -0
- package/lib/module/enhancement/streamingTypes.js +4 -0
- package/lib/module/enhancement/streamingTypes.js.map +1 -0
- package/lib/module/enhancement/types.js +4 -0
- package/lib/module/enhancement/types.js.map +1 -0
- package/lib/module/extraction/extractTarBz2.js +2 -2
- package/lib/module/extraction/extractTarBz2.js.map +1 -1
- package/lib/module/extraction/extractTarZst.js +2 -2
- package/lib/module/extraction/extractTarZst.js.map +1 -1
- package/lib/module/extraction/index.js +10 -5
- package/lib/module/extraction/index.js.map +1 -1
- package/lib/module/licenses.js +9 -3
- package/lib/module/licenses.js.map +1 -1
- package/lib/module/stt/index.js +4 -2
- package/lib/module/stt/index.js.map +1 -1
- package/lib/module/stt/streaming.js +2 -1
- package/lib/module/stt/streaming.js.map +1 -1
- package/lib/module/stt/types.js +3 -1
- package/lib/module/stt/types.js.map +1 -1
- package/lib/module/tts/index.js +4 -2
- package/lib/module/tts/index.js.map +1 -1
- package/lib/module/tts/streaming.js +3 -1
- package/lib/module/tts/streaming.js.map +1 -1
- package/lib/typescript/src/NativeSherpaOnnx.d.ts +70 -9
- package/lib/typescript/src/NativeSherpaOnnx.d.ts.map +1 -1
- package/lib/typescript/src/download/localModels.d.ts.map +1 -1
- package/lib/typescript/src/download/paths.d.ts +2 -1
- package/lib/typescript/src/download/paths.d.ts.map +1 -1
- package/lib/typescript/src/download/postDownloadProcessing.d.ts +9 -0
- package/lib/typescript/src/download/postDownloadProcessing.d.ts.map +1 -1
- package/lib/typescript/src/enhancement/index.d.ts +9 -46
- package/lib/typescript/src/enhancement/index.d.ts.map +1 -1
- package/lib/typescript/src/enhancement/streaming.d.ts +6 -0
- package/lib/typescript/src/enhancement/streaming.d.ts.map +1 -0
- package/lib/typescript/src/enhancement/streamingTypes.d.ts +12 -0
- package/lib/typescript/src/enhancement/streamingTypes.d.ts.map +1 -0
- package/lib/typescript/src/enhancement/types.d.ts +31 -0
- package/lib/typescript/src/enhancement/types.d.ts.map +1 -0
- package/lib/typescript/src/extraction/extractTarBz2.d.ts +2 -1
- package/lib/typescript/src/extraction/extractTarBz2.d.ts.map +1 -1
- package/lib/typescript/src/extraction/extractTarZst.d.ts +2 -1
- package/lib/typescript/src/extraction/extractTarZst.d.ts.map +1 -1
- package/lib/typescript/src/extraction/index.d.ts +1 -1
- package/lib/typescript/src/extraction/index.d.ts.map +1 -1
- package/lib/typescript/src/extraction/types.d.ts +12 -0
- package/lib/typescript/src/extraction/types.d.ts.map +1 -1
- package/lib/typescript/src/licenses.d.ts.map +1 -1
- package/lib/typescript/src/stt/index.d.ts +1 -1
- package/lib/typescript/src/stt/index.d.ts.map +1 -1
- package/lib/typescript/src/stt/streaming.d.ts.map +1 -1
- package/lib/typescript/src/stt/types.d.ts +16 -1
- package/lib/typescript/src/stt/types.d.ts.map +1 -1
- package/lib/typescript/src/tts/index.d.ts.map +1 -1
- package/lib/typescript/src/tts/streaming.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/ci/check-model-csvs.sh +27 -2
- package/scripts/ci/collect_all_sherpa_model_streams.sh +3 -1
- package/scripts/ci/collect_one_sherpa_release_stream.sh +3 -1
- package/scripts/ci/sherpa_speech_enhancement_model_release_streams.json +13 -0
- package/scripts/ci/update_model_license_csv.sh +17 -17
- package/src/NativeSherpaOnnx.ts +108 -10
- package/src/download/localModels.ts +1 -3
- package/src/download/paths.ts +2 -1
- package/src/download/postDownloadProcessing.ts +24 -1
- package/src/enhancement/index.ts +120 -58
- package/src/enhancement/streaming.ts +105 -0
- package/src/enhancement/streamingTypes.ts +14 -0
- package/src/enhancement/types.ts +36 -0
- package/src/extraction/extractTarBz2.ts +7 -2
- package/src/extraction/extractTarZst.ts +7 -2
- package/src/extraction/index.ts +29 -6
- package/src/extraction/types.ts +16 -0
- package/src/licenses.ts +13 -2
- package/src/stt/index.ts +8 -7
- package/src/stt/streaming.ts +7 -1
- package/src/stt/types.ts +18 -0
- package/src/tts/index.ts +7 -7
- package/src/tts/streaming.ts +6 -3
- package/third_party/sherpa-onnx-prebuilt/ANDROID_RELEASE_TAG +1 -1
- package/third_party/sherpa-onnx-prebuilt/IOS_RELEASE_TAG +1 -1
|
@@ -56,5 +56,17 @@ export type ExtractArchiveOptions = {
|
|
|
56
56
|
onProgress?: (event: ExtractProgressEvent) => void;
|
|
57
57
|
/** AbortSignal to cancel the extraction. */
|
|
58
58
|
signal?: AbortSignal;
|
|
59
|
+
/**
|
|
60
|
+
* **Android:** When true (default), the native layer posts a system notification with extraction
|
|
61
|
+
* progress. Set to false to disable (e.g. first-run bundled-model prep with in-app UI only).
|
|
62
|
+
* **iOS:** Accepted for API parity; no notification is shown.
|
|
63
|
+
*/
|
|
64
|
+
showNotificationsEnabled?: boolean;
|
|
65
|
+
/** **Android:** Notification title. Default: generic “unpacking” title. Ignored on iOS. */
|
|
66
|
+
notificationTitle?: string;
|
|
67
|
+
/** **Android:** Notification body (progress text is appended). Default: generic. Ignored on iOS. */
|
|
68
|
+
notificationText?: string;
|
|
59
69
|
};
|
|
70
|
+
/** Subset of `ExtractArchiveOptions` passed through to path- and asset-stream extractors. */
|
|
71
|
+
export type ExtractNotificationArgs = Pick<ExtractArchiveOptions, 'showNotificationsEnabled' | 'notificationTitle' | 'notificationText'>;
|
|
60
72
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/extraction/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,8CAA8C;AAC9C,MAAM,MAAM,cAAc,GAAG;IAC3B,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,gDAAgD;AAChD,MAAM,MAAM,oBAAoB,GAAG;IACjC,8BAA8B;IAC9B,KAAK,EAAE,MAAM,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GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oCAAoC;AACpC,MAAM,MAAM,qBAAqB,GAAG;IAClC,oDAAoD;IACpD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wCAAwC;IACxC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACnD,4CAA4C;IAC5C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oGAAoG;IACpG,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,6FAA6F;AAC7F,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,qBAAqB,EACrB,0BAA0B,GAAG,mBAAmB,GAAG,kBAAkB,CACtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"licenses.d.ts","sourceRoot":"","sources":["../../../src/licenses.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,KAAK,GAAG,IAAI,GAAG,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"licenses.d.ts","sourceRoot":"","sources":["../../../src/licenses.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,KAAK,GAAG,IAAI,GAAG,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAmDhE"}
|
|
@@ -49,7 +49,7 @@ export declare function createSTT(options: STTInitializeOptions | ModelPathConfi
|
|
|
49
49
|
export { createStreamingSTT, mapDetectedToOnlineType, getOnlineTypeOrNull, } from './streaming';
|
|
50
50
|
export type { OnlineSTTModelType, StreamingSttEngine, StreamingSttInitOptions, StreamingSttResult, SttStream, EndpointConfig, EndpointRule, } from './streamingTypes';
|
|
51
51
|
export { ONLINE_STT_MODEL_TYPES } from './streamingTypes';
|
|
52
|
-
export type { STTInitializeOptions, STTModelType, SttModelOptions, SttRecognitionResult, SttRuntimeConfig, SttEngine, SttInitResult, } from './types';
|
|
52
|
+
export type { STTInitializeOptions, STTModelType, SttModelOptions, SttQwen3AsrModelOptions, SttRecognitionResult, SttRuntimeConfig, SttEngine, SttInitResult, } from './types';
|
|
53
53
|
export { STT_MODEL_TYPES, STT_HOTWORDS_MODEL_TYPES, sttSupportsHotwords, } from './types';
|
|
54
54
|
export { getWhisperLanguages, WHISPER_LANGUAGES, getSenseVoiceLanguages, SENSEVOICE_LANGUAGES, getCanaryLanguages, CANARY_LANGUAGES, getFunasrNanoLanguages, FUNASR_NANO_LANGUAGES, getFunasrMltNanoLanguages, FUNASR_MLT_NANO_LANGUAGES, } from './sttModelLanguages';
|
|
55
55
|
export type { SttModelLanguage, WhisperLanguage } from './sttModelLanguages';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/stt/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AAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC,CAAC,CAmBD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,oBAAoB,GAAG,eAAe,GAC9C,OAAO,CAAC,SAAS,CAAC,CAyIpB;AAGD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../../../src/stt/streaming.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EAGxB,MAAM,kBAAkB,CAAC;AAI1B;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,kBAAkB,CAmBpB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,kBAAkB,GAAG,IAAI,CAM3B;AA0ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../../../src/stt/streaming.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EAGxB,MAAM,kBAAkB,CAAC;AAI1B;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,kBAAkB,CAmBpB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,kBAAkB,GAAG,IAAI,CAM3B;AA0ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CA0N7B"}
|
|
@@ -3,7 +3,7 @@ import type { ModelPathConfig } from '../types';
|
|
|
3
3
|
* Supported STT model types.
|
|
4
4
|
* Must match ParseSttModelType() in android/.../sherpa-onnx-model-detect-stt.cpp.
|
|
5
5
|
*/
|
|
6
|
-
export type STTModelType = 'transducer' | 'nemo_transducer' | 'paraformer' | 'nemo_ctc' | 'wenet_ctc' | 'sense_voice' | 'zipformer_ctc' | 'ctc' | 'whisper' | 'funasr_nano' | 'fire_red_asr' | 'moonshine' | 'dolphin' | 'canary' | 'omnilingual' | 'medasr' | 'telespeech_ctc' | 'auto';
|
|
6
|
+
export type STTModelType = 'transducer' | 'nemo_transducer' | 'paraformer' | 'nemo_ctc' | 'wenet_ctc' | 'sense_voice' | 'zipformer_ctc' | 'ctc' | 'whisper' | 'funasr_nano' | 'qwen3_asr' | 'fire_red_asr' | 'moonshine' | 'dolphin' | 'canary' | 'omnilingual' | 'medasr' | 'telespeech_ctc' | 'auto';
|
|
7
7
|
/** Model types that support hotwords (contextual biasing). Transducer and NeMo transducer support hotwords in sherpa-onnx (NeMo: see k2-fsa/sherpa-onnx#3077). */
|
|
8
8
|
export declare const STT_HOTWORDS_MODEL_TYPES: readonly STTModelType[];
|
|
9
9
|
/**
|
|
@@ -73,6 +73,19 @@ export interface SttFunAsrNanoModelOptions {
|
|
|
73
73
|
/** Hotwords string. */
|
|
74
74
|
hotwords?: string;
|
|
75
75
|
}
|
|
76
|
+
/** Options for Qwen3 ASR models. Applied only when modelType is 'qwen3_asr'. */
|
|
77
|
+
export interface SttQwen3AsrModelOptions {
|
|
78
|
+
/** Max total sequence length. Default: 512. */
|
|
79
|
+
maxTotalLen?: number;
|
|
80
|
+
/** Max new tokens to generate. Default: 128. */
|
|
81
|
+
maxNewTokens?: number;
|
|
82
|
+
/** Sampling temperature. Default: 1e-6. */
|
|
83
|
+
temperature?: number;
|
|
84
|
+
/** Top-p sampling. Default: 0.8. */
|
|
85
|
+
topP?: number;
|
|
86
|
+
/** Random seed. Default: 42. */
|
|
87
|
+
seed?: number;
|
|
88
|
+
}
|
|
76
89
|
/**
|
|
77
90
|
* Model-specific STT options. Only the block for the actually loaded model type is applied;
|
|
78
91
|
* others are ignored (e.g. whisper options have no effect when a paraformer model is loaded).
|
|
@@ -82,6 +95,7 @@ export interface SttModelOptions {
|
|
|
82
95
|
senseVoice?: SttSenseVoiceModelOptions;
|
|
83
96
|
canary?: SttCanaryModelOptions;
|
|
84
97
|
funasrNano?: SttFunAsrNanoModelOptions;
|
|
98
|
+
qwen3Asr?: SttQwen3AsrModelOptions;
|
|
85
99
|
}
|
|
86
100
|
/**
|
|
87
101
|
* STT-specific initialization options
|
|
@@ -108,6 +122,7 @@ export interface STTInitializeOptions {
|
|
|
108
122
|
* - 'wenet_ctc': Force detection as WeNet CTC model
|
|
109
123
|
* - 'sense_voice': Force detection as SenseVoice model
|
|
110
124
|
* - 'funasr_nano': Force detection as FunASR Nano model
|
|
125
|
+
* - 'qwen3_asr': Force detection as Qwen3 ASR
|
|
111
126
|
* - 'fire_red_asr': FireRed ASR (encoder/decoder)
|
|
112
127
|
* - 'moonshine': Moonshine (preprocess, encode, uncached_decode, cached_decode)
|
|
113
128
|
* - 'dolphin': Dolphin (single model)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/stt/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,UAAU,GACV,WAAW,GACX,aAAa,GACb,eAAe,GACf,KAAK,GACL,SAAS,GACT,aAAa,GACb,cAAc,GACd,WAAW,GACX,SAAS,GACT,QAAQ,GACR,aAAa,GACb,QAAQ,GACR,gBAAgB,GAChB,MAAM,CAAC;AAEX,kKAAkK;AAClK,eAAO,MAAM,wBAAwB,EAAE,SAAS,YAAY,EAGlD,CAAC;AAEX;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO,CAE7E;AAED,0FAA0F;AAC1F,eAAO,MAAM,eAAe,EAAE,SAAS,YAAY,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/stt/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,UAAU,GACV,WAAW,GACX,aAAa,GACb,eAAe,GACf,KAAK,GACL,SAAS,GACT,aAAa,GACb,WAAW,GACX,cAAc,GACd,WAAW,GACX,SAAS,GACT,Q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AAoB,GAAG,eAAe,GAC9C,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../../../src/tts/streaming.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EAUrB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAoGhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,oBAAoB,GAAG,eAAe,GAC9C,OAAO,CAAC,kBAAkB,CAAC,CAsN7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-sherpa-onnx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Offline Speech-to-text, text-to-speech, speaker diarization, speech enhancement, source separation, and VAD with sherpa-onnx for React NativeSpeech-to-Text with sherpa-onnx for React Native",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Compare GitHub release assets (asr-models, tts-models) with local CSV fixtures.
|
|
2
|
+
# Compare GitHub release assets (asr-models, tts-models, speech-enhancement-models) with local CSV fixtures.
|
|
3
3
|
# If any asset exists on GitHub but is not listed in the corresponding CSV,
|
|
4
4
|
# print a warning (non-fatal) with the list and a hint to run the collect workflows.
|
|
5
5
|
# Exit code is always 0 so this can be used as an informational step.
|
|
@@ -9,6 +9,7 @@ set -e
|
|
|
9
9
|
REPO="${SHERPA_ONNX_REPO:-k2-fsa/sherpa-onnx}"
|
|
10
10
|
ASR_CSV="${ASR_CSV:-test/fixtures/asr-models-expected.csv}"
|
|
11
11
|
TTS_CSV="${TTS_CSV:-test/fixtures/tts-models-expected.csv}"
|
|
12
|
+
SPEECH_ENH_CSV="${SPEECH_ENH_CSV:-test/fixtures/speech-enhancement-models-expected.csv}"
|
|
12
13
|
|
|
13
14
|
# Optional: GITHUB_TOKEN or GH_TOKEN for api.github.com rate limits / private forks
|
|
14
15
|
CURL_GH_API=(-sL)
|
|
@@ -25,6 +26,10 @@ if [ ! -f "$TTS_CSV" ]; then
|
|
|
25
26
|
echo "::warning::Missing $TTS_CSV (run from repo root or set TTS_CSV)"
|
|
26
27
|
exit 0
|
|
27
28
|
fi
|
|
29
|
+
if [ ! -f "$SPEECH_ENH_CSV" ]; then
|
|
30
|
+
echo "::warning::Missing $SPEECH_ENH_CSV (run from repo root or set SPEECH_ENH_CSV)"
|
|
31
|
+
exit 0
|
|
32
|
+
fi
|
|
28
33
|
|
|
29
34
|
# Fetch ASR release assets (.tar.bz2, .onnx)
|
|
30
35
|
ASR_ASSETS=""
|
|
@@ -44,11 +49,21 @@ else
|
|
|
44
49
|
echo "::warning::Could not fetch tts-models release or it has no assets"
|
|
45
50
|
fi
|
|
46
51
|
|
|
52
|
+
# Fetch speech-enhancement-models release assets (.tar.bz2, .onnx)
|
|
53
|
+
SPEECH_ASSETS=""
|
|
54
|
+
SPEECH_RESP="${SPEECH_RESP:-$(curl "${CURL_GH_API[@]}" "https://api.github.com/repos/${REPO}/releases/tags/speech-enhancement-models")}"
|
|
55
|
+
if echo "$SPEECH_RESP" | jq -e '.assets' >/dev/null 2>&1; then
|
|
56
|
+
SPEECH_ASSETS=$(echo "$SPEECH_RESP" | jq -r '.assets[] | select(.name | endswith(".tar.bz2") or endswith(".onnx")) | .name')
|
|
57
|
+
else
|
|
58
|
+
echo "::warning::Could not fetch speech-enhancement-models release or it has no assets"
|
|
59
|
+
fi
|
|
60
|
+
|
|
47
61
|
# First column of CSV (asset_name); strip optional quotes and whitespace; skip header
|
|
48
62
|
csv_asset_names() { awk -F',' '{ gsub(/^ *"|" *$/, "", $1); gsub(/^ | $/, "", $1); if (NR>1 && $1 != "") print $1 }' "$1"; }
|
|
49
63
|
|
|
50
64
|
ASR_CSV_NAMES=$(csv_asset_names "$ASR_CSV")
|
|
51
65
|
TTS_CSV_NAMES=$(csv_asset_names "$TTS_CSV")
|
|
66
|
+
SPEECH_CSV_NAMES=$(csv_asset_names "$SPEECH_ENH_CSV")
|
|
52
67
|
|
|
53
68
|
ASR_MISSING=""
|
|
54
69
|
while IFS= read -r asset; do
|
|
@@ -66,13 +81,23 @@ while IFS= read -r asset; do
|
|
|
66
81
|
fi
|
|
67
82
|
done <<< "$TTS_ASSETS"
|
|
68
83
|
|
|
69
|
-
|
|
84
|
+
SPEECH_MISSING=""
|
|
85
|
+
while IFS= read -r asset; do
|
|
86
|
+
[ -z "$asset" ] && continue
|
|
87
|
+
if ! grep -qFx -- "$asset" <<< "$SPEECH_CSV_NAMES"; then
|
|
88
|
+
SPEECH_MISSING="${SPEECH_MISSING} - ${asset}\n"
|
|
89
|
+
fi
|
|
90
|
+
done <<< "$SPEECH_ASSETS"
|
|
91
|
+
|
|
92
|
+
if [ -n "$ASR_MISSING" ] || [ -n "$TTS_MISSING" ] || [ -n "$SPEECH_MISSING" ]; then
|
|
70
93
|
echo "::warning::New assets are available on GitHub but not yet listed in the expected CSV files."
|
|
71
94
|
[ -n "$ASR_MISSING" ] && echo -e "ASR (asr-models) assets missing from $ASR_CSV:\n$ASR_MISSING"
|
|
72
95
|
[ -n "$TTS_MISSING" ] && echo -e "TTS (tts-models) assets missing from $TTS_CSV:\n$TTS_MISSING"
|
|
96
|
+
[ -n "$SPEECH_MISSING" ] && echo -e "Speech enhancement (speech-enhancement-models) assets missing from $SPEECH_ENH_CSV:\n$SPEECH_MISSING"
|
|
73
97
|
echo "Please run the collect workflows to update fixtures:"
|
|
74
98
|
echo " - Testdata - Collect ASR model structures (workflow_dispatch)"
|
|
75
99
|
echo " - Testdata - Collect TTS model structures (workflow_dispatch)"
|
|
100
|
+
echo " - Testdata - Collect speech enhancement model structures (workflow_dispatch)"
|
|
76
101
|
exit 0
|
|
77
102
|
fi
|
|
78
103
|
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
# collect_all_sherpa_model_streams.sh [--config <file>] --print-git-paths
|
|
7
7
|
#
|
|
8
8
|
# Default config: scripts/ci/sherpa_asr_model_release_streams.json (ASR + QNN).
|
|
9
|
-
# TTS: --config sherpa_tts_model_release_streams.json
|
|
9
|
+
# TTS: --config sherpa_tts_model_release_streams.json
|
|
10
|
+
# Speech enhancement: --config sherpa_speech_enhancement_model_release_streams.json
|
|
11
|
+
# (paths relative to this dir or repo root, or absolute).
|
|
10
12
|
#
|
|
11
13
|
# --print-git-paths prints newline-separated paths to git-add (deduped), then exits.
|
|
12
14
|
set -euo pipefail
|
|
@@ -124,7 +124,9 @@ while IFS='|' read -r name url; do
|
|
|
124
124
|
continue
|
|
125
125
|
fi
|
|
126
126
|
elif [[ "$name" == *.onnx ]]; then
|
|
127
|
-
|
|
127
|
+
# Two lines so structure fixtures match tarball layout: model dir "." and the file (see model_detect_test).
|
|
128
|
+
base="${name##*/}"
|
|
129
|
+
printf '%s\n' "./" "./${base}" > "$cache_file"
|
|
128
130
|
else
|
|
129
131
|
echo "::warning::Unexpected asset $name" >&2
|
|
130
132
|
rm -f "$dl"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"repo": "k2-fsa/sherpa-onnx",
|
|
3
|
+
"streams": [
|
|
4
|
+
{
|
|
5
|
+
"id": "speech-enhancement-models",
|
|
6
|
+
"release_tag": "speech-enhancement-models",
|
|
7
|
+
"tree_cache_dir": "tree-cache/speech-enhancement-models",
|
|
8
|
+
"structure_file": "test/fixtures/speech-enhancement-models-structure.txt",
|
|
9
|
+
"expected_csv": "test/fixtures/speech-enhancement-models-expected.csv",
|
|
10
|
+
"license_csv": "android/src/main/assets/model_licenses/speech-enhancement-models-license-status.csv"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
# - Skips any asset whose license_type and commercial_use are both set and neither is `unknown`
|
|
12
12
|
# (case-insensitive). Rows with empty or `unknown` license_type and/or empty or `unknown`
|
|
13
13
|
# commercial_use are (re)processed. license_type `exhausted` is never auto-overwritten.
|
|
14
|
-
# - Uses tree-cache (from asr/tts-
|
|
14
|
+
# - Uses tree-cache (from asr/tts/speech-enhancement structure fixtures + new downloads) to see if a LICENSE-like
|
|
15
15
|
# path exists — no full extract unless we need file contents for detection.
|
|
16
16
|
# - Downloads the .tar.bz2 only when a license-like path was found and license_type is still empty.
|
|
17
|
-
# - Pipeline: try archive (if applicable)
|
|
17
|
+
# - Pipeline: try archive (if applicable) --> HF/ModelScope fallbacks for eligible assets. If no license
|
|
18
18
|
# is found after all attempts, license_type is set to exhausted (default keyword; override with
|
|
19
19
|
# LICENSE_EXHAUSTED env). You can set exhausted manually after review.
|
|
20
20
|
# - .onnx-only: exhausted (no archive to scan).
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
# asr-models-license-status.csv (default: same directory as --csv). Strip prefix
|
|
31
31
|
# sherpa-onnx-qnn-<soc>-binary-<n>-seconds- from the QNN asset name, then try a few derived filenames
|
|
32
32
|
# (exact, sherpa-onnx-…, and sherpa-onnx-<stem>.tar.bz2 when …-int8.tar.bz2). On match, copy the ASR row’s
|
|
33
|
-
# license fields (not asset_name) onto the QNN asset; on no match
|
|
33
|
+
# license fields (not asset_name) onto the QNN asset; on no match --> exhausted like other dead ends.
|
|
34
34
|
# - Hugging Face: set HF_TOKEN or HUGGINGFACE_HUB_TOKEN (read token is enough for public repos). Anonymous
|
|
35
35
|
# requests from CI often get HTTP 401; without a token README/MODEL_CARD cannot be fetched.
|
|
36
36
|
#
|
|
@@ -566,7 +566,7 @@ for asset_name in "${release_assets[@]}"; do
|
|
|
566
566
|
|
|
567
567
|
if [[ "$asset_name" == *.onnx ]]; then
|
|
568
568
|
set_exhausted "$asset_name"
|
|
569
|
-
echo " $asset_name — .onnx bundle
|
|
569
|
+
echo " $asset_name — .onnx bundle --> license_type=$LICENSE_EXHAUSTED (no archive; skipped next run)"
|
|
570
570
|
continue
|
|
571
571
|
fi
|
|
572
572
|
|
|
@@ -601,15 +601,15 @@ for asset_name in "${release_assets[@]}"; do
|
|
|
601
601
|
|
|
602
602
|
if [[ ${#license_paths[@]} -eq 0 ]]; then
|
|
603
603
|
if try_hf_model_card_fallback "$asset_name"; then
|
|
604
|
-
echo " $asset_name — no license in tree
|
|
604
|
+
echo " $asset_name — no license in tree --> filled from $(log_license_fallback_source "$asset_name") (license_type=${existing_license_type["$asset_name"]})"
|
|
605
605
|
continue
|
|
606
606
|
fi
|
|
607
607
|
if try_qnn_asr_license_fallback "$asset_name"; then
|
|
608
|
-
echo " $asset_name — no license in tree + HF exhausted
|
|
608
|
+
echo " $asset_name — no license in tree + HF exhausted --> QNN mirror from asr row (${_QNN_ASR_MIRROR_MATCHED}) (license_type=${existing_license_type["$asset_name"]})"
|
|
609
609
|
continue
|
|
610
610
|
fi
|
|
611
611
|
set_exhausted "$asset_name"
|
|
612
|
-
echo " $asset_name — no license in tree + fallbacks exhausted
|
|
612
|
+
echo " $asset_name — no license in tree + fallbacks exhausted --> license_type=$LICENSE_EXHAUSTED"
|
|
613
613
|
continue
|
|
614
614
|
fi
|
|
615
615
|
|
|
@@ -624,15 +624,15 @@ for asset_name in "${release_assets[@]}"; do
|
|
|
624
624
|
if ! curl "${_curl_dl[@]}" -o "$archive_path" "$url"; then
|
|
625
625
|
rm -rf "$td"
|
|
626
626
|
if try_hf_model_card_fallback "$asset_name"; then
|
|
627
|
-
echo " $asset_name — download failed
|
|
627
|
+
echo " $asset_name — download failed --> filled from $(log_license_fallback_source "$asset_name") (license_type=${existing_license_type["$asset_name"]})"
|
|
628
628
|
continue
|
|
629
629
|
fi
|
|
630
630
|
if try_qnn_asr_license_fallback "$asset_name"; then
|
|
631
|
-
echo " $asset_name — download failed + HF exhausted
|
|
631
|
+
echo " $asset_name — download failed + HF exhausted --> QNN mirror from asr row (${_QNN_ASR_MIRROR_MATCHED}) (license_type=${existing_license_type["$asset_name"]})"
|
|
632
632
|
continue
|
|
633
633
|
fi
|
|
634
634
|
set_exhausted "$asset_name"
|
|
635
|
-
echo " $asset_name — download failed + fallbacks exhausted
|
|
635
|
+
echo " $asset_name — download failed + fallbacks exhausted --> license_type=$LICENSE_EXHAUSTED"
|
|
636
636
|
continue
|
|
637
637
|
fi
|
|
638
638
|
|
|
@@ -665,15 +665,15 @@ for asset_name in "${release_assets[@]}"; do
|
|
|
665
665
|
if [[ -z "$extracted_text" ]]; then
|
|
666
666
|
rm -rf "$td"
|
|
667
667
|
if try_hf_model_card_fallback "$asset_name"; then
|
|
668
|
-
echo " $asset_name — could not extract license file
|
|
668
|
+
echo " $asset_name — could not extract license file --> filled from $(log_license_fallback_source "$asset_name") (license_type=${existing_license_type["$asset_name"]})"
|
|
669
669
|
continue
|
|
670
670
|
fi
|
|
671
671
|
if try_qnn_asr_license_fallback "$asset_name"; then
|
|
672
|
-
echo " $asset_name — could not extract license + HF exhausted
|
|
672
|
+
echo " $asset_name — could not extract license + HF exhausted --> QNN mirror from asr row (${_QNN_ASR_MIRROR_MATCHED}) (license_type=${existing_license_type["$asset_name"]})"
|
|
673
673
|
continue
|
|
674
674
|
fi
|
|
675
675
|
set_exhausted "$asset_name"
|
|
676
|
-
echo " $asset_name — could not extract license file + fallbacks exhausted
|
|
676
|
+
echo " $asset_name — could not extract license file + fallbacks exhausted --> license_type=$LICENSE_EXHAUSTED"
|
|
677
677
|
continue
|
|
678
678
|
fi
|
|
679
679
|
|
|
@@ -686,15 +686,15 @@ for asset_name in "${release_assets[@]}"; do
|
|
|
686
686
|
|
|
687
687
|
if [[ "$l_res" == "unknown" ]]; then
|
|
688
688
|
if try_hf_model_card_fallback "$asset_name"; then
|
|
689
|
-
echo " $asset_name — archive license text unknown
|
|
689
|
+
echo " $asset_name — archive license text unknown --> filled from $(log_license_fallback_source "$asset_name") (license_type=${existing_license_type["$asset_name"]})"
|
|
690
690
|
continue
|
|
691
691
|
fi
|
|
692
692
|
if try_qnn_asr_license_fallback "$asset_name"; then
|
|
693
|
-
echo " $asset_name — archive text unknown + HF exhausted
|
|
693
|
+
echo " $asset_name — archive text unknown + HF exhausted --> QNN mirror from asr row (${_QNN_ASR_MIRROR_MATCHED}) (license_type=${existing_license_type["$asset_name"]})"
|
|
694
694
|
continue
|
|
695
695
|
fi
|
|
696
696
|
set_exhausted "$asset_name"
|
|
697
|
-
echo " $asset_name — archive text unclassified + fallbacks exhausted
|
|
697
|
+
echo " $asset_name — archive text unclassified + fallbacks exhausted --> license_type=$LICENSE_EXHAUSTED"
|
|
698
698
|
continue
|
|
699
699
|
fi
|
|
700
700
|
|
|
@@ -761,5 +761,5 @@ if [[ -d "$REPO_ROOT/android" && -d "$REPO_ROOT/ios" && -f "$CSV_FILE" ]]; then
|
|
|
761
761
|
if ! same_canonical_path "$CSV_FILE" "$_ios_target"; then
|
|
762
762
|
cp "$CSV_FILE" "$_ios_target"
|
|
763
763
|
fi
|
|
764
|
-
echo "Synced $_bn
|
|
764
|
+
echo "Synced $_bn --> android/src/main/assets/model_licenses/ and ios/Resources/model_licenses/"
|
|
765
765
|
fi
|
package/src/NativeSherpaOnnx.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface Spec extends TurboModule {
|
|
|
21
21
|
* @param instanceId - Unique ID for this engine instance (from createSTT)
|
|
22
22
|
* @param modelDir - Absolute path to model directory
|
|
23
23
|
* @param preferInt8 - Optional: true = prefer int8 models, false = prefer regular models, undefined = try int8 first (default)
|
|
24
|
-
* @param modelType - Optional: explicit model type ('transducer', 'nemo_transducer', 'paraformer', 'nemo_ctc', 'wenet_ctc', 'sense_voice', 'zipformer_ctc', 'whisper', 'funasr_nano', 'fire_red_asr', 'moonshine', 'moonshine_v2', 'dolphin', 'canary', 'omnilingual', 'medasr', 'telespeech_ctc', 'auto'), undefined = auto (default)
|
|
24
|
+
* @param modelType - Optional: explicit model type ('transducer', 'nemo_transducer', 'paraformer', 'nemo_ctc', 'wenet_ctc', 'sense_voice', 'zipformer_ctc', 'whisper', 'funasr_nano', 'qwen3_asr', 'fire_red_asr', 'moonshine', 'moonshine_v2', 'dolphin', 'canary', 'omnilingual', 'medasr', 'telespeech_ctc', 'auto'), undefined = auto (default)
|
|
25
25
|
* @param debug - Optional: enable debug logging in native layer and sherpa-onnx (default: false)
|
|
26
26
|
* @param hotwordsFile - Optional: path to hotwords file (OfflineRecognizerConfig)
|
|
27
27
|
* @param hotwordsScore - Optional: hotwords score (default in Kotlin 1.5)
|
|
@@ -30,10 +30,10 @@ export interface Spec extends TurboModule {
|
|
|
30
30
|
* @param ruleFsts - Optional: path(s) to rule FSTs for ITN (comma-separated)
|
|
31
31
|
* @param ruleFars - Optional: path(s) to rule FARs for ITN (comma-separated)
|
|
32
32
|
* @param dither - Optional: dither for feature extraction. **Android:** applied. **iOS:** ignored (native API does not expose it)
|
|
33
|
-
* @param modelOptions - Optional: model-specific options (whisper, senseVoice, canary, funasrNano). Only the block for the loaded model type is applied.
|
|
33
|
+
* @param modelOptions - Optional: model-specific options (whisper, senseVoice, canary, funasrNano, qwen3Asr). Only the block for the loaded model type is applied.
|
|
34
34
|
* @param modelingUnit - Optional: 'cjkchar' | 'bpe' | 'cjkchar+bpe' for hotwords tokenization (OfflineModelConfig.modelingUnit)
|
|
35
35
|
* @param bpeVocab - Optional: path to BPE vocab file (OfflineModelConfig.bpeVocab), used when modelingUnit is bpe or cjkchar+bpe
|
|
36
|
-
* @returns Object with success boolean
|
|
36
|
+
* @returns Object with success boolean, array of detected models (each with type and modelDir), and optional error when success is false.
|
|
37
37
|
*/
|
|
38
38
|
initializeStt(
|
|
39
39
|
instanceId: string,
|
|
@@ -53,6 +53,8 @@ export interface Spec extends TurboModule {
|
|
|
53
53
|
bpeVocab?: string
|
|
54
54
|
): Promise<{
|
|
55
55
|
success: boolean;
|
|
56
|
+
/** Present when success is false (native structured failure). */
|
|
57
|
+
error?: string;
|
|
56
58
|
detectedModels: Array<{ type: string; modelDir: string }>;
|
|
57
59
|
modelType?: string;
|
|
58
60
|
decodingMethod?: string;
|
|
@@ -131,6 +133,7 @@ export interface Spec extends TurboModule {
|
|
|
131
133
|
* @param instanceId - Unique ID for this engine instance (from createStreamingSTT)
|
|
132
134
|
* @param options - All init options (modelDir, modelType, enableEndpoint, decodingMethod, maxActivePaths, and optional endpoint/rule params).
|
|
133
135
|
* `options.dither`: **Android** only; **iOS** ignores it (native `FeatureConfig` has no dither field).
|
|
136
|
+
* @returns `{ success: true }` on success, or `{ success: false, error?: string }` on structured native failure.
|
|
134
137
|
*/
|
|
135
138
|
initializeOnlineSttWithOptions(
|
|
136
139
|
instanceId: string,
|
|
@@ -160,7 +163,7 @@ export interface Spec extends TurboModule {
|
|
|
160
163
|
rule3MinTrailingSilence?: number;
|
|
161
164
|
rule3MinUtteranceLength?: number;
|
|
162
165
|
}
|
|
163
|
-
): Promise<{ success: boolean }>;
|
|
166
|
+
): Promise<{ success: boolean; error?: string }>;
|
|
164
167
|
|
|
165
168
|
/** Create a new stream for the given OnlineRecognizer instance. */
|
|
166
169
|
createSttStream(
|
|
@@ -249,7 +252,7 @@ export interface Spec extends TurboModule {
|
|
|
249
252
|
* @param maxNumSentences - Optional max sentences per callback (default: 1)
|
|
250
253
|
* @param silenceScale - Optional silence scale on config (default: 0.2)
|
|
251
254
|
* @param provider - Optional execution provider (e.g. 'cpu', 'coreml', 'xnnpack'; default: 'cpu')
|
|
252
|
-
* @returns Object with success boolean
|
|
255
|
+
* @returns Object with success boolean, array of detected models (each with type and modelDir), sampleRate/numSpeakers on success, and optional error when success is false.
|
|
253
256
|
*/
|
|
254
257
|
initializeTts(
|
|
255
258
|
instanceId: string,
|
|
@@ -267,6 +270,8 @@ export interface Spec extends TurboModule {
|
|
|
267
270
|
provider?: string
|
|
268
271
|
): Promise<{
|
|
269
272
|
success: boolean;
|
|
273
|
+
/** Present when success is false (native structured failure). */
|
|
274
|
+
error?: string;
|
|
270
275
|
detectedModels: Array<{ type: string; modelDir: string }>;
|
|
271
276
|
sampleRate: number;
|
|
272
277
|
numSpeakers: number;
|
|
@@ -299,7 +304,7 @@ export interface Spec extends TurboModule {
|
|
|
299
304
|
* @param noiseScale - Optional noise scale override
|
|
300
305
|
* @param noiseScaleW - Optional noise scale W override
|
|
301
306
|
* @param lengthScale - Optional length scale override
|
|
302
|
-
* @returns Object with success
|
|
307
|
+
* @returns Object with success, detectedModels, sampleRate, numSpeakers on success, and optional error when success is false.
|
|
303
308
|
*/
|
|
304
309
|
updateTtsParams(
|
|
305
310
|
instanceId: string,
|
|
@@ -308,6 +313,8 @@ export interface Spec extends TurboModule {
|
|
|
308
313
|
lengthScale?: number | null
|
|
309
314
|
): Promise<{
|
|
310
315
|
success: boolean;
|
|
316
|
+
/** Present when success is false (native structured failure). */
|
|
317
|
+
error?: string;
|
|
311
318
|
detectedModels: Array<{ type: string; modelDir: string }>;
|
|
312
319
|
sampleRate: number;
|
|
313
320
|
numSpeakers: number;
|
|
@@ -415,6 +422,77 @@ export interface Spec extends TurboModule {
|
|
|
415
422
|
*/
|
|
416
423
|
unloadTts(instanceId: string): Promise<void>;
|
|
417
424
|
|
|
425
|
+
// ==================== Speech Enhancement Methods ====================
|
|
426
|
+
|
|
427
|
+
detectEnhancementModel(
|
|
428
|
+
modelDir: string,
|
|
429
|
+
modelType?: string
|
|
430
|
+
): Promise<{
|
|
431
|
+
success: boolean;
|
|
432
|
+
error?: string;
|
|
433
|
+
detectedModels: Array<{ type: string; modelDir: string }>;
|
|
434
|
+
modelType?: string;
|
|
435
|
+
}>;
|
|
436
|
+
|
|
437
|
+
initializeEnhancement(
|
|
438
|
+
instanceId: string,
|
|
439
|
+
modelDir: string,
|
|
440
|
+
modelType?: string,
|
|
441
|
+
numThreads?: number,
|
|
442
|
+
provider?: string,
|
|
443
|
+
debug?: boolean
|
|
444
|
+
): Promise<{
|
|
445
|
+
success: boolean;
|
|
446
|
+
error?: string;
|
|
447
|
+
detectedModels: Array<{ type: string; modelDir: string }>;
|
|
448
|
+
modelType?: string;
|
|
449
|
+
sampleRate?: number;
|
|
450
|
+
}>;
|
|
451
|
+
|
|
452
|
+
enhanceFile(
|
|
453
|
+
instanceId: string,
|
|
454
|
+
inputPath: string,
|
|
455
|
+
outputPath?: string
|
|
456
|
+
): Promise<{ samples: number[]; sampleRate: number }>;
|
|
457
|
+
|
|
458
|
+
enhanceSamples(
|
|
459
|
+
instanceId: string,
|
|
460
|
+
samples: number[],
|
|
461
|
+
sampleRate: number
|
|
462
|
+
): Promise<{ samples: number[]; sampleRate: number }>;
|
|
463
|
+
|
|
464
|
+
getEnhancementSampleRate(instanceId: string): Promise<number>;
|
|
465
|
+
|
|
466
|
+
unloadEnhancement(instanceId: string): Promise<void>;
|
|
467
|
+
|
|
468
|
+
initializeOnlineEnhancement(
|
|
469
|
+
instanceId: string,
|
|
470
|
+
modelDir: string,
|
|
471
|
+
modelType?: string,
|
|
472
|
+
numThreads?: number,
|
|
473
|
+
provider?: string,
|
|
474
|
+
debug?: boolean
|
|
475
|
+
): Promise<{
|
|
476
|
+
success: boolean;
|
|
477
|
+
error?: string;
|
|
478
|
+
sampleRate?: number;
|
|
479
|
+
frameShiftInSamples?: number;
|
|
480
|
+
}>;
|
|
481
|
+
|
|
482
|
+
feedEnhancementSamples(
|
|
483
|
+
instanceId: string,
|
|
484
|
+
samples: number[],
|
|
485
|
+
sampleRate: number
|
|
486
|
+
): Promise<{ samples: number[]; sampleRate: number }>;
|
|
487
|
+
|
|
488
|
+
flushOnlineEnhancement(
|
|
489
|
+
instanceId: string
|
|
490
|
+
): Promise<{ samples: number[]; sampleRate: number }>;
|
|
491
|
+
|
|
492
|
+
resetOnlineEnhancement(instanceId: string): Promise<void>;
|
|
493
|
+
|
|
494
|
+
unloadOnlineEnhancement(instanceId: string): Promise<void>;
|
|
495
|
+
|
|
418
496
|
/**
|
|
419
497
|
* Save TTS audio samples to a WAV file.
|
|
420
498
|
* @param samples - Audio samples array
|
|
@@ -550,11 +628,18 @@ export interface Spec extends TurboModule {
|
|
|
550
628
|
/**
|
|
551
629
|
* Extract a .tar.bz2 archive to a target folder.
|
|
552
630
|
* Returns { success, path } or { success, reason }.
|
|
631
|
+
*
|
|
632
|
+
* **Android:** When `showNotificationsEnabled` is true (default), a system notification shows
|
|
633
|
+
* extraction progress. Optional `notificationTitle` / `notificationText` customize the copy.
|
|
634
|
+
* **iOS:** Notification parameters are accepted but have no effect (no extraction progress notification).
|
|
553
635
|
*/
|
|
554
636
|
extractTarBz2(
|
|
555
637
|
sourcePath: string,
|
|
556
638
|
targetPath: string,
|
|
557
|
-
force: boolean
|
|
639
|
+
force: boolean,
|
|
640
|
+
showNotificationsEnabled?: boolean,
|
|
641
|
+
notificationTitle?: string,
|
|
642
|
+
notificationText?: string
|
|
558
643
|
): Promise<{
|
|
559
644
|
success: boolean;
|
|
560
645
|
path?: string;
|
|
@@ -570,11 +655,16 @@ export interface Spec extends TurboModule {
|
|
|
570
655
|
/**
|
|
571
656
|
* Extract a .tar.zst (or .zst) archive to a target folder.
|
|
572
657
|
* Returns { success, path } or { success, reason }.
|
|
658
|
+
*
|
|
659
|
+
* **Android:** Same notification behavior as `extractTarBz2`. **iOS:** No effect.
|
|
573
660
|
*/
|
|
574
661
|
extractTarZst(
|
|
575
662
|
sourcePath: string,
|
|
576
663
|
targetPath: string,
|
|
577
|
-
force: boolean
|
|
664
|
+
force: boolean,
|
|
665
|
+
showNotificationsEnabled?: boolean,
|
|
666
|
+
notificationTitle?: string,
|
|
667
|
+
notificationText?: string
|
|
578
668
|
): Promise<{
|
|
579
669
|
success: boolean;
|
|
580
670
|
path?: string;
|
|
@@ -601,11 +691,15 @@ export interface Spec extends TurboModule {
|
|
|
601
691
|
/**
|
|
602
692
|
* Extract a .tar.zst archive from Android assets (AssetManager) to a target folder. Android only.
|
|
603
693
|
* Streams from asset; no copy of the archive to disk. Used when PAD pack is APK_ASSETS.
|
|
694
|
+
* Notification options match `extractTarZst` (Android only).
|
|
604
695
|
*/
|
|
605
696
|
extractTarZstFromAsset(
|
|
606
697
|
assetPath: string,
|
|
607
698
|
targetPath: string,
|
|
608
|
-
force: boolean
|
|
699
|
+
force: boolean,
|
|
700
|
+
showNotificationsEnabled?: boolean,
|
|
701
|
+
notificationTitle?: string,
|
|
702
|
+
notificationText?: string
|
|
609
703
|
): Promise<{
|
|
610
704
|
success: boolean;
|
|
611
705
|
path?: string;
|
|
@@ -616,11 +710,15 @@ export interface Spec extends TurboModule {
|
|
|
616
710
|
/**
|
|
617
711
|
* Extract a .tar.bz2 archive from Android assets (AssetManager) to a target folder. Android only.
|
|
618
712
|
* Streams from asset; no copy of the archive to disk. Used when PAD pack is APK_ASSETS.
|
|
713
|
+
* Notification options match `extractTarBz2` (Android only).
|
|
619
714
|
*/
|
|
620
715
|
extractTarBz2FromAsset(
|
|
621
716
|
assetPath: string,
|
|
622
717
|
targetPath: string,
|
|
623
|
-
force: boolean
|
|
718
|
+
force: boolean,
|
|
719
|
+
showNotificationsEnabled?: boolean,
|
|
720
|
+
notificationTitle?: string,
|
|
721
|
+
notificationText?: string
|
|
624
722
|
): Promise<{
|
|
625
723
|
success: boolean;
|
|
626
724
|
path?: string;
|
|
@@ -18,12 +18,11 @@ import {
|
|
|
18
18
|
getModelsBaseDir,
|
|
19
19
|
getModelDir,
|
|
20
20
|
getManifestPath,
|
|
21
|
-
getNativeAssetExtractedModelDir,
|
|
22
21
|
getReadyMarkerPath,
|
|
23
22
|
getTarArchivePath,
|
|
24
23
|
getOnnxPath,
|
|
25
24
|
} from './paths';
|
|
26
|
-
import { resolveActualModelDir
|
|
25
|
+
import { resolveActualModelDir } from './validation';
|
|
27
26
|
import { emitModelsListUpdated } from './downloadEvents';
|
|
28
27
|
import { clearMemoryCacheForCategory } from './registry';
|
|
29
28
|
|
|
@@ -211,7 +210,6 @@ export async function deleteModelByCategory(
|
|
|
211
210
|
if (await exists(onnxPath)) {
|
|
212
211
|
await unlink(onnxPath);
|
|
213
212
|
}
|
|
214
|
-
await removeDirectoryRecursive(getNativeAssetExtractedModelDir(id));
|
|
215
213
|
const list = await listDownloadedModelsByCategory<ModelMetaBase>(category);
|
|
216
214
|
emitModelsListUpdated(category, list);
|
|
217
215
|
}
|