From 050df2a357f8bf5d95ce90cf5c18968048019ea8 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Mon, 17 Feb 2025 12:24:52 +0800 Subject: [PATCH] Add JavaScript API (node-addon) for FireRedAsr (#1873) --- .github/scripts/test-nodejs-addon-npm.sh | 8 +++ .../src/main/cpp/non-streaming-asr.cc | 21 ++++++++ nodejs-addon-examples/README.md | 10 ++++ .../test_asr_non_streaming_fire_red_asr.js | 49 +++++++++++++++++++ .../test_asr_non_streaming_moonshine.js | 4 +- .../test_asr_non_streaming_nemo_ctc.js | 4 +- .../test_asr_non_streaming_paraformer.js | 4 +- .../test_asr_non_streaming_paraformer_itn.js | 4 +- .../test_asr_non_streaming_sense_voice.js | 4 +- .../test_asr_non_streaming_transducer.js | 4 +- .../test_asr_non_streaming_whisper.js | 4 +- .../test_asr_streaming_ctc.js | 4 +- .../test_asr_streaming_ctc_hlg.js | 4 +- .../test_asr_streaming_paraformer.js | 4 +- .../test_asr_streaming_transducer.js | 4 +- .../test_asr_streaming_transducer_itn.js | 4 +- .../test_audio_tagging_ced.js | 4 +- .../test_audio_tagging_zipformer.js | 4 +- .../test_keyword_spotter_transducer.js | 4 +- .../test_tts_non_streaming_kokoro_en.js | 4 +- .../test_tts_non_streaming_kokoro_zh_en.js | 4 +- ...est_tts_non_streaming_matcha_icefall_en.js | 4 +- ...est_tts_non_streaming_matcha_icefall_zh.js | 4 +- .../test_tts_non_streaming_vits_coqui_de.js | 4 +- .../test_tts_non_streaming_vits_piper_en.js | 4 +- ...test_tts_non_streaming_vits_zh_aishell3.js | 4 +- .../test_tts_non_streaming_vits_zh_ll.js | 4 +- 27 files changed, 134 insertions(+), 46 deletions(-) create mode 100644 nodejs-addon-examples/test_asr_non_streaming_fire_red_asr.js diff --git a/.github/scripts/test-nodejs-addon-npm.sh b/.github/scripts/test-nodejs-addon-npm.sh index 53db04d7..37f05508 100755 --- a/.github/scripts/test-nodejs-addon-npm.sh +++ b/.github/scripts/test-nodejs-addon-npm.sh @@ -10,6 +10,14 @@ arch=$(node -p "require('os').arch()") platform=$(node -p "require('os').platform()") node_version=$(node -p "process.versions.node.split('.')[0]") +echo "----------non-streaming asr FireRedAsr----------" +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 +tar xvf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 +rm sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 + +node ./test_asr_non_streaming_fire_red_asr.js +rm -rf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16 + echo "----------non-streaming asr moonshine + vad----------" curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 tar xvf sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 diff --git a/harmony-os/SherpaOnnxHar/sherpa_onnx/src/main/cpp/non-streaming-asr.cc b/harmony-os/SherpaOnnxHar/sherpa_onnx/src/main/cpp/non-streaming-asr.cc index a34139aa..6ede4893 100644 --- a/harmony-os/SherpaOnnxHar/sherpa_onnx/src/main/cpp/non-streaming-asr.cc +++ b/harmony-os/SherpaOnnxHar/sherpa_onnx/src/main/cpp/non-streaming-asr.cc @@ -80,6 +80,23 @@ static SherpaOnnxOfflineWhisperModelConfig GetOfflineWhisperModelConfig( return c; } +static SherpaOnnxOfflineFireRedAsrModelConfig GetOfflineFireRedAsrModelConfig( + Napi::Object obj) { + SherpaOnnxOfflineFireRedAsrModelConfig c; + memset(&c, 0, sizeof(c)); + + if (!obj.Has("fireRedAsr") || !obj.Get("fireRedAsr").IsObject()) { + return c; + } + + Napi::Object o = obj.Get("fireRedAsr").As(); + + SHERPA_ONNX_ASSIGN_ATTR_STR(encoder, encoder); + SHERPA_ONNX_ASSIGN_ATTR_STR(decoder, decoder); + + return c; +} + static SherpaOnnxOfflineMoonshineModelConfig GetOfflineMoonshineModelConfig( Napi::Object obj) { SherpaOnnxOfflineMoonshineModelConfig c; @@ -150,6 +167,7 @@ static SherpaOnnxOfflineModelConfig GetOfflineModelConfig(Napi::Object obj) { c.tdnn = GetOfflineTdnnModelConfig(o); c.sense_voice = GetOfflineSenseVoiceModelConfig(o); c.moonshine = GetOfflineMoonshineModelConfig(o); + c.fire_red_asr = GetOfflineFireRedAsrModelConfig(o); SHERPA_ONNX_ASSIGN_ATTR_STR(tokens, tokens); SHERPA_ONNX_ASSIGN_ATTR_INT32(num_threads, numThreads); @@ -271,6 +289,9 @@ CreateOfflineRecognizerWrapper(const Napi::CallbackInfo &info) { SHERPA_ONNX_DELETE_C_STR(c.model_config.moonshine.uncached_decoder); SHERPA_ONNX_DELETE_C_STR(c.model_config.moonshine.cached_decoder); + SHERPA_ONNX_DELETE_C_STR(c.model_config.fire_red_asr.encoder); + SHERPA_ONNX_DELETE_C_STR(c.model_config.fire_red_asr.decoder); + SHERPA_ONNX_DELETE_C_STR(c.model_config.tokens); SHERPA_ONNX_DELETE_C_STR(c.model_config.provider); SHERPA_ONNX_DELETE_C_STR(c.model_config.model_type); diff --git a/nodejs-addon-examples/README.md b/nodejs-addon-examples/README.md index 856b5c5d..3054e6a1 100644 --- a/nodejs-addon-examples/README.md +++ b/nodejs-addon-examples/README.md @@ -110,6 +110,7 @@ The following tables list the examples in this folder. |File| Description| |---|---| |[./test_asr_non_streaming_transducer.js](./test_asr_non_streaming_transducer.js)|Non-streaming speech recognition from a file with a Zipformer transducer model| +|[./test_asr_non_streaming_fire_red_asr.js](./test_asr_non_streaming_fire_red_asr.js)| Non-streaming speech recognition from a file using [FireRedAsr](https://github.com/FireRedTeam/FireRedASR)| |[./test_asr_non_streaming_whisper.js](./test_asr_non_streaming_whisper.js)| Non-streaming speech recognition from a file using [Whisper](https://github.com/openai/whisper)| |[./test_vad_with_non_streaming_asr_whisper.js](./test_vad_with_non_streaming_asr_whisper.js)| Non-streaming speech recognition from a file using [Whisper](https://github.com/openai/whisper) + [Silero VAD](https://github.com/snakers4/silero-vad)| |[./test_asr_non_streaming_moonshine.js](./test_asr_non_streaming_moonshine.js)|Non-streaming speech recognition from a file using [Moonshine](https://github.com/usefulsensors/moonshine)| @@ -253,6 +254,15 @@ npm install naudiodon2 node ./test_vad_asr_non_streaming_transducer_microphone.js ``` +### Non-streaming speech recognition with FireRedAsr +```bash +wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 +tar xvf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 +rm sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2 + +node ./test_asr_non_streaming_fire_red_asr.js +``` + ### Non-streaming speech recognition with Whisper ```bash diff --git a/nodejs-addon-examples/test_asr_non_streaming_fire_red_asr.js b/nodejs-addon-examples/test_asr_non_streaming_fire_red_asr.js new file mode 100644 index 00000000..1b64e2d1 --- /dev/null +++ b/nodejs-addon-examples/test_asr_non_streaming_fire_red_asr.js @@ -0,0 +1,49 @@ +// Copyright (c) 2025 Xiaomi Corporation +const sherpa_onnx = require('sherpa-onnx-node'); + +// Please download test files from +// https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models +const config = { + 'featConfig': { + 'sampleRate': 16000, + 'featureDim': 80, + }, + 'modelConfig': { + 'fireRedAsr': { + 'encoder': + './sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/encoder.int8.onnx', + 'decoder': + './sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/decoder.int8.onnx', + }, + 'tokens': './sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/tokens.txt', + 'numThreads': 2, + 'provider': 'cpu', + 'debug': 1, + } +}; + +const waveFilename = + './sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/test_wavs/0.wav'; + +const recognizer = new sherpa_onnx.OfflineRecognizer(config); +console.log('Started') +let start = Date.now(); +const stream = recognizer.createStream(); +const wave = sherpa_onnx.readWave(waveFilename); +stream.acceptWaveform({sampleRate: wave.sampleRate, samples: wave.samples}); + +recognizer.decode(stream); +result = recognizer.getResult(stream) +let stop = Date.now(); +console.log('Done') + +const elapsed_seconds = (stop - start) / 1000; +const duration = wave.samples.length / wave.sampleRate; +const real_time_factor = elapsed_seconds / duration; +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') +console.log( + `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, + real_time_factor.toFixed(3)) +console.log(waveFilename) +console.log('result\n', result) diff --git a/nodejs-addon-examples/test_asr_non_streaming_moonshine.js b/nodejs-addon-examples/test_asr_non_streaming_moonshine.js index 9e676b8c..a0792a24 100644 --- a/nodejs-addon-examples/test_asr_non_streaming_moonshine.js +++ b/nodejs-addon-examples/test_asr_non_streaming_moonshine.js @@ -41,8 +41,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_non_streaming_nemo_ctc.js b/nodejs-addon-examples/test_asr_non_streaming_nemo_ctc.js index 424c99e7..5130a39f 100644 --- a/nodejs-addon-examples/test_asr_non_streaming_nemo_ctc.js +++ b/nodejs-addon-examples/test_asr_non_streaming_nemo_ctc.js @@ -39,8 +39,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_non_streaming_paraformer.js b/nodejs-addon-examples/test_asr_non_streaming_paraformer.js index 6fcc434e..157ccdea 100644 --- a/nodejs-addon-examples/test_asr_non_streaming_paraformer.js +++ b/nodejs-addon-examples/test_asr_non_streaming_paraformer.js @@ -37,8 +37,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_non_streaming_paraformer_itn.js b/nodejs-addon-examples/test_asr_non_streaming_paraformer_itn.js index 8baa2a0b..b4a693f5 100644 --- a/nodejs-addon-examples/test_asr_non_streaming_paraformer_itn.js +++ b/nodejs-addon-examples/test_asr_non_streaming_paraformer_itn.js @@ -39,8 +39,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_non_streaming_sense_voice.js b/nodejs-addon-examples/test_asr_non_streaming_sense_voice.js index 116024eb..b573cf29 100644 --- a/nodejs-addon-examples/test_asr_non_streaming_sense_voice.js +++ b/nodejs-addon-examples/test_asr_non_streaming_sense_voice.js @@ -54,8 +54,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_non_streaming_transducer.js b/nodejs-addon-examples/test_asr_non_streaming_transducer.js index 5f94e8e6..3d6dd2ac 100644 --- a/nodejs-addon-examples/test_asr_non_streaming_transducer.js +++ b/nodejs-addon-examples/test_asr_non_streaming_transducer.js @@ -41,8 +41,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_non_streaming_whisper.js b/nodejs-addon-examples/test_asr_non_streaming_whisper.js index 5ba023cc..7c7c3ca7 100644 --- a/nodejs-addon-examples/test_asr_non_streaming_whisper.js +++ b/nodejs-addon-examples/test_asr_non_streaming_whisper.js @@ -37,8 +37,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_streaming_ctc.js b/nodejs-addon-examples/test_asr_streaming_ctc.js index 8e9f7706..e5936a31 100644 --- a/nodejs-addon-examples/test_asr_streaming_ctc.js +++ b/nodejs-addon-examples/test_asr_streaming_ctc.js @@ -44,8 +44,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_streaming_ctc_hlg.js b/nodejs-addon-examples/test_asr_streaming_ctc_hlg.js index bc27d5a1..3537663c 100644 --- a/nodejs-addon-examples/test_asr_streaming_ctc_hlg.js +++ b/nodejs-addon-examples/test_asr_streaming_ctc_hlg.js @@ -47,8 +47,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_streaming_paraformer.js b/nodejs-addon-examples/test_asr_streaming_paraformer.js index 77e3050c..a03453dd 100644 --- a/nodejs-addon-examples/test_asr_streaming_paraformer.js +++ b/nodejs-addon-examples/test_asr_streaming_paraformer.js @@ -45,8 +45,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_streaming_transducer.js b/nodejs-addon-examples/test_asr_streaming_transducer.js index a17dfcf1..3bb3de7c 100644 --- a/nodejs-addon-examples/test_asr_streaming_transducer.js +++ b/nodejs-addon-examples/test_asr_streaming_transducer.js @@ -48,8 +48,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_asr_streaming_transducer_itn.js b/nodejs-addon-examples/test_asr_streaming_transducer_itn.js index b8dfb6cb..713db644 100644 --- a/nodejs-addon-examples/test_asr_streaming_transducer_itn.js +++ b/nodejs-addon-examples/test_asr_streaming_transducer_itn.js @@ -50,8 +50,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_audio_tagging_ced.js b/nodejs-addon-examples/test_audio_tagging_ced.js index 5f8058d5..a7666f03 100644 --- a/nodejs-addon-examples/test_audio_tagging_ced.js +++ b/nodejs-addon-examples/test_audio_tagging_ced.js @@ -54,8 +54,8 @@ for (let filename of testWaves) { for (let e of events) { console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`); } - console.log('Wave duration', duration.toFixed(3), 'secodns') - console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') + console.log('Wave duration', duration.toFixed(3), 'seconds') + console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_audio_tagging_zipformer.js b/nodejs-addon-examples/test_audio_tagging_zipformer.js index 349384bc..692cc63f 100644 --- a/nodejs-addon-examples/test_audio_tagging_zipformer.js +++ b/nodejs-addon-examples/test_audio_tagging_zipformer.js @@ -57,8 +57,8 @@ for (let filename of testWaves) { for (let e of events) { console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`); } - console.log('Wave duration', duration.toFixed(3), 'secodns') - console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') + console.log('Wave duration', duration.toFixed(3), 'seconds') + console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_keyword_spotter_transducer.js b/nodejs-addon-examples/test_keyword_spotter_transducer.js index 9e05a911..d1b70e0e 100644 --- a/nodejs-addon-examples/test_keyword_spotter_transducer.js +++ b/nodejs-addon-examples/test_keyword_spotter_transducer.js @@ -55,8 +55,8 @@ console.log('Done') const elapsed_seconds = (stop - start) / 1000; const duration = wave.samples.length / wave.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_tts_non_streaming_kokoro_en.js b/nodejs-addon-examples/test_tts_non_streaming_kokoro_en.js index 84b03982..6aa45576 100644 --- a/nodejs-addon-examples/test_tts_non_streaming_kokoro_en.js +++ b/nodejs-addon-examples/test_tts_non_streaming_kokoro_en.js @@ -34,8 +34,8 @@ let stop = Date.now(); const elapsed_seconds = (stop - start) / 1000; const duration = audio.samples.length / audio.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_tts_non_streaming_kokoro_zh_en.js b/nodejs-addon-examples/test_tts_non_streaming_kokoro_zh_en.js index cd703727..dddcdd4f 100644 --- a/nodejs-addon-examples/test_tts_non_streaming_kokoro_zh_en.js +++ b/nodejs-addon-examples/test_tts_non_streaming_kokoro_zh_en.js @@ -36,8 +36,8 @@ let stop = Date.now(); const elapsed_seconds = (stop - start) / 1000; const duration = audio.samples.length / audio.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_tts_non_streaming_matcha_icefall_en.js b/nodejs-addon-examples/test_tts_non_streaming_matcha_icefall_en.js index 8c45d1dd..4fb4e60a 100644 --- a/nodejs-addon-examples/test_tts_non_streaming_matcha_icefall_en.js +++ b/nodejs-addon-examples/test_tts_non_streaming_matcha_icefall_en.js @@ -35,8 +35,8 @@ let stop = Date.now(); const elapsed_seconds = (stop - start) / 1000; const duration = audio.samples.length / audio.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_tts_non_streaming_matcha_icefall_zh.js b/nodejs-addon-examples/test_tts_non_streaming_matcha_icefall_zh.js index 1f667e3d..0b870745 100644 --- a/nodejs-addon-examples/test_tts_non_streaming_matcha_icefall_zh.js +++ b/nodejs-addon-examples/test_tts_non_streaming_matcha_icefall_zh.js @@ -37,8 +37,8 @@ let stop = Date.now(); const elapsed_seconds = (stop - start) / 1000; const duration = audio.samples.length / audio.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_tts_non_streaming_vits_coqui_de.js b/nodejs-addon-examples/test_tts_non_streaming_vits_coqui_de.js index 89a913fd..7f673a71 100644 --- a/nodejs-addon-examples/test_tts_non_streaming_vits_coqui_de.js +++ b/nodejs-addon-examples/test_tts_non_streaming_vits_coqui_de.js @@ -34,8 +34,8 @@ let stop = Date.now(); const elapsed_seconds = (stop - start) / 1000; const duration = audio.samples.length / audio.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_tts_non_streaming_vits_piper_en.js b/nodejs-addon-examples/test_tts_non_streaming_vits_piper_en.js index 6d18fb07..5cd6257e 100644 --- a/nodejs-addon-examples/test_tts_non_streaming_vits_piper_en.js +++ b/nodejs-addon-examples/test_tts_non_streaming_vits_piper_en.js @@ -32,8 +32,8 @@ let stop = Date.now(); const elapsed_seconds = (stop - start) / 1000; const duration = audio.samples.length / audio.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_tts_non_streaming_vits_zh_aishell3.js b/nodejs-addon-examples/test_tts_non_streaming_vits_zh_aishell3.js index 8409bca5..4d27e79a 100644 --- a/nodejs-addon-examples/test_tts_non_streaming_vits_zh_aishell3.js +++ b/nodejs-addon-examples/test_tts_non_streaming_vits_zh_aishell3.js @@ -34,8 +34,8 @@ let stop = Date.now(); const elapsed_seconds = (stop - start) / 1000; const duration = audio.samples.length / audio.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3)) diff --git a/nodejs-addon-examples/test_tts_non_streaming_vits_zh_ll.js b/nodejs-addon-examples/test_tts_non_streaming_vits_zh_ll.js index b739c391..ee1198e3 100644 --- a/nodejs-addon-examples/test_tts_non_streaming_vits_zh_ll.js +++ b/nodejs-addon-examples/test_tts_non_streaming_vits_zh_ll.js @@ -34,8 +34,8 @@ let stop = Date.now(); const elapsed_seconds = (stop - start) / 1000; const duration = audio.samples.length / audio.sampleRate; const real_time_factor = elapsed_seconds / duration; -console.log('Wave duration', duration.toFixed(3), 'secodns') -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') +console.log('Wave duration', duration.toFixed(3), 'seconds') +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds') console.log( `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, real_time_factor.toFixed(3))