Skip to content

Fix node addon tests #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions nodejs-addon-examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ rm sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2

node ./test_asr_streaming_transducer.js

# To run the test with microphone, you need to install the package naudiodon2
npm install naudiodon2

node ./test_asr_streaming_transducer_microphone.js
```

Expand All @@ -44,6 +47,10 @@ node ./test_asr_streaming_transducer_microphone.js
```bash
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx


# To run the test with microphone, you need to install the package naudiodon2
npm install naudiodon2

node ./test_vad_microphone.js
```

1 change: 0 additions & 1 deletion nodejs-addon-examples/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"dependencies": {
"naudiodon2": "^2.4.0",
"perf_hooks": "*",
"sherpa-onnx-node": "*"
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/apk/generate-tts-apk-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_piper_models() -> List[TtsModel]:
TtsModel(model_dir="vits-piper-de_DE-eva_k-x_low"),
TtsModel(model_dir="vits-piper-de_DE-karlsson-low"),
TtsModel(model_dir="vits-piper-de_DE-kerstin-low"),
TtsModel(model_dir="vits-piper-de_DE-mls-medium"),
# TtsModel(model_dir="vits-piper-de_DE-mls-medium"),
TtsModel(model_dir="vits-piper-de_DE-pavoque-low"),
TtsModel(model_dir="vits-piper-de_DE-ramona-low"),
TtsModel(model_dir="vits-piper-de_DE-thorsten-high"),
Expand Down
4 changes: 2 additions & 2 deletions scripts/node-addon-api/test/test_asr_streaming_transducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ console.log('Started')
let start = performance.now();
const stream = recognizer.createStream();
const wave = sherpa_onnx.readWave(waveFilename);
stream.acceptWaveform(wave.samples, wave.sampleRate);
stream.acceptWaveform({samples: wave.samples, sampleRate: wave.sampleRate});

const tailPadding = new Float32Array(wave.sampleRate * 0.4);
stream.acceptWaveform(tailPadding, wave.sampleRate);
stream.acceptWaveform({samples: tailPadding, sampleRate: wave.sampleRate});

while (recognizer.isReady(stream)) {
recognizer.decode(stream);
Expand Down
2 changes: 1 addition & 1 deletion sherpa-onnx/csrc/online-ctc-fst-decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void DecodeOne(const float *log_probs, int32_t num_rows,

std::ostringstream os;
int32_t prev_id = -1;
int32_t num_trailing_blanks = 0;
int32_t &num_trailing_blanks = result->num_trailing_blanks;
int32_t f = 0; // frame number

for (auto i : isymbols_out) {
Expand Down
Loading