Fangjun Kuang
Committed by GitHub

Add JavaScript API (node-addon) for FireRedAsr (#1873)

正在显示 27 个修改的文件 包含 134 行增加46 行删除
@@ -10,6 +10,14 @@ arch=$(node -p "require('os').arch()") @@ -10,6 +10,14 @@ arch=$(node -p "require('os').arch()")
10 platform=$(node -p "require('os').platform()") 10 platform=$(node -p "require('os').platform()")
11 node_version=$(node -p "process.versions.node.split('.')[0]") 11 node_version=$(node -p "process.versions.node.split('.')[0]")
12 12
  13 +echo "----------non-streaming asr FireRedAsr----------"
  14 +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
  15 +tar xvf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2
  16 +rm sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2
  17 +
  18 +node ./test_asr_non_streaming_fire_red_asr.js
  19 +rm -rf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16
  20 +
13 echo "----------non-streaming asr moonshine + vad----------" 21 echo "----------non-streaming asr moonshine + vad----------"
14 curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 22 curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-tiny-en-int8.tar.bz2
15 tar xvf sherpa-onnx-moonshine-tiny-en-int8.tar.bz2 23 tar xvf sherpa-onnx-moonshine-tiny-en-int8.tar.bz2
@@ -80,6 +80,23 @@ static SherpaOnnxOfflineWhisperModelConfig GetOfflineWhisperModelConfig( @@ -80,6 +80,23 @@ static SherpaOnnxOfflineWhisperModelConfig GetOfflineWhisperModelConfig(
80 return c; 80 return c;
81 } 81 }
82 82
  83 +static SherpaOnnxOfflineFireRedAsrModelConfig GetOfflineFireRedAsrModelConfig(
  84 + Napi::Object obj) {
  85 + SherpaOnnxOfflineFireRedAsrModelConfig c;
  86 + memset(&c, 0, sizeof(c));
  87 +
  88 + if (!obj.Has("fireRedAsr") || !obj.Get("fireRedAsr").IsObject()) {
  89 + return c;
  90 + }
  91 +
  92 + Napi::Object o = obj.Get("fireRedAsr").As<Napi::Object>();
  93 +
  94 + SHERPA_ONNX_ASSIGN_ATTR_STR(encoder, encoder);
  95 + SHERPA_ONNX_ASSIGN_ATTR_STR(decoder, decoder);
  96 +
  97 + return c;
  98 +}
  99 +
83 static SherpaOnnxOfflineMoonshineModelConfig GetOfflineMoonshineModelConfig( 100 static SherpaOnnxOfflineMoonshineModelConfig GetOfflineMoonshineModelConfig(
84 Napi::Object obj) { 101 Napi::Object obj) {
85 SherpaOnnxOfflineMoonshineModelConfig c; 102 SherpaOnnxOfflineMoonshineModelConfig c;
@@ -150,6 +167,7 @@ static SherpaOnnxOfflineModelConfig GetOfflineModelConfig(Napi::Object obj) { @@ -150,6 +167,7 @@ static SherpaOnnxOfflineModelConfig GetOfflineModelConfig(Napi::Object obj) {
150 c.tdnn = GetOfflineTdnnModelConfig(o); 167 c.tdnn = GetOfflineTdnnModelConfig(o);
151 c.sense_voice = GetOfflineSenseVoiceModelConfig(o); 168 c.sense_voice = GetOfflineSenseVoiceModelConfig(o);
152 c.moonshine = GetOfflineMoonshineModelConfig(o); 169 c.moonshine = GetOfflineMoonshineModelConfig(o);
  170 + c.fire_red_asr = GetOfflineFireRedAsrModelConfig(o);
153 171
154 SHERPA_ONNX_ASSIGN_ATTR_STR(tokens, tokens); 172 SHERPA_ONNX_ASSIGN_ATTR_STR(tokens, tokens);
155 SHERPA_ONNX_ASSIGN_ATTR_INT32(num_threads, numThreads); 173 SHERPA_ONNX_ASSIGN_ATTR_INT32(num_threads, numThreads);
@@ -271,6 +289,9 @@ CreateOfflineRecognizerWrapper(const Napi::CallbackInfo &info) { @@ -271,6 +289,9 @@ CreateOfflineRecognizerWrapper(const Napi::CallbackInfo &info) {
271 SHERPA_ONNX_DELETE_C_STR(c.model_config.moonshine.uncached_decoder); 289 SHERPA_ONNX_DELETE_C_STR(c.model_config.moonshine.uncached_decoder);
272 SHERPA_ONNX_DELETE_C_STR(c.model_config.moonshine.cached_decoder); 290 SHERPA_ONNX_DELETE_C_STR(c.model_config.moonshine.cached_decoder);
273 291
  292 + SHERPA_ONNX_DELETE_C_STR(c.model_config.fire_red_asr.encoder);
  293 + SHERPA_ONNX_DELETE_C_STR(c.model_config.fire_red_asr.decoder);
  294 +
274 SHERPA_ONNX_DELETE_C_STR(c.model_config.tokens); 295 SHERPA_ONNX_DELETE_C_STR(c.model_config.tokens);
275 SHERPA_ONNX_DELETE_C_STR(c.model_config.provider); 296 SHERPA_ONNX_DELETE_C_STR(c.model_config.provider);
276 SHERPA_ONNX_DELETE_C_STR(c.model_config.model_type); 297 SHERPA_ONNX_DELETE_C_STR(c.model_config.model_type);
@@ -110,6 +110,7 @@ The following tables list the examples in this folder. @@ -110,6 +110,7 @@ The following tables list the examples in this folder.
110 |File| Description| 110 |File| Description|
111 |---|---| 111 |---|---|
112 |[./test_asr_non_streaming_transducer.js](./test_asr_non_streaming_transducer.js)|Non-streaming speech recognition from a file with a Zipformer transducer model| 112 |[./test_asr_non_streaming_transducer.js](./test_asr_non_streaming_transducer.js)|Non-streaming speech recognition from a file with a Zipformer transducer model|
  113 +|[./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)|
113 |[./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)| 114 |[./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)|
114 |[./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)| 115 |[./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)|
115 |[./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)| 116 |[./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 @@ -253,6 +254,15 @@ npm install naudiodon2
253 node ./test_vad_asr_non_streaming_transducer_microphone.js 254 node ./test_vad_asr_non_streaming_transducer_microphone.js
254 ``` 255 ```
255 256
  257 +### Non-streaming speech recognition with FireRedAsr
  258 +```bash
  259 +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
  260 +tar xvf sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2
  261 +rm sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16.tar.bz2
  262 +
  263 +node ./test_asr_non_streaming_fire_red_asr.js
  264 +```
  265 +
256 ### Non-streaming speech recognition with Whisper 266 ### Non-streaming speech recognition with Whisper
257 267
258 ```bash 268 ```bash
  1 +// Copyright (c) 2025 Xiaomi Corporation
  2 +const sherpa_onnx = require('sherpa-onnx-node');
  3 +
  4 +// Please download test files from
  5 +// https://github.com/k2-fsa/sherpa-onnx/releases/tag/asr-models
  6 +const config = {
  7 + 'featConfig': {
  8 + 'sampleRate': 16000,
  9 + 'featureDim': 80,
  10 + },
  11 + 'modelConfig': {
  12 + 'fireRedAsr': {
  13 + 'encoder':
  14 + './sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/encoder.int8.onnx',
  15 + 'decoder':
  16 + './sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/decoder.int8.onnx',
  17 + },
  18 + 'tokens': './sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/tokens.txt',
  19 + 'numThreads': 2,
  20 + 'provider': 'cpu',
  21 + 'debug': 1,
  22 + }
  23 +};
  24 +
  25 +const waveFilename =
  26 + './sherpa-onnx-fire-red-asr-large-zh_en-2025-02-16/test_wavs/0.wav';
  27 +
  28 +const recognizer = new sherpa_onnx.OfflineRecognizer(config);
  29 +console.log('Started')
  30 +let start = Date.now();
  31 +const stream = recognizer.createStream();
  32 +const wave = sherpa_onnx.readWave(waveFilename);
  33 +stream.acceptWaveform({sampleRate: wave.sampleRate, samples: wave.samples});
  34 +
  35 +recognizer.decode(stream);
  36 +result = recognizer.getResult(stream)
  37 +let stop = Date.now();
  38 +console.log('Done')
  39 +
  40 +const elapsed_seconds = (stop - start) / 1000;
  41 +const duration = wave.samples.length / wave.sampleRate;
  42 +const real_time_factor = elapsed_seconds / duration;
  43 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  44 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
  45 +console.log(
  46 + `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
  47 + real_time_factor.toFixed(3))
  48 +console.log(waveFilename)
  49 +console.log('result\n', result)
@@ -41,8 +41,8 @@ console.log('Done') @@ -41,8 +41,8 @@ console.log('Done')
41 const elapsed_seconds = (stop - start) / 1000; 41 const elapsed_seconds = (stop - start) / 1000;
42 const duration = wave.samples.length / wave.sampleRate; 42 const duration = wave.samples.length / wave.sampleRate;
43 const real_time_factor = elapsed_seconds / duration; 43 const real_time_factor = elapsed_seconds / duration;
44 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
45 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 44 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  45 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
46 console.log( 46 console.log(
47 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 47 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
48 real_time_factor.toFixed(3)) 48 real_time_factor.toFixed(3))
@@ -39,8 +39,8 @@ console.log('Done') @@ -39,8 +39,8 @@ console.log('Done')
39 const elapsed_seconds = (stop - start) / 1000; 39 const elapsed_seconds = (stop - start) / 1000;
40 const duration = wave.samples.length / wave.sampleRate; 40 const duration = wave.samples.length / wave.sampleRate;
41 const real_time_factor = elapsed_seconds / duration; 41 const real_time_factor = elapsed_seconds / duration;
42 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
43 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 42 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  43 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
44 console.log( 44 console.log(
45 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 45 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
46 real_time_factor.toFixed(3)) 46 real_time_factor.toFixed(3))
@@ -37,8 +37,8 @@ console.log('Done') @@ -37,8 +37,8 @@ console.log('Done')
37 const elapsed_seconds = (stop - start) / 1000; 37 const elapsed_seconds = (stop - start) / 1000;
38 const duration = wave.samples.length / wave.sampleRate; 38 const duration = wave.samples.length / wave.sampleRate;
39 const real_time_factor = elapsed_seconds / duration; 39 const real_time_factor = elapsed_seconds / duration;
40 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
41 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 40 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  41 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
42 console.log( 42 console.log(
43 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 43 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
44 real_time_factor.toFixed(3)) 44 real_time_factor.toFixed(3))
@@ -39,8 +39,8 @@ console.log('Done') @@ -39,8 +39,8 @@ console.log('Done')
39 const elapsed_seconds = (stop - start) / 1000; 39 const elapsed_seconds = (stop - start) / 1000;
40 const duration = wave.samples.length / wave.sampleRate; 40 const duration = wave.samples.length / wave.sampleRate;
41 const real_time_factor = elapsed_seconds / duration; 41 const real_time_factor = elapsed_seconds / duration;
42 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
43 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 42 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  43 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
44 console.log( 44 console.log(
45 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 45 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
46 real_time_factor.toFixed(3)) 46 real_time_factor.toFixed(3))
@@ -54,8 +54,8 @@ console.log('Done') @@ -54,8 +54,8 @@ console.log('Done')
54 const elapsed_seconds = (stop - start) / 1000; 54 const elapsed_seconds = (stop - start) / 1000;
55 const duration = wave.samples.length / wave.sampleRate; 55 const duration = wave.samples.length / wave.sampleRate;
56 const real_time_factor = elapsed_seconds / duration; 56 const real_time_factor = elapsed_seconds / duration;
57 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
58 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 57 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  58 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
59 console.log( 59 console.log(
60 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 60 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
61 real_time_factor.toFixed(3)) 61 real_time_factor.toFixed(3))
@@ -41,8 +41,8 @@ console.log('Done') @@ -41,8 +41,8 @@ console.log('Done')
41 const elapsed_seconds = (stop - start) / 1000; 41 const elapsed_seconds = (stop - start) / 1000;
42 const duration = wave.samples.length / wave.sampleRate; 42 const duration = wave.samples.length / wave.sampleRate;
43 const real_time_factor = elapsed_seconds / duration; 43 const real_time_factor = elapsed_seconds / duration;
44 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
45 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 44 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  45 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
46 console.log( 46 console.log(
47 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 47 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
48 real_time_factor.toFixed(3)) 48 real_time_factor.toFixed(3))
@@ -37,8 +37,8 @@ console.log('Done') @@ -37,8 +37,8 @@ console.log('Done')
37 const elapsed_seconds = (stop - start) / 1000; 37 const elapsed_seconds = (stop - start) / 1000;
38 const duration = wave.samples.length / wave.sampleRate; 38 const duration = wave.samples.length / wave.sampleRate;
39 const real_time_factor = elapsed_seconds / duration; 39 const real_time_factor = elapsed_seconds / duration;
40 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
41 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 40 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  41 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
42 console.log( 42 console.log(
43 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 43 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
44 real_time_factor.toFixed(3)) 44 real_time_factor.toFixed(3))
@@ -44,8 +44,8 @@ console.log('Done') @@ -44,8 +44,8 @@ console.log('Done')
44 const elapsed_seconds = (stop - start) / 1000; 44 const elapsed_seconds = (stop - start) / 1000;
45 const duration = wave.samples.length / wave.sampleRate; 45 const duration = wave.samples.length / wave.sampleRate;
46 const real_time_factor = elapsed_seconds / duration; 46 const real_time_factor = elapsed_seconds / duration;
47 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
48 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 47 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  48 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
49 console.log( 49 console.log(
50 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 50 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
51 real_time_factor.toFixed(3)) 51 real_time_factor.toFixed(3))
@@ -47,8 +47,8 @@ console.log('Done') @@ -47,8 +47,8 @@ console.log('Done')
47 const elapsed_seconds = (stop - start) / 1000; 47 const elapsed_seconds = (stop - start) / 1000;
48 const duration = wave.samples.length / wave.sampleRate; 48 const duration = wave.samples.length / wave.sampleRate;
49 const real_time_factor = elapsed_seconds / duration; 49 const real_time_factor = elapsed_seconds / duration;
50 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
51 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 50 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  51 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
52 console.log( 52 console.log(
53 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 53 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
54 real_time_factor.toFixed(3)) 54 real_time_factor.toFixed(3))
@@ -45,8 +45,8 @@ console.log('Done') @@ -45,8 +45,8 @@ console.log('Done')
45 const elapsed_seconds = (stop - start) / 1000; 45 const elapsed_seconds = (stop - start) / 1000;
46 const duration = wave.samples.length / wave.sampleRate; 46 const duration = wave.samples.length / wave.sampleRate;
47 const real_time_factor = elapsed_seconds / duration; 47 const real_time_factor = elapsed_seconds / duration;
48 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
49 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 48 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  49 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
50 console.log( 50 console.log(
51 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 51 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
52 real_time_factor.toFixed(3)) 52 real_time_factor.toFixed(3))
@@ -48,8 +48,8 @@ console.log('Done') @@ -48,8 +48,8 @@ console.log('Done')
48 const elapsed_seconds = (stop - start) / 1000; 48 const elapsed_seconds = (stop - start) / 1000;
49 const duration = wave.samples.length / wave.sampleRate; 49 const duration = wave.samples.length / wave.sampleRate;
50 const real_time_factor = elapsed_seconds / duration; 50 const real_time_factor = elapsed_seconds / duration;
51 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
52 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 51 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  52 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
53 console.log( 53 console.log(
54 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 54 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
55 real_time_factor.toFixed(3)) 55 real_time_factor.toFixed(3))
@@ -50,8 +50,8 @@ console.log('Done') @@ -50,8 +50,8 @@ console.log('Done')
50 const elapsed_seconds = (stop - start) / 1000; 50 const elapsed_seconds = (stop - start) / 1000;
51 const duration = wave.samples.length / wave.sampleRate; 51 const duration = wave.samples.length / wave.sampleRate;
52 const real_time_factor = elapsed_seconds / duration; 52 const real_time_factor = elapsed_seconds / duration;
53 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
54 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 53 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  54 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
55 console.log( 55 console.log(
56 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 56 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
57 real_time_factor.toFixed(3)) 57 real_time_factor.toFixed(3))
@@ -54,8 +54,8 @@ for (let filename of testWaves) { @@ -54,8 +54,8 @@ for (let filename of testWaves) {
54 for (let e of events) { 54 for (let e of events) {
55 console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`); 55 console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`);
56 } 56 }
57 - console.log('Wave duration', duration.toFixed(3), 'secodns')  
58 - console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 57 + console.log('Wave duration', duration.toFixed(3), 'seconds')
  58 + console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
59 console.log( 59 console.log(
60 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 60 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
61 real_time_factor.toFixed(3)) 61 real_time_factor.toFixed(3))
@@ -57,8 +57,8 @@ for (let filename of testWaves) { @@ -57,8 +57,8 @@ for (let filename of testWaves) {
57 for (let e of events) { 57 for (let e of events) {
58 console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`); 58 console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`);
59 } 59 }
60 - console.log('Wave duration', duration.toFixed(3), 'secodns')  
61 - console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 60 + console.log('Wave duration', duration.toFixed(3), 'seconds')
  61 + console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
62 console.log( 62 console.log(
63 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 63 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
64 real_time_factor.toFixed(3)) 64 real_time_factor.toFixed(3))
@@ -55,8 +55,8 @@ console.log('Done') @@ -55,8 +55,8 @@ console.log('Done')
55 const elapsed_seconds = (stop - start) / 1000; 55 const elapsed_seconds = (stop - start) / 1000;
56 const duration = wave.samples.length / wave.sampleRate; 56 const duration = wave.samples.length / wave.sampleRate;
57 const real_time_factor = elapsed_seconds / duration; 57 const real_time_factor = elapsed_seconds / duration;
58 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
59 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 58 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  59 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
60 console.log( 60 console.log(
61 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 61 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
62 real_time_factor.toFixed(3)) 62 real_time_factor.toFixed(3))
@@ -34,8 +34,8 @@ let stop = Date.now(); @@ -34,8 +34,8 @@ let stop = Date.now();
34 const elapsed_seconds = (stop - start) / 1000; 34 const elapsed_seconds = (stop - start) / 1000;
35 const duration = audio.samples.length / audio.sampleRate; 35 const duration = audio.samples.length / audio.sampleRate;
36 const real_time_factor = elapsed_seconds / duration; 36 const real_time_factor = elapsed_seconds / duration;
37 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
38 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 37 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  38 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
39 console.log( 39 console.log(
40 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 40 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
41 real_time_factor.toFixed(3)) 41 real_time_factor.toFixed(3))
@@ -36,8 +36,8 @@ let stop = Date.now(); @@ -36,8 +36,8 @@ let stop = Date.now();
36 const elapsed_seconds = (stop - start) / 1000; 36 const elapsed_seconds = (stop - start) / 1000;
37 const duration = audio.samples.length / audio.sampleRate; 37 const duration = audio.samples.length / audio.sampleRate;
38 const real_time_factor = elapsed_seconds / duration; 38 const real_time_factor = elapsed_seconds / duration;
39 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
40 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 39 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  40 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
41 console.log( 41 console.log(
42 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 42 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
43 real_time_factor.toFixed(3)) 43 real_time_factor.toFixed(3))
@@ -35,8 +35,8 @@ let stop = Date.now(); @@ -35,8 +35,8 @@ let stop = Date.now();
35 const elapsed_seconds = (stop - start) / 1000; 35 const elapsed_seconds = (stop - start) / 1000;
36 const duration = audio.samples.length / audio.sampleRate; 36 const duration = audio.samples.length / audio.sampleRate;
37 const real_time_factor = elapsed_seconds / duration; 37 const real_time_factor = elapsed_seconds / duration;
38 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
39 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 38 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  39 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
40 console.log( 40 console.log(
41 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 41 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
42 real_time_factor.toFixed(3)) 42 real_time_factor.toFixed(3))
@@ -37,8 +37,8 @@ let stop = Date.now(); @@ -37,8 +37,8 @@ let stop = Date.now();
37 const elapsed_seconds = (stop - start) / 1000; 37 const elapsed_seconds = (stop - start) / 1000;
38 const duration = audio.samples.length / audio.sampleRate; 38 const duration = audio.samples.length / audio.sampleRate;
39 const real_time_factor = elapsed_seconds / duration; 39 const real_time_factor = elapsed_seconds / duration;
40 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
41 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 40 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  41 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
42 console.log( 42 console.log(
43 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 43 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
44 real_time_factor.toFixed(3)) 44 real_time_factor.toFixed(3))
@@ -34,8 +34,8 @@ let stop = Date.now(); @@ -34,8 +34,8 @@ let stop = Date.now();
34 const elapsed_seconds = (stop - start) / 1000; 34 const elapsed_seconds = (stop - start) / 1000;
35 const duration = audio.samples.length / audio.sampleRate; 35 const duration = audio.samples.length / audio.sampleRate;
36 const real_time_factor = elapsed_seconds / duration; 36 const real_time_factor = elapsed_seconds / duration;
37 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
38 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 37 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  38 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
39 console.log( 39 console.log(
40 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 40 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
41 real_time_factor.toFixed(3)) 41 real_time_factor.toFixed(3))
@@ -32,8 +32,8 @@ let stop = Date.now(); @@ -32,8 +32,8 @@ let stop = Date.now();
32 const elapsed_seconds = (stop - start) / 1000; 32 const elapsed_seconds = (stop - start) / 1000;
33 const duration = audio.samples.length / audio.sampleRate; 33 const duration = audio.samples.length / audio.sampleRate;
34 const real_time_factor = elapsed_seconds / duration; 34 const real_time_factor = elapsed_seconds / duration;
35 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
36 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 35 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  36 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
37 console.log( 37 console.log(
38 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 38 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
39 real_time_factor.toFixed(3)) 39 real_time_factor.toFixed(3))
@@ -34,8 +34,8 @@ let stop = Date.now(); @@ -34,8 +34,8 @@ let stop = Date.now();
34 const elapsed_seconds = (stop - start) / 1000; 34 const elapsed_seconds = (stop - start) / 1000;
35 const duration = audio.samples.length / audio.sampleRate; 35 const duration = audio.samples.length / audio.sampleRate;
36 const real_time_factor = elapsed_seconds / duration; 36 const real_time_factor = elapsed_seconds / duration;
37 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
38 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 37 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  38 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
39 console.log( 39 console.log(
40 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 40 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
41 real_time_factor.toFixed(3)) 41 real_time_factor.toFixed(3))
@@ -34,8 +34,8 @@ let stop = Date.now(); @@ -34,8 +34,8 @@ let stop = Date.now();
34 const elapsed_seconds = (stop - start) / 1000; 34 const elapsed_seconds = (stop - start) / 1000;
35 const duration = audio.samples.length / audio.sampleRate; 35 const duration = audio.samples.length / audio.sampleRate;
36 const real_time_factor = elapsed_seconds / duration; 36 const real_time_factor = elapsed_seconds / duration;
37 -console.log('Wave duration', duration.toFixed(3), 'secodns')  
38 -console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns') 37 +console.log('Wave duration', duration.toFixed(3), 'seconds')
  38 +console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
39 console.log( 39 console.log(
40 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`, 40 `RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
41 real_time_factor.toFixed(3)) 41 real_time_factor.toFixed(3))