Add JavaScript API (node-addon) for FireRedAsr (#1873)
This commit is contained in:
8
.github/scripts/test-nodejs-addon-npm.sh
vendored
8
.github/scripts/test-nodejs-addon-npm.sh
vendored
@@ -10,6 +10,14 @@ arch=$(node -p "require('os').arch()")
|
|||||||
platform=$(node -p "require('os').platform()")
|
platform=$(node -p "require('os').platform()")
|
||||||
node_version=$(node -p "process.versions.node.split('.')[0]")
|
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----------"
|
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
|
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
|
tar xvf sherpa-onnx-moonshine-tiny-en-int8.tar.bz2
|
||||||
|
|||||||
@@ -80,6 +80,23 @@ static SherpaOnnxOfflineWhisperModelConfig GetOfflineWhisperModelConfig(
|
|||||||
return c;
|
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<Napi::Object>();
|
||||||
|
|
||||||
|
SHERPA_ONNX_ASSIGN_ATTR_STR(encoder, encoder);
|
||||||
|
SHERPA_ONNX_ASSIGN_ATTR_STR(decoder, decoder);
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
static SherpaOnnxOfflineMoonshineModelConfig GetOfflineMoonshineModelConfig(
|
static SherpaOnnxOfflineMoonshineModelConfig GetOfflineMoonshineModelConfig(
|
||||||
Napi::Object obj) {
|
Napi::Object obj) {
|
||||||
SherpaOnnxOfflineMoonshineModelConfig c;
|
SherpaOnnxOfflineMoonshineModelConfig c;
|
||||||
@@ -150,6 +167,7 @@ static SherpaOnnxOfflineModelConfig GetOfflineModelConfig(Napi::Object obj) {
|
|||||||
c.tdnn = GetOfflineTdnnModelConfig(o);
|
c.tdnn = GetOfflineTdnnModelConfig(o);
|
||||||
c.sense_voice = GetOfflineSenseVoiceModelConfig(o);
|
c.sense_voice = GetOfflineSenseVoiceModelConfig(o);
|
||||||
c.moonshine = GetOfflineMoonshineModelConfig(o);
|
c.moonshine = GetOfflineMoonshineModelConfig(o);
|
||||||
|
c.fire_red_asr = GetOfflineFireRedAsrModelConfig(o);
|
||||||
|
|
||||||
SHERPA_ONNX_ASSIGN_ATTR_STR(tokens, tokens);
|
SHERPA_ONNX_ASSIGN_ATTR_STR(tokens, tokens);
|
||||||
SHERPA_ONNX_ASSIGN_ATTR_INT32(num_threads, numThreads);
|
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.uncached_decoder);
|
||||||
SHERPA_ONNX_DELETE_C_STR(c.model_config.moonshine.cached_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.tokens);
|
||||||
SHERPA_ONNX_DELETE_C_STR(c.model_config.provider);
|
SHERPA_ONNX_DELETE_C_STR(c.model_config.provider);
|
||||||
SHERPA_ONNX_DELETE_C_STR(c.model_config.model_type);
|
SHERPA_ONNX_DELETE_C_STR(c.model_config.model_type);
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ The following tables list the examples in this folder.
|
|||||||
|File| Description|
|
|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_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_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_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)|
|
|[./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
|
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
|
### Non-streaming speech recognition with Whisper
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
49
nodejs-addon-examples/test_asr_non_streaming_fire_red_asr.js
Normal file
49
nodejs-addon-examples/test_asr_non_streaming_fire_red_asr.js
Normal file
@@ -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)
|
||||||
@@ -41,8 +41,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ for (let filename of testWaves) {
|
|||||||
for (let e of events) {
|
for (let e of events) {
|
||||||
console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`);
|
console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`);
|
||||||
}
|
}
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ for (let filename of testWaves) {
|
|||||||
for (let e of events) {
|
for (let e of events) {
|
||||||
console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`);
|
console.log(`${e.prob.toFixed(3)}\t\t\t${e.name}`);
|
||||||
}
|
}
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ console.log('Done')
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = wave.samples.length / wave.sampleRate;
|
const duration = wave.samples.length / wave.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ let stop = Date.now();
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = audio.samples.length / audio.sampleRate;
|
const duration = audio.samples.length / audio.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ let stop = Date.now();
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = audio.samples.length / audio.sampleRate;
|
const duration = audio.samples.length / audio.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ let stop = Date.now();
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = audio.samples.length / audio.sampleRate;
|
const duration = audio.samples.length / audio.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ let stop = Date.now();
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = audio.samples.length / audio.sampleRate;
|
const duration = audio.samples.length / audio.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ let stop = Date.now();
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = audio.samples.length / audio.sampleRate;
|
const duration = audio.samples.length / audio.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ let stop = Date.now();
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = audio.samples.length / audio.sampleRate;
|
const duration = audio.samples.length / audio.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ let stop = Date.now();
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = audio.samples.length / audio.sampleRate;
|
const duration = audio.samples.length / audio.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ let stop = Date.now();
|
|||||||
const elapsed_seconds = (stop - start) / 1000;
|
const elapsed_seconds = (stop - start) / 1000;
|
||||||
const duration = audio.samples.length / audio.sampleRate;
|
const duration = audio.samples.length / audio.sampleRate;
|
||||||
const real_time_factor = elapsed_seconds / duration;
|
const real_time_factor = elapsed_seconds / duration;
|
||||||
console.log('Wave duration', duration.toFixed(3), 'secodns')
|
console.log('Wave duration', duration.toFixed(3), 'seconds')
|
||||||
console.log('Elapsed', elapsed_seconds.toFixed(3), 'secodns')
|
console.log('Elapsed', elapsed_seconds.toFixed(3), 'seconds')
|
||||||
console.log(
|
console.log(
|
||||||
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
`RTF = ${elapsed_seconds.toFixed(3)}/${duration.toFixed(3)} =`,
|
||||||
real_time_factor.toFixed(3))
|
real_time_factor.toFixed(3))
|
||||||
|
|||||||
Reference in New Issue
Block a user