Commit Graph
2142 Commits
Author SHA1 Message Date
Arbaz Siddiqui fa0d247a14 Add VoxLock target-speaker voice isolation to the speech denoisers (#4085)
VoxLock keeps the voice of one speaker (the caller) and removes the other
voices. It runs in the offline and online speech denoisers next to GTCRN
and DPDFNet, with two ONNX models: an enroll model that runs once on a
voice sample of the caller and a chunk model that runs on each chunk of
the audio and carries the LSTM state.

Without a voice sample, the offline denoiser uses the loudest 3 seconds
in the first 15 seconds of the input, and the online denoiser passes
audio through until it has heard 3 seconds of speech. A voice sample can
be given with --speech-denoiser-voxlock-voice-sample.

The voice sample is optional, so instead of exiting, log a warning and
take the voice sample from the input audio as if none was given.
2026-10-25 08:43:19 +08:00
Hassan Kazi c65f321699 Fix decoder positions of generated tokens in Canary greedy search (#4097)
The prompt is fed at positions 0..n-1, but generated tokens were fed at
1, 2, ... instead of n, n+1, ..., overlapping the prompt. Feed them at
decoder_input.size() + i - 1, as NeMo's GreedySequenceGenerator does.

Fixes #4096
2026-10-24 16:50:59 +08:00
Fangjun Kuang 88204440c2 Fix publishing flutter packages (#4091) 2026-10-23 23:48:11 +08:00
Fangjun Kuang 8abb7c8f87 Release v2.0.0 (#4090) v2.0.0 2026-10-23 20:32:33 +08:00
Fangjun Kuang bad60aa0b5 Fix Ascend CI (#4089) 2026-10-23 20:09:01 +08:00
Fangjun Kuang 12b4f4af2f Add tauri example for Doubao ASR (#4083) 2026-10-23 14:36:20 +08:00
DR1N0 36342561cb docs: add Loud Caption to projects using sherpa-onnx (#4074) 2026-10-22 23:44:45 +08:00
sunerpy 1cad51be77 Add Voltip to 'Projects using sherpa-onnx' (#4081) 2026-10-22 23:42:20 +08:00
Fangjun Kuang f2e01fe8e3 Widen VAD sample positions to int64_t to fix long-stream SIGSEGV. (#4079)
Fixes #3635

It is for v2.0.0 and breaks the ABI.

CircularBuffer::head_ and tail_ are absolute sample counters that grow
forever. As int32_t they overflow after 2^31 samples (~37 h at 16 kHz);
tail_ % capacity then goes negative and std::copy() writes to an invalid
iterator, crashing long-running VAD streams.

Widen every absolute stream position to int64_t. Counts and capacities
(Push/Pop/Get's n, Size(), capacity) stay int32_t — they are bounded by
buffer memory, not stream duration.
2026-10-22 23:39:59 +08:00
Fangjun Kuang 51ec64f7c4 Build wheels for Python 3.15gg (#4080) 2026-10-22 15:17:57 +08:00
Fangjun Kuang a9193276e4 Fix building Flutter APPs for macOS (#4078) 2026-10-22 13:44:57 +08:00
Fangjun Kuang ce949db9dd Fix word boundaries, OOV words and Unicode handling in lexicon TTS (#4075) 2026-10-22 12:16:36 +08:00
Hassan Kazi 96bdb8ebc7 Validate speaker embedding dimensions before releasing the GIL (#4077) 2026-10-22 09:24:07 +08:00
Kyozzz a63f82130d Use NeMo's additive log-zero guard for NeMo mel features (#3999)
NeMo's AudioToMelSpectrogramPrefab computes log(x + 2**-24), while the
shared fbank extractor applies a hard floor, log(max(x, FLT_EPSILON)).
On quiet recordings a large share of the mel bins sit at that floor and
per-feature normalization turns them into constant columns the model
never saw in training, which degrades accuracy a lot (issue #3997).

For NeMo models (nemo_normalize_type is set), disable use_log_fbank and
apply log(x + 2**-24) to the raw mel energies in GetFrames() before the
per-feature normalization. Other models keep the existing behavior.

Bump the dependency and select the additive guard with eps = FLT_EPSILON / 2 for NeMo fbank models. The manual log pass in GetFrames() is no longer needed, which also keeps MFCC models such as TeleSpeech untouched.
2026-10-21 11:48:14 +08:00
Hassan Kazi 6c09898685 Check the embedding size in the Python SpeakerEmbeddingManager methods (#4048) 2026-10-21 10:05:52 +08:00
Hassan Kazi bebb29ff81 Fix omnilingual ASR aborting on input shorter than 400 samples (#4043)
The wav2vec2-style convolutional front end of omnilingual ASR models needs at
least 400 samples. For shorter input onnxruntime throws an Ort::Exception from
DecodeStream that nothing catches, so sherpa-onnx-offline and C API users abort,
Python users get a RuntimeError, and a batch passed to DecodeStreams loses the
results of every stream. Empty input also reached f.size() / feat_dim with
feat_dim == 0. Return an empty result for such input instead.
2026-10-21 10:03:55 +08:00
Hassan Kazi 1d6eba7b93 Feed the VAD one window at a time in vad-microphone.py and vad-alsa.py (#4050)
Both examples passed each 0.1 s read straight to accept_waveform(), which expects
window-sized input. Buffer the reads and feed window_size samples per call, as the
other VAD examples do.
2026-10-21 10:02:04 +08:00
Fangjun Kuang a83acee682 Fix typos in the project. (#4073) 2026-10-21 09:57:49 +08:00
Emmanuel BORGES 8b08f74dc4 docs: add VocaRead to projects using sherpa-onnx (#4041) 2026-10-21 09:55:45 +08:00
Stef 51aaac5a46 jni: Fix strings returned to Java for characters outside the BMP (#4064) 2026-10-20 19:08:03 +08:00
losewayy 2e3968f5b5 Forward provider config keys to the CUDA execution provider (#3982) (#3985) 2026-10-20 18:58:43 +08:00
Fangjun Kuang bddf3a0118 Refactor building wheels for Linux armv7 (#4071) 2026-10-20 18:44:24 +08:00
Stef 5fec9c9b09 jni: Fix TTS for characters outside the BMP (#4062) 2026-10-20 18:28:53 +08:00
Sergio Fernández 432e8dfc34 Add akou to 'Projects using sherpa-onnx' (#4039) 2026-10-20 18:09:46 +08:00
Hulk 0dc72bcd1a Fix offline CTC timestamps after filtering special tokens (#4018) 2026-10-20 18:03:22 +08:00
Hulk b461064406 Fix JSON escaping in online and offline recognition results (#4017) 2026-10-20 18:02:27 +08:00
dxhome 005dcdc8c6 Add SmartVoice to projects using sherpa-onnx (#4016) 2026-10-20 17:59:29 +08:00
Hulk d81998df3f Support per-stream FunASR Nano prompt options (#4012) 2026-10-20 17:57:36 +08:00
Anthony b3735832a9 Fix SplitUtf8 reading past the end of a truncated UTF-8 sequence (#4010)
A lead byte announcing a 2-4 byte character near the end of the input was
copied as a whole character even when fewer bytes remained, reading past
the end of the string. This happens for TTS text that ends in the middle
of a character, which reaches SplitUtf8 through the lexicon front ends.
Treat such a lead byte like any other invalid byte and skip it.
2026-10-20 17:43:06 +08:00
olerast e1cecafb73 Add Suflyor to 'Projects using sherpa-onnx' (#4001) 2026-10-20 17:39:56 +08:00
Mohammad Hijjawi 1bca6ae4e4 Fix malformed SRT timestamps in generate-subtitles.py (#4009)
The timestamps were built as str(timedelta(seconds=t))[:-3]. That only
works when t has a fractional part: for a whole number of seconds
str(timedelta) has no ".ffffff" suffix, so the slice cuts off the
seconds instead, e.g. a segment starting at 0 s was written as
"0:00 --> 0:00:01,500". Hours were also written with a single digit,
while SRT expects HH:MM:SS,mmm.

Format the timestamps explicitly as HH:MM:SS,mmm for both the .srt
and the .txt output.
2026-10-20 17:36:51 +08:00
Pratik Gandhi 6571533b28 README: fix decibri integration guide link (#3992) 2026-10-20 17:33:00 +08:00
James Winegar 39058046a3 Fix sherpa-onnx-sys build.rs: custom profiles, iOS after Android, iOS device vs simulator (#3991)
- profile_output_dirs(): under a custom Cargo profile (e.g. dx's android-dev), PROFILE is
  debug/release but the directory is named after the profile. Fall back to Cargo's fixed
  layout, OUT_DIR.ancestors().nth(3).
- download_prebuilt_libs(): only consult the cached jniLibs/<abi> directory for Android; iOS
  aarch64 maps to the same arm64-v8a name and picked up Android libraries.
- iOS: reuse an already extracted xcframework instead of re-extracting, which deleted the
  other target's lib dir (device lib/ vs simulator lib-sim/).
2026-10-20 17:31:43 +08:00
Dime 7835e5e9d2 alsa: pass the mono sample count to the resampler (#3995)
ToFloat() de-interleaves the captured frames, so samples1_ holds one
float per frame (the first channel), while samples_ still holds
actual_channel_count_ int16 samples per frame. Passing samples_.size()
as input_dim to LinearResample::Resample() made it read twice as many
floats as samples1_ contains whenever the device runs with 2 channels
and a sample rate that needs resampling, reading past the end of the
buffer and producing a too long output with garbage tail.
2026-10-20 17:01:04 +08:00
beasaltfish 19088d8c3f Add bot-reborn to 'Projects using sherpa-onnx' (#4040) 2026-10-20 15:53:57 +08:00
Fangjun Kuang db749e7225 Add tests for the windows arm64 npm package (#4069) 2026-10-20 15:42:34 +08:00
Hassan Kazi 98f2689f7b Raise ValueError when KeywordSpotter.create_stream() cannot encode keywords (#4049)
With keywords that cannot be encoded, e.g. a token missing from tokens.txt, the C++
CreateStream logs the error and returns nullptr, which reached Python as None. The
caller then failed later with "'NoneType' object has no attribute 'accept_waveform'".
Raise a ValueError naming the keywords instead.
2026-10-20 12:11:24 +08:00
Cassian433 253d6c22e9 Fix ZipVoice heap overflow for short text at speed > 1 (#4051) 2026-10-20 12:05:08 +08:00
Elian Doran 81dd86c4ba Add Node.js addon for Windows arm64 (sherpa-onnx-win-arm64) (#4054) 2026-10-20 11:56:18 +08:00
Fangjun Kuang 0b3647632f Remove espeak-ng and piper-phonemize from sherpa-onnx (#4055)
Fixes #3731

espeak-ng and piper-phonemize are no longer built into sherpa-onnx.

Text frontends are now:

- **lexicon** — built in, no extra dependency
- **phonemize** — phonemize outside sherpa-onnx (e.g. [piper-phonemize](https://github.com/csukuangfj/piper-phonemize)) and pass the result in. That library is GPL, so it stays optional: sherpa-onnx is GPL-free after this PR.

## API

- `SherpaOnnxGenerationConfig` gains `phoneme_codepoints` and `tokens` (mutually exclusive alternatives to `text`)
- `data_dir` on the TTS model configs is deprecated and ignored; the ABI slot is kept
- all bindings updated: C/C++, Python, Java, Kotlin, Go, Rust, C#, Swift, Pascal, Dart/Flutter, node-addon, WASM, HarmonyOS
2026-10-20 11:09:04 +08:00
Luís Felipe Mesquita Granja 1a9d234ab9 Update zip build dependency to v9 (#4059)
The three RUSTSEC advisories against zip 2.x (RUSTSEC-2026-0367 SUID/SGID bits, RUSTSEC-2026-0368 symlink escape, RUSTSEC-2026-0369 permissions through symlinks) are fixed in zip >= 9 only. The zip usage in build.rs is confined to the iOS .xcframework.zip branch and its ZipArchive::new/extract API is unchanged in 9.x, so the bump is source-compatible: verified with `DOCS_RS=1 cargo check` against zip 9.0.4.

Fixes #4058
2026-10-17 12:40:40 +08:00
Kyozzz f4ecc7f02d Fix offline recognizer Swift wrapper build (#4005)
The C struct SherpaOnnxOfflineRecognizerConfig gained
ctc_fst_decoder_config, but the Swift helper constructing it was not
updated, so the swift CI workflow fails to compile (missing argument
for parameter 'ctc_fst_decoder_config'). Mirror the online wrapper:
add sherpaOnnxOfflineCtcFstDecoderConfig() and pass the new field
(with a default value so existing callers are unaffected).
2026-10-16 21:11:13 +08:00
Jasper fa29eb91c8 Pad 1s of silence on endpoint for streaming paraformer in Python examples (mirror C++ behavior, #1373) (#4052) 2026-10-15 13:52:34 +08:00
Cassian433 1654a3054e c-api: catch C++ exceptions in SherpaOnnxCreate* and return NULL (#4044) 2026-10-14 11:22:23 +08:00
Fangjun Kuang a452f9f078 Fix Flutter VAD+ASR examples for Qwen3 ASR (#4045) 2026-10-13 20:23:09 +08:00
Paolo Antinori 6e7ea3e409 jni: convert C++ exceptions in recognizer/punctuation constructors to Java exceptions (#3988)
An exception escaping a JNI boundary calls std::terminate and aborts the
process. In production we observed an Ort::Exception raised while loading
a corrupt model file inside OfflineRecognizer::newFromFile take down the
whole app, uncatchable from Kotlin.

Wrap every model-loading JNI constructor (offline/online recognizer,
offline/online punctuation, both the file and the asset variants) in a
try/catch that converts the C++ exception into a Java exception via
ThrowNew, following the existing pattern in jni/wave-reader.cc. The
helper RethrowCxxExceptionAsJava lives in jni/common.h.

Fixes #3987
2026-10-12 09:35:56 +08:00
Fangjun Kuang 9db1af1871 Update README to include deepseek-harness (#4030) 2026-10-09 15:49:02 +08:00
Fangjun Kuang e78dd83ca9 Update README to include China Life (#4029) 2026-10-09 15:29:18 +08:00
Fangjun Kuang f28c1d1840 Update README to include China Unicom (#4028) 2026-10-09 15:06:16 +08:00
Fangjun Kuang 1ca55ff076 Add subtitle generation Python API example for Doubao ASR. (#4027)
* Add subtitle generation Python API example for Doubao ASR.

generate-subtitles-doubao.py uses silero-vad/ten-vad for segmentation and
the Doubao bigmodel recording-file recognition API for ASR. Audio segments
are sent as base64 encoded wav data, so no public URL is needed. Results
are written to <input>.srt and <input>.txt.

Also for generate-subtitles.py:

 - Add --max-duration-seconds to process only the first N seconds of the
   input file
 - Refuse to run if <input>.srt or <input>.txt already exists
2026-10-09 13:55:48 +08:00