sherpa-onnx C API 1.0
Public C API and C++ wrapper for sherpa-onnx
Loading...
Searching...
No Matches
c-api.h
Go to the documentation of this file.
1// sherpa-onnx/c-api/c-api.h
2//
3// Copyright (c) 2023 Xiaomi Corporation
71#ifndef SHERPA_ONNX_C_API_C_API_H_
72#define SHERPA_ONNX_C_API_C_API_H_
73
74#include <stdint.h>
75
76#ifdef __cplusplus
77extern "C" {
78#endif
79
80// See https://github.com/pytorch/pytorch/blob/main/c10/macros/Export.h
81// We will set SHERPA_ONNX_BUILD_SHARED_LIBS and SHERPA_ONNX_BUILD_MAIN_LIB in
82// CMakeLists.txt
83
84#if defined(__GNUC__)
85#pragma GCC diagnostic push
86#pragma GCC diagnostic ignored "-Wattributes"
87#endif
88
89#if defined(_WIN32)
90#if defined(SHERPA_ONNX_BUILD_SHARED_LIBS)
91#define SHERPA_ONNX_EXPORT __declspec(dllexport)
92#define SHERPA_ONNX_IMPORT __declspec(dllimport)
93#else
94#define SHERPA_ONNX_EXPORT
95#define SHERPA_ONNX_IMPORT
96#endif
97#else // WIN32
98#define SHERPA_ONNX_EXPORT __attribute__((visibility("default")))
99
100#define SHERPA_ONNX_IMPORT SHERPA_ONNX_EXPORT
101#endif // WIN32
102
103#if defined(SHERPA_ONNX_BUILD_MAIN_LIB)
104#define SHERPA_ONNX_API SHERPA_ONNX_EXPORT
105#else
106#define SHERPA_ONNX_API SHERPA_ONNX_IMPORT
107#endif
108
109#ifndef SHERPA_ONNX_DEPRECATED
110#if defined(_MSC_VER)
111#define SHERPA_ONNX_DEPRECATED(msg) __declspec(deprecated(msg))
112#elif defined(__GNUC__) || defined(__clang__)
113#define SHERPA_ONNX_DEPRECATED(msg) __attribute__((deprecated(msg)))
114#else
115#define SHERPA_ONNX_DEPRECATED(msg)
116#endif
117#endif
118
132
142
152
165SHERPA_ONNX_API int32_t SherpaOnnxFileExists(const char *filename);
166
182
196
204
210
216
270
284
292
302
384
395 const char *text;
396
402 const char *tokens;
403
405 const char *const *tokens_arr;
406
415
417 int32_t count;
418
420 const char *json;
422
427
467
480 const SherpaOnnxOnlineRecognizer *recognizer);
481
501 const SherpaOnnxOnlineRecognizer *recognizer);
502
519 const SherpaOnnxOnlineRecognizer *recognizer, const char *hotwords);
520
534 const SherpaOnnxOnlineStream *stream);
535
557 const SherpaOnnxOnlineStream *stream, int32_t sample_rate,
558 const float *samples, int32_t n);
559
573SHERPA_ONNX_API int32_t
575 const SherpaOnnxOnlineStream *stream);
576
594 const SherpaOnnxOnlineRecognizer *recognizer,
595 const SherpaOnnxOnlineStream *stream);
596
613 const SherpaOnnxOnlineRecognizer *recognizer,
614 const SherpaOnnxOnlineStream **streams, int32_t n);
615
638 const SherpaOnnxOnlineStream *stream);
639
653
670 const SherpaOnnxOnlineRecognizer *recognizer,
671 const SherpaOnnxOnlineStream *stream);
672
685
702 const SherpaOnnxOnlineRecognizer *recognizer,
703 const SherpaOnnxOnlineStream *stream);
704
717 const SherpaOnnxOnlineStream *stream);
718
734 const SherpaOnnxOnlineStream *stream, const char *key, const char *value);
735
750 const SherpaOnnxOnlineStream *stream, const char *key);
751
764 const SherpaOnnxOnlineStream *stream, const char *key);
765
779SHERPA_ONNX_API int32_t
781 const SherpaOnnxOnlineStream *stream);
782
789
802 int32_t max_word_per_line);
803
810
823 int32_t idx, const char *s);
824// ============================================================
825// For offline ASR (i.e., non-streaming ASR)
826// ============================================================
827
839
845
851
873
887
901
909
915
929
935
943
953
959
965
971
977
981 const char *encoder_adaptor;
983 const char *llm;
985 const char *embedding;
987 const char *tokenizer;
989 const char *system_prompt;
991 const char *user_prompt;
997 float top_p;
999 int32_t seed;
1001 const char *language;
1003 int32_t itn;
1005 const char *hotwords;
1007
1032
1038
1111
1194
1197
1200
1260 const SherpaOnnxOfflineRecognizerConfig *config);
1261
1273 const SherpaOnnxOfflineRecognizer *recognizer,
1274 const SherpaOnnxOfflineRecognizerConfig *config);
1275
1288 const SherpaOnnxOfflineRecognizer *recognizer);
1289
1306 const SherpaOnnxOfflineRecognizer *recognizer);
1307
1324 const SherpaOnnxOfflineRecognizer *recognizer, const char *hotwords);
1325
1339 const SherpaOnnxOfflineStream *stream);
1340
1368 const SherpaOnnxOfflineStream *stream, int32_t sample_rate,
1369 const float *samples, int32_t n);
1370
1383 const SherpaOnnxOfflineStream *stream, const char *key, const char *value);
1384
1399 const SherpaOnnxOfflineStream *stream, const char *key);
1400
1414 const SherpaOnnxOfflineStream *stream, const char *key);
1415
1430 const SherpaOnnxOfflineRecognizer *recognizer,
1431 const SherpaOnnxOfflineStream *stream);
1432
1449 const SherpaOnnxOfflineRecognizer *recognizer,
1450 const SherpaOnnxOfflineStream **streams, int32_t n);
1451
1462 const char *text;
1463
1472
1474 int32_t count;
1475
1481 const char *tokens;
1482
1484 const char *const *tokens_arr;
1485
1487 const char *json;
1488
1490 const char *lang;
1491
1493 const char *emotion;
1494
1496 const char *event;
1497
1500
1503
1507
1510 const float *segment_durations;
1511
1513 const char *segment_texts;
1514
1516 const char *const *segment_texts_arr;
1517
1521
1545
1559
1574 const SherpaOnnxOfflineStream *stream);
1575
1588
1589// ============================================================
1590// For keyword spotting
1591// ============================================================
1605 const char *keyword;
1606
1612 const char *tokens;
1613
1619 const char *const *tokens_arr;
1620
1622 int32_t count;
1623
1631
1634
1640 const char *json;
1642
1705
1708
1718 const SherpaOnnxKeywordSpotterConfig *config);
1719
1727 const SherpaOnnxKeywordSpotter *spotter);
1728
1738 const SherpaOnnxKeywordSpotter *spotter);
1739
1759 const SherpaOnnxKeywordSpotter *spotter, const char *keywords);
1760
1769SHERPA_ONNX_API int32_t
1771 const SherpaOnnxOnlineStream *stream);
1772
1783 const SherpaOnnxKeywordSpotter *spotter,
1784 const SherpaOnnxOnlineStream *stream);
1785
1797 const SherpaOnnxKeywordSpotter *spotter,
1798 const SherpaOnnxOnlineStream *stream);
1799
1811 const SherpaOnnxKeywordSpotter *spotter,
1812 const SherpaOnnxOnlineStream **streams, int32_t n);
1813
1837 const SherpaOnnxKeywordSpotter *spotter,
1838 const SherpaOnnxOnlineStream *stream);
1839
1847 const SherpaOnnxKeywordResult *r);
1848
1859 const SherpaOnnxKeywordSpotter *spotter,
1860 const SherpaOnnxOnlineStream *stream);
1861
1868
1869// ============================================================
1870// For VAD
1871// ============================================================
1872
1893
1914
1961
1964
1978 int32_t capacity);
1979
1991 const SherpaOnnxCircularBuffer *buffer);
1992
2005 const SherpaOnnxCircularBuffer *buffer, const float *p, int32_t n);
2006
2022 const SherpaOnnxCircularBuffer *buffer, int32_t start_index, int32_t n);
2023
2026
2034 const SherpaOnnxCircularBuffer *buffer, int32_t n);
2035
2042SHERPA_ONNX_API int32_t
2044
2054SHERPA_ONNX_API int32_t
2056
2063 const SherpaOnnxCircularBuffer *buffer);
2064
2080
2083
2113 float buffer_size_in_seconds);
2114
2123
2140 const SherpaOnnxVoiceActivityDetector *p, const float *samples, int32_t n);
2141
2148SHERPA_ONNX_API int32_t
2150
2159
2178
2186
2209
2218 const SherpaOnnxSpeechSegment *p);
2219
2227
2241
2242// ============================================================
2243// For offline Text-to-Speech (i.e., non-streaming TTS)
2244// ============================================================
2245
2265
2285
2289 const char *model;
2291 const char *voices;
2293 const char *tokens;
2295 const char *data_dir;
2299 const char *dict_dir;
2301 const char *lexicon;
2303 const char *lang;
2305
2319
2343
2363
2381
2421
2452
2468
2477typedef int32_t (*SherpaOnnxGeneratedAudioCallback)(const float *samples,
2478 int32_t n);
2479
2484typedef int32_t (*SherpaOnnxGeneratedAudioCallbackWithArg)(const float *samples,
2485 int32_t n,
2486 void *arg);
2487
2497 const float *samples, int32_t n, float p);
2498
2504 const float *samples, int32_t n, float p, void *arg);
2505
2508
2530 const SherpaOnnxOfflineTtsConfig *config);
2531
2539 const SherpaOnnxOfflineTts *tts);
2540
2547SHERPA_ONNX_API int32_t
2549
2558SHERPA_ONNX_API int32_t
2560
2582SHERPA_ONNX_API SHERPA_ONNX_DEPRECATED(
2583 "Use SherpaOnnxOfflineTtsGenerateWithConfig() instead") const
2585 const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid,
2586 float speed);
2587
2605SHERPA_ONNX_API SHERPA_ONNX_DEPRECATED(
2606 "Use SherpaOnnxOfflineTtsGenerateWithConfig() instead") const
2608 const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid,
2609 float speed, SherpaOnnxGeneratedAudioCallback callback);
2610
2635SHERPA_ONNX_API SHERPA_ONNX_DEPRECATED(
2636 "Use SherpaOnnxOfflineTtsGenerateWithConfig() instead") const
2638 const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid,
2639 float speed, SherpaOnnxGeneratedAudioProgressCallback callback);
2640
2655SHERPA_ONNX_API SHERPA_ONNX_DEPRECATED(
2656 "Use SherpaOnnxOfflineTtsGenerateWithConfig() instead") const
2659 const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid,
2660 float speed,
2662 void *arg);
2663
2679SHERPA_ONNX_API SHERPA_ONNX_DEPRECATED(
2680 "Use SherpaOnnxOfflineTtsGenerateWithConfig() instead") const
2682 const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid,
2683 float speed, SherpaOnnxGeneratedAudioCallbackWithArg callback,
2684 void *arg);
2685
2691SHERPA_ONNX_API SHERPA_ONNX_DEPRECATED(
2692 "Use SherpaOnnxOfflineTtsGenerateWithConfig() instead") const
2694 const SherpaOnnxOfflineTts *tts, const char *text,
2695 const char *prompt_text, const float *prompt_samples, int32_t n_prompt,
2696 int32_t prompt_sr, float speed, int32_t num_steps);
2697
2737
2768 const SherpaOnnxOfflineTts *tts, const char *text,
2769 const SherpaOnnxGenerationConfig *config,
2771
2780 const SherpaOnnxGeneratedAudio *p);
2781
2797SHERPA_ONNX_API int32_t SherpaOnnxWriteWave(const float *samples, int32_t n,
2798 int32_t sample_rate,
2799 const char *filename);
2800
2807SHERPA_ONNX_API int64_t SherpaOnnxWaveFileSize(int32_t n_samples);
2808
2820 int32_t n, int32_t sample_rate,
2821 char *buffer);
2822
2834 const float *const *samples, int32_t n, int32_t sample_rate,
2835 int32_t num_channels, const char *filename);
2836
2843typedef struct SherpaOnnxWave {
2845 const float *samples;
2851
2870
2880 const char *data, int32_t n);
2881
2888
2907
2917
2924 const SherpaOnnxMultiChannelWave *wave);
2925
2926// ============================================================
2927// For spoken language identification
2928// ============================================================
2929
2950
2977
2981
2993
3003
3018
3030
3058 const SherpaOnnxOfflineStream *s);
3059
3068
3069// ============================================================
3070// For speaker embedding extraction
3071// ============================================================
3097
3101
3113
3122
3131
3146
3157 const SherpaOnnxOnlineStream *s);
3158
3184SHERPA_ONNX_API const float *
3187 const SherpaOnnxOnlineStream *s);
3188
3197 const float *v);
3198
3206
3221
3230
3239SHERPA_ONNX_API int32_t
3241 const char *name, const float *v);
3242
3260 const SherpaOnnxSpeakerEmbeddingManager *p, const char *name,
3261 const float **v);
3262
3276 const SherpaOnnxSpeakerEmbeddingManager *p, const char *name,
3277 const float *v, int32_t n);
3278
3287 const SherpaOnnxSpeakerEmbeddingManager *p, const char *name);
3288
3300 const SherpaOnnxSpeakerEmbeddingManager *p, const float *v,
3301 float threshold);
3302
3310 const char *name);
3311
3321
3333
3346 const SherpaOnnxSpeakerEmbeddingManager *p, const float *v, float threshold,
3347 int32_t n);
3348
3357
3368 const SherpaOnnxSpeakerEmbeddingManager *p, const char *name,
3369 const float *v, float threshold);
3370
3379 const SherpaOnnxSpeakerEmbeddingManager *p, const char *name);
3380
3389
3400SHERPA_ONNX_API const char *const *
3403
3412 const char *const *names);
3413
3414// ============================================================
3415// For audio tagging
3416// ============================================================
3422
3453
3479
3483typedef struct SherpaOnnxAudioEvent {
3485 const char *name;
3487 int32_t index;
3489 float prob;
3491
3494
3504 const SherpaOnnxAudioTaggingConfig *config);
3505
3513 const SherpaOnnxAudioTagging *tagger);
3514
3524
3551 const SherpaOnnxOfflineStream *s, int32_t top_k);
3552
3559 const SherpaOnnxAudioEvent *const *p);
3560
3561// ============================================================
3562// For punctuation
3563// ============================================================
3564
3589
3595
3598
3610
3618 const SherpaOnnxOfflinePunctuation *punct);
3619
3630 const SherpaOnnxOfflinePunctuation *punct, const char *text);
3631
3639
3666
3672
3675
3685 const SherpaOnnxOnlinePunctuationConfig *config);
3686
3693 const SherpaOnnxOnlinePunctuation *punctuation);
3694
3712 const SherpaOnnxOnlinePunctuation *punctuation, const char *text);
3713
3720
3721// For resampling
3724
3748SherpaOnnxCreateLinearResampler(int32_t samp_rate_in_hz,
3749 int32_t samp_rate_out_hz,
3750 float filter_cutoff_hz, int32_t num_zeros);
3751
3758 const SherpaOnnxLinearResampler *p);
3759
3766 const SherpaOnnxLinearResampler *p);
3767
3779
3793 const SherpaOnnxLinearResampler *p, const float *input, int32_t input_dim,
3794 int32_t flush);
3795
3802 const SherpaOnnxResampleOut *p);
3803
3811 const SherpaOnnxLinearResampler *p);
3812
3820 const SherpaOnnxLinearResampler *p);
3821
3822// =========================================================================
3823// For offline speaker diarization (i.e., non-streaming speaker diarization)
3824// =========================================================================
3830
3847
3862
3890
3894
3906
3915
3924
3936
3940
3952
3962
3972
3987
3997
4005 int32_t num_processed_chunks, int32_t num_total_chunks, void *arg);
4006
4012 int32_t num_processed_chunks, int32_t num_total_chunks);
4013
4025 const SherpaOnnxOfflineSpeakerDiarization *sd, const float *samples,
4026 int32_t n);
4027
4048 const SherpaOnnxOfflineSpeakerDiarization *sd, const float *samples,
4050 void *arg);
4051
4065 const SherpaOnnxOfflineSpeakerDiarization *sd, const float *samples,
4066 int32_t n,
4068
4077
4078// =========================================================================
4079// For offline speech enhancement
4080// =========================================================================
4086
4092
4111
4117
4120
4140
4149
4158
4172
4194 const float *samples, int32_t n,
4195 int32_t sample_rate);
4196
4205 const SherpaOnnxDenoisedAudio *p);
4206
4207// =========================================================================
4208// For streaming speech enhancement
4209// =========================================================================
4215
4218
4230
4239
4248
4259
4275 const float *samples, int32_t n,
4276 int32_t sample_rate);
4277
4289
4297
4298// =========================================================================
4299// Source separation
4300// =========================================================================
4301
4309
4315
4324
4329
4333
4345
4354
4363
4374
4384
4394
4413 const SherpaOnnxOfflineSourceSeparation *ss, const float *const *samples,
4414 int32_t num_channels, int32_t num_samples, int32_t sample_rate);
4415
4423
4424#ifdef __OHOS__
4425
4432typedef struct NativeResourceManager NativeResourceManager;
4433
4445SherpaOnnxCreateOfflineSpeechDenoiserOHOS(
4447 NativeResourceManager *mgr);
4448
4460SherpaOnnxCreateOnlineSpeechDenoiserOHOS(
4462 NativeResourceManager *mgr);
4463
4475SherpaOnnxCreateOnlineRecognizerOHOS(
4476 const SherpaOnnxOnlineRecognizerConfig *config, NativeResourceManager *mgr);
4477
4489SherpaOnnxCreateOfflineRecognizerOHOS(
4491 NativeResourceManager *mgr);
4492
4505SherpaOnnxCreateVoiceActivityDetectorOHOS(
4506 const SherpaOnnxVadModelConfig *config, float buffer_size_in_seconds,
4507 NativeResourceManager *mgr);
4508
4519SHERPA_ONNX_API const SherpaOnnxOfflineTts *SherpaOnnxCreateOfflineTtsOHOS(
4520 const SherpaOnnxOfflineTtsConfig *config, NativeResourceManager *mgr);
4521
4533SherpaOnnxCreateOfflinePunctuationOHOS(
4535 NativeResourceManager *mgr);
4536
4548SherpaOnnxCreateOnlinePunctuationOHOS(
4550 NativeResourceManager *mgr);
4551
4564SherpaOnnxCreateSpeakerEmbeddingExtractorOHOS(
4566 NativeResourceManager *mgr);
4567
4579SherpaOnnxCreateKeywordSpotterOHOS(const SherpaOnnxKeywordSpotterConfig *config,
4580 NativeResourceManager *mgr);
4581
4594SherpaOnnxCreateOfflineSpeakerDiarizationOHOS(
4596 NativeResourceManager *mgr);
4597
4610SherpaOnnxCreateOfflineSourceSeparationOHOS(
4612 NativeResourceManager *mgr);
4613#endif
4614
4615#if defined(__GNUC__)
4616#pragma GCC diagnostic pop
4617#endif
4618
4619#ifdef __cplusplus
4620} /* extern "C" */
4621#endif
4622
4623#endif // SHERPA_ONNX_C_API_C_API_H_
int32_t SherpaOnnxOfflineSpeakerDiarizationResultGetNumSegments(const SherpaOnnxOfflineSpeakerDiarizationResult *r)
Return the number of diarization segments.
int32_t SherpaOnnxVoiceActivityDetectorDetected(const SherpaOnnxVoiceActivityDetector *p)
Check whether the detector is currently inside speech.
const SherpaOnnxSpeechSegment * SherpaOnnxVoiceActivityDetectorFront(const SherpaOnnxVoiceActivityDetector *p)
Get the first queued speech segment.
void SherpaOnnxOfflineRecognizerSetConfig(const SherpaOnnxOfflineRecognizer *recognizer, const SherpaOnnxOfflineRecognizerConfig *config)
Update the configuration of an existing offline recognizer.
const SherpaOnnxMultiChannelWave * SherpaOnnxReadWaveMultiChannel(const char *filename)
Read a multi-channel 16-bit PCM WAVE file.
void SherpaOnnxFreeWave(const SherpaOnnxWave *wave)
Destroy a wave object returned by SherpaOnnxReadWave() or SherpaOnnxReadWaveFromBinaryData().
struct SherpaOnnxSpokenLanguageIdentification SherpaOnnxSpokenLanguageIdentification
Opaque spoken-language identification handle.
Definition c-api.h:2979
const SherpaOnnxOfflineSpeakerDiarizationResult * SherpaOnnxOfflineSpeakerDiarizationProcess(const SherpaOnnxOfflineSpeakerDiarization *sd, const float *samples, int32_t n)
Run offline speaker diarization.
void SherpaOnnxDestroySpokenLanguageIdentification(const SherpaOnnxSpokenLanguageIdentification *slid)
Destroy a spoken-language identifier.
int32_t SherpaOnnxSpeakerEmbeddingManagerNumSpeakers(const SherpaOnnxSpeakerEmbeddingManager *p)
Return the number of enrolled speakers.
int32_t(* SherpaOnnxGeneratedAudioCallback)(const float *samples, int32_t n)
Callback invoked during incremental generation.
Definition c-api.h:2477
void SherpaOnnxOnlineSpeechDenoiserReset(const SherpaOnnxOnlineSpeechDenoiser *sd)
Reset an online denoiser so it can process a new stream.
const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithZipvoice(const SherpaOnnxOfflineTts *tts, const char *text, const char *prompt_text, const float *prompt_samples, int32_t n_prompt, int32_t prompt_sr, float speed, int32_t num_steps)
Deprecated ZipVoice-specific generation API.
const char * SherpaOnnxOfflineStreamGetOption(const SherpaOnnxOfflineStream *stream, const char *key)
Get a per-stream runtime option for offline ASR.
int32_t SherpaOnnxSpeakerEmbeddingManagerRemove(const SherpaOnnxSpeakerEmbeddingManager *p, const char *name)
Remove a speaker from the manager.
const SherpaOnnxSpeakerEmbeddingExtractor * SherpaOnnxCreateSpeakerEmbeddingExtractor(const SherpaOnnxSpeakerEmbeddingExtractorConfig *config)
Create a speaker embedding extractor.
struct SherpaOnnxOfflineSpeechDenoiser SherpaOnnxOfflineSpeechDenoiser
Opaque offline speech denoiser handle.
Definition c-api.h:4119
void SherpaOnnxDestroyKeywordSpotter(const SherpaOnnxKeywordSpotter *spotter)
Destroy a keyword spotter.
void SherpaOnnxDestroyOnlineSpeechDenoiser(const SherpaOnnxOnlineSpeechDenoiser *sd)
Destroy an online speech denoiser.
const SherpaOnnxLinearResampler * SherpaOnnxCreateLinearResampler(int32_t samp_rate_in_hz, int32_t samp_rate_out_hz, float filter_cutoff_hz, int32_t num_zeros)
Create a linear resampler.
int32_t SherpaOnnxOfflineSpeechDenoiserGetSampleRate(const SherpaOnnxOfflineSpeechDenoiser *sd)
Return the expected sample rate for the denoiser.
const SherpaOnnxWave * SherpaOnnxReadWave(const char *filename)
Read a mono 16-bit PCM WAVE file.
void SherpaOnnxOnlineStreamAcceptWaveform(const SherpaOnnxOnlineStream *stream, int32_t sample_rate, const float *samples, int32_t n)
Append audio samples to a streaming ASR stream.
void SherpaOnnxDestroyOnlineStreamResultJson(const char *s)
Free a JSON string returned by SherpaOnnxGetOnlineStreamResultAsJson().
void SherpaOnnxAudioTaggingFreeResults(const SherpaOnnxAudioEvent *const *p)
Destroy results returned by SherpaOnnxAudioTaggingCompute().
void SherpaOnnxDestroyOfflineSpeakerDiarization(const SherpaOnnxOfflineSpeakerDiarization *sd)
Destroy an offline speaker diarizer.
const SherpaOnnxOfflineRecognizer * SherpaOnnxCreateOfflineRecognizer(const SherpaOnnxOfflineRecognizerConfig *config)
Create a non-streaming ASR recognizer.
void SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding(const float *v)
Destroy an embedding vector returned by SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding().
int32_t(* SherpaOnnxOfflineSpeakerDiarizationProgressCallbackNoArg)(int32_t num_processed_chunks, int32_t num_total_chunks)
Same as SherpaOnnxOfflineSpeakerDiarizationProgressCallback but without a user pointer.
Definition c-api.h:4011
const SherpaOnnxOfflineTts * SherpaOnnxCreateOfflineTts(const SherpaOnnxOfflineTtsConfig *config)
Create an offline TTS engine.
void SherpaOnnxVoiceActivityDetectorFlush(const SherpaOnnxVoiceActivityDetector *p)
Flush buffered tail samples and force final segmentation.
void SherpaOnnxDestroyOfflineStream(const SherpaOnnxOfflineStream *stream)
Destroy a non-streaming ASR stream.
const float * SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding(const SherpaOnnxSpeakerEmbeddingExtractor *p, const SherpaOnnxOnlineStream *s)
Compute the embedding for a stream.
const SherpaOnnxOfflineRecognizerResult * SherpaOnnxGetOfflineStreamResult(const SherpaOnnxOfflineStream *stream)
Get the recognition result for an offline ASR stream.
void SherpaOnnxFreeMultiChannelWave(const SherpaOnnxMultiChannelWave *wave)
Destroy a multi-channel wave object.
void SherpaOnnxOnlineStreamSetOption(const SherpaOnnxOnlineStream *stream, const char *key, const char *value)
Set a per-stream runtime option.
const char * SherpaOnnxGetOfflineStreamResultAsJson(const SherpaOnnxOfflineStream *stream)
Get the offline ASR result as JSON.
int32_t(* SherpaOnnxOfflineSpeakerDiarizationProgressCallback)(int32_t num_processed_chunks, int32_t num_total_chunks, void *arg)
Progress callback for offline speaker diarization.
Definition c-api.h:4004
const char * SherpaOnnxGetKeywordResultAsJson(const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream)
Get the current keyword spotting result as JSON.
const float * SherpaOnnxCircularBufferGet(const SherpaOnnxCircularBuffer *buffer, int32_t start_index, int32_t n)
Copy out a slice of samples from a circular buffer.
const char * SherpaOnnxOnlinePunctuationAddPunct(const SherpaOnnxOnlinePunctuation *punctuation, const char *text)
Add punctuation to one text chunk using the online punctuation model.
int32_t SherpaOnnxSpeakerEmbeddingManagerAddList(const SherpaOnnxSpeakerEmbeddingManager *p, const char *name, const float **v)
Add multiple enrollment embeddings for one speaker.
void SherpaOnnxDecodeOfflineStream(const SherpaOnnxOfflineRecognizer *recognizer, const SherpaOnnxOfflineStream *stream)
Run offline ASR on one stream.
int32_t SherpaOnnxIsKeywordStreamReady(const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream)
Check whether a keyword stream has enough audio for decoding.
int32_t SherpaOnnxSpeakerEmbeddingManagerAdd(const SherpaOnnxSpeakerEmbeddingManager *p, const char *name, const float *v)
Add one enrollment embedding for a speaker.
void SherpaOnnxDecodeKeywordStream(const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream)
Decode one ready keyword stream.
void SherpaOnnxDestroySpeakerEmbeddingManager(const SherpaOnnxSpeakerEmbeddingManager *p)
Destroy a speaker embedding manager.
const SherpaOnnxOfflineSpeakerDiarizationResult * SherpaOnnxOfflineSpeakerDiarizationProcessWithCallback(const SherpaOnnxOfflineSpeakerDiarization *sd, const float *samples, int32_t n, SherpaOnnxOfflineSpeakerDiarizationProgressCallback callback, void *arg)
Run offline speaker diarization with a progress callback.
const SherpaOnnxResampleOut * SherpaOnnxLinearResamplerResample(const SherpaOnnxLinearResampler *p, const float *input, int32_t input_dim, int32_t flush)
Resample one chunk of input audio.
struct SherpaOnnxOfflineStream SherpaOnnxOfflineStream
Non-streaming decoding state for one utterance.
Definition c-api.h:1199
#define SHERPA_ONNX_API
Definition c-api.h:106
void SherpaOnnxOnlinePunctuationFreeText(const char *text)
Free a string returned by SherpaOnnxOnlinePunctuationAddPunct().
void SherpaOnnxCircularBufferPush(const SherpaOnnxCircularBuffer *buffer, const float *p, int32_t n)
Append samples to a circular buffer.
const char * SherpaOnnxGetOnlineStreamResultAsJson(const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream)
Get the current streaming ASR result as JSON.
struct SherpaOnnxOnlineSpeechDenoiser SherpaOnnxOnlineSpeechDenoiser
Opaque online speech denoiser handle.
Definition c-api.h:4217
const SherpaOnnxOnlinePunctuation * SherpaOnnxCreateOnlinePunctuation(const SherpaOnnxOnlinePunctuationConfig *config)
Create an online punctuation processor.
struct SherpaOnnxOnlineStream SherpaOnnxOnlineStream
Streaming decoding state for one utterance or stream.
Definition c-api.h:426
void SherpaOnnxDestroyLinearResampler(const SherpaOnnxLinearResampler *p)
Destroy a linear resampler.
const SherpaOnnxDenoisedAudio * SherpaOnnxOnlineSpeechDenoiserRun(const SherpaOnnxOnlineSpeechDenoiser *sd, const float *samples, int32_t n, int32_t sample_rate)
Process one chunk of streaming audio.
const SherpaOnnxOfflineSourceSeparation * SherpaOnnxCreateOfflineSourceSeparation(const SherpaOnnxOfflineSourceSeparationConfig *config)
Create a source-separation engine.
void SherpaOnnxDestroyOfflineRecognizer(const SherpaOnnxOfflineRecognizer *recognizer)
Destroy a non-streaming recognizer.
void SherpaOnnxLinearResamplerReset(const SherpaOnnxLinearResampler *p)
Reset a linear resampler to its initial state.
void SherpaOnnxDestroyOnlineRecognizerResult(const SherpaOnnxOnlineRecognizerResult *r)
Destroy a result returned by SherpaOnnxGetOnlineStreamResult().
const SherpaOnnxAudioEvent *const * SherpaOnnxAudioTaggingCompute(const SherpaOnnxAudioTagging *tagger, const SherpaOnnxOfflineStream *s, int32_t top_k)
Run audio tagging on an offline stream.
void SherpaOnnxLinearResamplerResampleFree(const SherpaOnnxResampleOut *p)
Destroy a resampler output chunk.
int32_t SherpaOnnxOfflineSourceSeparationGetOutputSampleRate(const SherpaOnnxOfflineSourceSeparation *ss)
Return the output sample rate of the source-separation engine.
void SherpaOnnxDecodeMultipleKeywordStreams(const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream **streams, int32_t n)
Decode multiple ready keyword streams in parallel.
int32_t SherpaOnnxCircularBufferSize(const SherpaOnnxCircularBuffer *buffer)
Return the number of currently stored samples.
void SherpaOnnxVoiceActivityDetectorReset(const SherpaOnnxVoiceActivityDetector *p)
Reset a voice activity detector so it can process a new stream.
const SherpaOnnxOnlineSpeechDenoiser * SherpaOnnxCreateOnlineSpeechDenoiser(const SherpaOnnxOnlineSpeechDenoiserConfig *config)
Create an online speech denoiser.
int32_t(* SherpaOnnxGeneratedAudioProgressCallback)(const float *samples, int32_t n, float p)
Progress callback invoked during incremental generation.
Definition c-api.h:2496
void SherpaOnnxDestroyOfflineTtsGeneratedAudio(const SherpaOnnxGeneratedAudio *p)
Destroy audio returned by a TTS generation API.
const SherpaOnnxOfflineStream * SherpaOnnxAudioTaggingCreateOfflineStream(const SherpaOnnxAudioTagging *tagger)
Create an offline stream for audio tagging.
const char * SherpaOfflinePunctuationAddPunct(const SherpaOnnxOfflinePunctuation *punct, const char *text)
Add punctuation to a complete input text.
int32_t SherpaOnnxVoiceActivityDetectorEmpty(const SherpaOnnxVoiceActivityDetector *p)
Check whether the detector currently has any completed speech segment.
int32_t SherpaOnnxIsOnlineStreamReady(const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream)
Check whether a streaming ASR stream is ready to decode.
int32_t SherpaOnnxSpeakerEmbeddingExtractorIsReady(const SherpaOnnxSpeakerEmbeddingExtractor *p, const SherpaOnnxOnlineStream *s)
Check whether enough audio has been provided to compute an embedding.
void SherpaOnnxCircularBufferPop(const SherpaOnnxCircularBuffer *buffer, int32_t n)
Drop samples from the front of a circular buffer.
int32_t SherpaOnnxOnlineSpeechDenoiserGetFrameShiftInSamples(const SherpaOnnxOnlineSpeechDenoiser *sd)
Return the recommended chunk size in samples for streaming input.
void SherpaOnnxSpeakerEmbeddingManagerFreeSearch(const char *name)
Free a string returned by SherpaOnnxSpeakerEmbeddingManagerSearch().
void SherpaOnnxDestroySpeakerEmbeddingExtractor(const SherpaOnnxSpeakerEmbeddingExtractor *p)
Destroy a speaker embedding extractor.
const SherpaOnnxOfflineSpeakerDiarization * SherpaOnnxCreateOfflineSpeakerDiarization(const SherpaOnnxOfflineSpeakerDiarizationConfig *config)
Create an offline speaker diarization pipeline.
struct SherpaOnnxOfflineRecognizer SherpaOnnxOfflineRecognizer
Non-streaming recognizer handle.
Definition c-api.h:1196
const char * SherpaOnnxSpeakerEmbeddingManagerSearch(const SherpaOnnxSpeakerEmbeddingManager *p, const float *v, float threshold)
Search for the best matching enrolled speaker.
void SherpaOnnxOfflineSpeakerDiarizationDestroyResult(const SherpaOnnxOfflineSpeakerDiarizationResult *r)
Destroy a diarization result.
const SherpaOnnxSpeakerEmbeddingManager * SherpaOnnxCreateSpeakerEmbeddingManager(int32_t dim)
Create a speaker embedding manager.
int32_t SherpaOnnxLinearResamplerResampleGetOutputSampleRate(const SherpaOnnxLinearResampler *p)
Return the resampler output sample rate.
const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithProgressCallback(const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid, float speed, SherpaOnnxGeneratedAudioProgressCallback callback)
Generate speech with a progress callback.
void SherpaOnnxDestroyAudioTagging(const SherpaOnnxAudioTagging *tagger)
Destroy an audio tagger.
int32_t SherpaOnnxOfflineTtsSampleRate(const SherpaOnnxOfflineTts *tts)
Return the output sample rate of a TTS engine.
void SherpaOnnxOfflineSpeakerDiarizationSetConfig(const SherpaOnnxOfflineSpeakerDiarization *sd, const SherpaOnnxOfflineSpeakerDiarizationConfig *config)
Update clustering-related settings of an existing diarizer.
void SherpaOnnxDestroyCircularBuffer(const SherpaOnnxCircularBuffer *buffer)
Destroy a circular buffer.
void SherpaOnnxDestroyOfflineStreamResultJson(const char *s)
Free a JSON string returned by SherpaOnnxGetOfflineStreamResultAsJson().
const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithCallback(const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid, float speed, SherpaOnnxGeneratedAudioCallback callback)
Generate speech and receive incremental audio chunks through a callback.
int32_t SherpaOnnxOfflineSpeakerDiarizationGetSampleRate(const SherpaOnnxOfflineSpeakerDiarization *sd)
Return the expected input sample rate.
void SherpaOnnxAcceptWaveformOffline(const SherpaOnnxOfflineStream *stream, int32_t sample_rate, const float *samples, int32_t n)
Provide the full utterance to an offline ASR stream.
const char *const * SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers(const SherpaOnnxSpeakerEmbeddingManager *p)
Return all enrolled speaker names.
const SherpaOnnxOnlineRecognizerResult * SherpaOnnxGetOnlineStreamResult(const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream)
Get the current streaming ASR result for a stream.
struct SherpaOnnxSpeakerEmbeddingManager SherpaOnnxSpeakerEmbeddingManager
Opaque speaker embedding manager handle.
Definition c-api.h:3204
struct SherpaOnnxKeywordSpotter SherpaOnnxKeywordSpotter
Opaque keyword spotter handle.
Definition c-api.h:1707
int32_t SherpaOnnxSpeakerEmbeddingManagerContains(const SherpaOnnxSpeakerEmbeddingManager *p, const char *name)
Check whether a speaker is enrolled.
int32_t SherpaOnnxOfflineStreamHasOption(const SherpaOnnxOfflineStream *stream, const char *key)
Check whether a per-stream runtime option exists.
void SherpaOnnxDestroyOnlineRecognizer(const SherpaOnnxOnlineRecognizer *recognizer)
Destroy a streaming recognizer.
void SherpaOnnxWriteWaveToBuffer(const float *samples, int32_t n, int32_t sample_rate, char *buffer)
Write a mono 16-bit WAVE file to a caller-provided buffer.
int32_t SherpaOnnxSpeakerEmbeddingManagerVerify(const SherpaOnnxSpeakerEmbeddingManager *p, const char *name, const float *v, float threshold)
Verify whether a query embedding matches a named speaker.
struct SherpaOnnxOnlinePunctuation SherpaOnnxOnlinePunctuation
Opaque online punctuation handle.
Definition c-api.h:3674
const SherpaOnnxOfflineStream * SherpaOnnxCreateOfflineStreamWithHotwords(const SherpaOnnxOfflineRecognizer *recognizer, const char *hotwords)
Create a non-streaming ASR input stream with per-stream hotwords.
int32_t SherpaOnnxCircularBufferHead(const SherpaOnnxCircularBuffer *buffer)
Return the current head index of the buffer timeline.
struct SherpaOnnxOnlineRecognizer SherpaOnnxOnlineRecognizer
Streaming recognizer handle.
Definition c-api.h:424
void SherpaOnnxDestroyOfflineSpeechDenoiser(const SherpaOnnxOfflineSpeechDenoiser *sd)
Destroy an offline speech denoiser.
int32_t SherpaOnnxOnlineStreamIsEndpoint(const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream)
Check whether endpoint detection has triggered for a stream.
const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerate(const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid, float speed)
Generate speech from text using the simple sid/speed interface.
void SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers(const char *const *names)
Free an array returned by SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers().
const SherpaOnnxDenoisedAudio * SherpaOnnxOfflineSpeechDenoiserRun(const SherpaOnnxOfflineSpeechDenoiser *sd, const float *samples, int32_t n, int32_t sample_rate)
Run offline speech denoising on a complete waveform.
void SherpaOnnxDestroySourceSeparationOutput(const SherpaOnnxSourceSeparationOutput *p)
Destroy the output of a source-separation run.
const SherpaOnnxKeywordSpotter * SherpaOnnxCreateKeywordSpotter(const SherpaOnnxKeywordSpotterConfig *config)
Create a keyword spotter.
void SherpaOnnxVoiceActivityDetectorPop(const SherpaOnnxVoiceActivityDetector *p)
Remove the front speech segment from the detector queue.
struct SherpaOnnxCircularBuffer SherpaOnnxCircularBuffer
Opaque circular-buffer handle used by helper APIs.
Definition c-api.h:1963
void SherpaOnnxDestroyKeywordResult(const SherpaOnnxKeywordResult *r)
Destroy a keyword result snapshot.
void SherpaOnnxOfflineStreamSetOption(const SherpaOnnxOfflineStream *stream, const char *key, const char *value)
Set a per-stream runtime option for offline ASR.
int32_t SherpaOnnxOfflineSpeakerDiarizationResultGetNumSpeakers(const SherpaOnnxOfflineSpeakerDiarizationResult *r)
Return the number of speakers in a diarization result.
const SherpaOnnxOnlineStream * SherpaOnnxCreateKeywordStreamWithKeywords(const SherpaOnnxKeywordSpotter *spotter, const char *keywords)
Create a keyword spotting stream with extra or replacement keywords.
void SherpaOnnxDestroyDisplay(const SherpaOnnxDisplay *display)
Destroy a display helper.
const SherpaOnnxWave * SherpaOnnxReadWaveFromBinaryData(const char *data, int32_t n)
Read a mono 16-bit PCM WAVE file from binary memory.
void SherpaOnnxDestroyOfflineRecognizerResult(const SherpaOnnxOfflineRecognizerResult *r)
Destroy a result returned by SherpaOnnxGetOfflineStreamResult().
const SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult * SherpaOnnxSpeakerEmbeddingManagerGetBestMatches(const SherpaOnnxSpeakerEmbeddingManager *p, const float *v, float threshold, int32_t n)
Return up to n best matches above a similarity threshold.
struct SherpaOnnxOfflineTts SherpaOnnxOfflineTts
Opaque offline TTS handle.
Definition c-api.h:2507
void SherpaOnnxDecodeMultipleOnlineStreams(const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream **streams, int32_t n)
Decode multiple streaming ASR streams in parallel.
int32_t SherpaOnnxFileExists(const char *filename)
Check whether a file exists.
struct SherpaOnnxOfflineSpeakerDiarizationResult SherpaOnnxOfflineSpeakerDiarizationResult
Opaque offline speaker diarization result.
Definition c-api.h:3938
void SherpaOfflinePunctuationFreeText(const char *text)
Free a string returned by SherpaOfflinePunctuationAddPunct().
void SherpaOnnxFreeKeywordResultJson(const char *s)
Free a JSON string returned by SherpaOnnxGetKeywordResultAsJson().
const SherpaOnnxDisplay * SherpaOnnxCreateDisplay(int32_t max_word_per_line)
Create a display helper.
const SherpaOnnxSpokenLanguageIdentification * SherpaOnnxCreateSpokenLanguageIdentification(const SherpaOnnxSpokenLanguageIdentificationConfig *config)
Create a spoken-language identifier.
void SherpaOnnxOfflineSpeakerDiarizationDestroySegment(const SherpaOnnxOfflineSpeakerDiarizationSegment *s)
Destroy a segment array returned by SherpaOnnxOfflineSpeakerDiarizationResultSortByStartTime().
void SherpaOnnxDestroyOfflineSourceSeparation(const SherpaOnnxOfflineSourceSeparation *ss)
Destroy a source-separation engine.
const SherpaOnnxOfflineStream * SherpaOnnxCreateOfflineStream(const SherpaOnnxOfflineRecognizer *recognizer)
Create a non-streaming ASR input stream.
const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithConfig(const SherpaOnnxOfflineTts *tts, const char *text, const SherpaOnnxGenerationConfig *config, SherpaOnnxGeneratedAudioProgressCallbackWithArg callback, void *arg)
Generate speech using the advanced configuration interface.
struct SherpaOnnxLinearResampler SherpaOnnxLinearResampler
Opaque linear resampler handle.
Definition c-api.h:3723
void SherpaOnnxDecodeMultipleOfflineStreams(const SherpaOnnxOfflineRecognizer *recognizer, const SherpaOnnxOfflineStream **streams, int32_t n)
Run offline ASR on multiple streams in parallel.
void SherpaOnnxCircularBufferReset(const SherpaOnnxCircularBuffer *buffer)
Clear a circular buffer and reset its head index.
void SherpaOnnxCircularBufferFree(const float *p)
Free an array returned by SherpaOnnxCircularBufferGet().
int32_t SherpaOnnxOnlineSpeechDenoiserGetSampleRate(const SherpaOnnxOnlineSpeechDenoiser *sd)
Return the expected input sample rate for the online denoiser.
void SherpaOnnxVoiceActivityDetectorAcceptWaveform(const SherpaOnnxVoiceActivityDetector *p, const float *samples, int32_t n)
Feed audio samples to the VAD.
const SherpaOnnxSpokenLanguageIdentificationResult * SherpaOnnxSpokenLanguageIdentificationCompute(const SherpaOnnxSpokenLanguageIdentification *slid, const SherpaOnnxOfflineStream *s)
Run spoken-language identification on an offline stream.
struct SherpaOnnxOfflineSourceSeparation SherpaOnnxOfflineSourceSeparation
Opaque source-separation engine handle.
Definition c-api.h:4331
struct SherpaOnnxOfflineSpeakerDiarization SherpaOnnxOfflineSpeakerDiarization
Opaque offline speaker diarization handle.
Definition c-api.h:3892
const SherpaOnnxOnlineStream * SherpaOnnxSpeakerEmbeddingExtractorCreateStream(const SherpaOnnxSpeakerEmbeddingExtractor *p)
Create a streaming feature buffer for embedding extraction.
const SherpaOnnxDenoisedAudio * SherpaOnnxOnlineSpeechDenoiserFlush(const SherpaOnnxOnlineSpeechDenoiser *sd)
Flush buffered samples and reset the online denoiser.
void SherpaOnnxDestroySpeechSegment(const SherpaOnnxSpeechSegment *p)
Destroy a speech segment returned by SherpaOnnxVoiceActivityDetectorFront().
void SherpaOnnxDestroyOnlineStream(const SherpaOnnxOnlineStream *stream)
Destroy a streaming ASR state object.
void SherpaOnnxDestroyVoiceActivityDetector(const SherpaOnnxVoiceActivityDetector *p)
Destroy a voice activity detector.
const SherpaOnnxOnlineStream * SherpaOnnxCreateOnlineStreamWithHotwords(const SherpaOnnxOnlineRecognizer *recognizer, const char *hotwords)
Create a streaming ASR state object with per-stream hotwords.
void SherpaOnnxVoiceActivityDetectorClear(const SherpaOnnxVoiceActivityDetector *p)
Remove all queued speech segments.
const SherpaOnnxVoiceActivityDetector * SherpaOnnxCreateVoiceActivityDetector(const SherpaOnnxVadModelConfig *config, float buffer_size_in_seconds)
Create a voice activity detector.
const SherpaOnnxSourceSeparationOutput * SherpaOnnxOfflineSourceSeparationProcess(const SherpaOnnxOfflineSourceSeparation *ss, const float *const *samples, int32_t num_channels, int32_t num_samples, int32_t sample_rate)
Run source separation on multi-channel audio.
int64_t SherpaOnnxWaveFileSize(int32_t n_samples)
Return the number of bytes needed for a mono 16-bit WAVE file.
SherpaOnnxOfflineStream * SherpaOnnxSpokenLanguageIdentificationCreateOfflineStream(const SherpaOnnxSpokenLanguageIdentification *slid)
Create an offline stream for spoken-language identification.
const char * SherpaOnnxGetGitSha1()
Return the Git SHA1 used to build the library.
const SherpaOnnxOnlineStream * SherpaOnnxCreateKeywordStream(const SherpaOnnxKeywordSpotter *spotter)
Create a keyword spotting stream using the spotter's built-in keyword list.
int32_t SherpaOnnxOfflineTtsNumSpeakers(const SherpaOnnxOfflineTts *tts)
Return the number of available speaker IDs.
const SherpaOnnxOfflineSpeakerDiarizationSegment * SherpaOnnxOfflineSpeakerDiarizationResultSortByStartTime(const SherpaOnnxOfflineSpeakerDiarizationResult *r)
Return segments sorted by start time.
void SherpaOnnxOnlineStreamReset(const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream)
Reset a streaming ASR stream after an endpoint or utterance boundary.
void SherpaOnnxDestroySpokenLanguageIdentificationResult(const SherpaOnnxSpokenLanguageIdentificationResult *r)
Destroy a spoken-language identification result.
const SherpaOnnxOfflineSpeechDenoiser * SherpaOnnxCreateOfflineSpeechDenoiser(const SherpaOnnxOfflineSpeechDenoiserConfig *config)
Create an offline speech denoiser.
struct SherpaOnnxSpeakerEmbeddingExtractor SherpaOnnxSpeakerEmbeddingExtractor
Opaque speaker embedding extractor handle.
Definition c-api.h:3099
void SherpaOnnxDestroyOnlinePunctuation(const SherpaOnnxOnlinePunctuation *punctuation)
Destroy an online punctuation processor.
int32_t(* SherpaOnnxGeneratedAudioCallbackWithArg)(const float *samples, int32_t n, void *arg)
Same as SherpaOnnxGeneratedAudioCallback but with an extra user pointer.
Definition c-api.h:2484
struct SherpaOnnxAudioTagging SherpaOnnxAudioTagging
Opaque audio tagger handle.
Definition c-api.h:3493
int32_t SherpaOnnxOnlineStreamHasOption(const SherpaOnnxOnlineStream *stream, const char *key)
Check whether a per-stream runtime option exists.
struct SherpaOnnxDisplay SherpaOnnxDisplay
Helper for pretty-printing incremental recognition results.
Definition c-api.h:788
const SherpaOnnxAudioTagging * SherpaOnnxCreateAudioTagging(const SherpaOnnxAudioTaggingConfig *config)
Create an audio tagger.
void SherpaOnnxOnlineStreamInputFinished(const SherpaOnnxOnlineStream *stream)
Signal end-of-input for a streaming ASR stream.
void SherpaOnnxDestroyOfflinePunctuation(const SherpaOnnxOfflinePunctuation *punct)
Destroy an offline punctuation processor.
const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithProgressCallbackWithArg(const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid, float speed, SherpaOnnxGeneratedAudioProgressCallbackWithArg callback, void *arg)
Generate speech with a progress callback that receives a user pointer.
int32_t SherpaOnnxWriteWave(const float *samples, int32_t n, int32_t sample_rate, const char *filename)
Write floating-point PCM to a mono 16-bit WAVE file.
const SherpaOnnxOnlineStream * SherpaOnnxCreateOnlineStream(const SherpaOnnxOnlineRecognizer *recognizer)
Create a streaming ASR state object.
const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithCallbackWithArg(const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid, float speed, SherpaOnnxGeneratedAudioCallbackWithArg callback, void *arg)
Same as SherpaOnnxOfflineTtsGenerateWithCallback() but with a user pointer.
int32_t SherpaOnnxSpeakerEmbeddingExtractorDim(const SherpaOnnxSpeakerEmbeddingExtractor *p)
Return the embedding dimension produced by the extractor.
void SherpaOnnxResetKeywordStream(const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream)
Reset a keyword stream after a keyword is detected.
void SherpaOnnxDecodeOnlineStream(const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream)
Decode one step of a streaming ASR stream.
const SherpaOnnxKeywordResult * SherpaOnnxGetKeywordResult(const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream)
Get the current keyword spotting result for a stream.
const char * SherpaOnnxOnlineStreamGetOption(const SherpaOnnxOnlineStream *stream, const char *key)
Get a per-stream runtime option.
void SherpaOnnxDestroyDenoisedAudio(const SherpaOnnxDenoisedAudio *p)
Destroy denoised audio returned by a speech enhancement API.
struct SherpaOnnxOfflinePunctuation SherpaOnnxOfflinePunctuation
Opaque offline punctuation handle.
Definition c-api.h:3597
const SherpaOnnxOfflineSpeakerDiarizationResult * SherpaOnnxOfflineSpeakerDiarizationProcessWithCallbackNoArg(const SherpaOnnxOfflineSpeakerDiarization *sd, const float *samples, int32_t n, SherpaOnnxOfflineSpeakerDiarizationProgressCallbackNoArg callback)
Run offline speaker diarization with a progress callback that has no user pointer.
void SherpaOnnxSpeakerEmbeddingManagerFreeBestMatches(const SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult *r)
Destroy a best-matches result.
const SherpaOnnxOnlineRecognizer * SherpaOnnxCreateOnlineRecognizer(const SherpaOnnxOnlineRecognizerConfig *config)
Create a streaming ASR recognizer.
const char * SherpaOnnxGetGitDate()
Return the Git build date used to build the library.
int32_t SherpaOnnxOfflineSourceSeparationGetNumberOfStems(const SherpaOnnxOfflineSourceSeparation *ss)
Return the number of stems produced by the engine.
struct SherpaOnnxVoiceActivityDetector SherpaOnnxVoiceActivityDetector
Opaque voice activity detector handle.
Definition c-api.h:2082
int32_t SherpaOnnxLinearResamplerResampleGetInputSampleRate(const SherpaOnnxLinearResampler *p)
Return the resampler input sample rate.
const SherpaOnnxCircularBuffer * SherpaOnnxCreateCircularBuffer(int32_t capacity)
Create a floating-point circular buffer.
int32_t(* SherpaOnnxGeneratedAudioProgressCallbackWithArg)(const float *samples, int32_t n, float p, void *arg)
Same as SherpaOnnxGeneratedAudioProgressCallback but with an extra user pointer.
Definition c-api.h:2503
const char * SherpaOnnxGetVersionStr()
Return the sherpa-onnx version string.
int32_t SherpaOnnxWriteWaveMultiChannel(const float *const *samples, int32_t n, int32_t sample_rate, int32_t num_channels, const char *filename)
Write multi-channel audio to a WAVE file (16-bit PCM).
const SherpaOnnxOfflinePunctuation * SherpaOnnxCreateOfflinePunctuation(const SherpaOnnxOfflinePunctuationConfig *config)
Create an offline punctuation processor.
int32_t SherpaOnnxSpeakerEmbeddingManagerAddListFlattened(const SherpaOnnxSpeakerEmbeddingManager *p, const char *name, const float *v, int32_t n)
Add multiple enrollment embeddings packed in one flat array.
void SherpaOnnxPrint(const SherpaOnnxDisplay *display, int32_t idx, const char *s)
Print one line of text using the display helper.
void SherpaOnnxDestroyOfflineTts(const SherpaOnnxOfflineTts *tts)
Destroy an offline TTS engine.
One audio-tagging prediction.
Definition c-api.h:3483
const char * name
Definition c-api.h:3485
Configuration for audio tagging.
Definition c-api.h:3470
SherpaOnnxAudioTaggingModelConfig model
Definition c-api.h:3472
Audio-tagging model configuration.
Definition c-api.h:3441
SherpaOnnxOfflineZipformerAudioTaggingModelConfig zipformer
Definition c-api.h:3443
Denoised audio returned by offline or online speech enhancement APIs.
Definition c-api.h:4164
const float * samples
Definition c-api.h:4166
Fast clustering configuration.
Definition c-api.h:3855
Feature extraction settings for ASR.
Definition c-api.h:277
Generated waveform returned by TTS APIs.
Definition c-api.h:2460
const float * samples
Definition c-api.h:2462
Generation-time parameters shared by advanced TTS APIs.
Definition c-api.h:2717
const char * reference_text
Definition c-api.h:2731
const float * reference_audio
Definition c-api.h:2725
Configuration for homophone replacement.
Definition c-api.h:294
Snapshot of the current keyword spotting result.
Definition c-api.h:1598
const char * keyword
Definition c-api.h:1605
const char * json
Definition c-api.h:1640
const char *const * tokens_arr
Definition c-api.h:1619
const char * tokens
Definition c-api.h:1612
Configuration for keyword spotting.
Definition c-api.h:1684
SherpaOnnxOnlineModelConfig model_config
Definition c-api.h:1688
SherpaOnnxFeatureConfig feat_config
Definition c-api.h:1686
Decoded multi-channel WAVE file content.
Definition c-api.h:2894
const float *const * samples
Definition c-api.h:2899
Configuration for a Canary model.
Definition c-api.h:875
Configuration for a Cohere Transcribe model.
Definition c-api.h:889
Configuration for a Dolphin model.
Definition c-api.h:955
Configuration for a FireRedAsr CTC model.
Definition c-api.h:911
Configuration for a FireRedAsr encoder/decoder model.
Definition c-api.h:903
Configuration for an offline FunASR Nano model.
Definition c-api.h:979
Configuration for an offline language model.
Definition c-api.h:937
const char * model
Definition c-api.h:939
Configuration for a MedASR CTC model.
Definition c-api.h:1034
Model configuration shared by offline ASR recognizers.
Definition c-api.h:1056
SherpaOnnxOfflineQwen3ASRModelConfig qwen3_asr
Definition c-api.h:1107
SherpaOnnxOfflineParaformerModelConfig paraformer
Definition c-api.h:1060
const char * modeling_unit
Definition c-api.h:1079
SherpaOnnxOfflineDolphinModelConfig dolphin
Definition c-api.h:1091
SherpaOnnxOfflineCanaryModelConfig canary
Definition c-api.h:1095
SherpaOnnxOfflineMoonshineModelConfig moonshine
Definition c-api.h:1087
SherpaOnnxOfflineFunASRNanoModelConfig funasr_nano
Definition c-api.h:1103
const char * telespeech_ctc
Definition c-api.h:1083
SherpaOnnxOfflineFireRedAsrCtcModelConfig fire_red_asr_ctc
Definition c-api.h:1105
SherpaOnnxOfflineOmnilingualAsrCtcModelConfig omnilingual
Definition c-api.h:1099
SherpaOnnxOfflineSenseVoiceModelConfig sense_voice
Definition c-api.h:1085
SherpaOnnxOfflineWhisperModelConfig whisper
Definition c-api.h:1064
SherpaOnnxOfflineTdnnModelConfig tdnn
Definition c-api.h:1066
SherpaOnnxOfflineNemoEncDecCtcModelConfig nemo_ctc
Definition c-api.h:1062
SherpaOnnxOfflineMedAsrCtcModelConfig medasr
Definition c-api.h:1101
SherpaOnnxOfflineFireRedAsrModelConfig fire_red_asr
Definition c-api.h:1089
SherpaOnnxOfflineCohereTranscribeModelConfig cohere_transcribe
Definition c-api.h:1109
SherpaOnnxOfflineZipformerCtcModelConfig zipformer_ctc
Definition c-api.h:1093
SherpaOnnxOfflineTransducerModelConfig transducer
Definition c-api.h:1058
SherpaOnnxOfflineWenetCtcModelConfig wenet_ctc
Definition c-api.h:1097
Configuration for a Moonshine model.
Definition c-api.h:917
Configuration for a non-streaming NeMo CTC model.
Definition c-api.h:847
Configuration for an omnilingual offline CTC model.
Definition c-api.h:973
Configuration for a non-streaming Paraformer model.
Definition c-api.h:841
Configuration for offline punctuation.
Definition c-api.h:3591
SherpaOnnxOfflinePunctuationModelConfig model
Definition c-api.h:3593
Offline punctuation model configuration.
Definition c-api.h:3579
Configuration for an offline Qwen3-ASR model.
Definition c-api.h:1009
Configuration for a non-streaming ASR recognizer.
Definition c-api.h:1166
SherpaOnnxOfflineModelConfig model_config
Definition c-api.h:1170
SherpaOnnxFeatureConfig feat_config
Definition c-api.h:1168
SherpaOnnxHomophoneReplacerConfig hr
Definition c-api.h:1192
SherpaOnnxOfflineLMConfig lm_config
Definition c-api.h:1172
Recognition result for a non-streaming ASR stream.
Definition c-api.h:1460
const char *const * segment_texts_arr
Definition c-api.h:1516
const char *const * tokens_arr
Definition c-api.h:1484
Configuration for a SenseVoice model.
Definition c-api.h:945
Top-level source-separation configuration.
Definition c-api.h:4326
SherpaOnnxOfflineSourceSeparationModelConfig model
Definition c-api.h:4327
Source-separation model configuration.
Definition c-api.h:4317
SherpaOnnxOfflineSourceSeparationUvrModelConfig uvr
Definition c-api.h:4319
SherpaOnnxOfflineSourceSeparationSpleeterModelConfig spleeter
Definition c-api.h:4318
Spleeter source-separation model configuration.
Definition c-api.h:4303
UVR (MDX-Net) source-separation model configuration.
Definition c-api.h:4311
Configuration for offline speaker diarization.
Definition c-api.h:3878
SherpaOnnxFastClusteringConfig clustering
Definition c-api.h:3884
SherpaOnnxSpeakerEmbeddingExtractorConfig embedding
Definition c-api.h:3882
SherpaOnnxOfflineSpeakerSegmentationModelConfig segmentation
Definition c-api.h:3880
Segmentation model configuration for offline speaker diarization.
Definition c-api.h:3837
SherpaOnnxOfflineSpeakerSegmentationPyannoteModelConfig pyannote
Definition c-api.h:3839
Pyannote speaker-segmentation model configuration.
Definition c-api.h:3826
Configuration for offline speech denoising.
Definition c-api.h:4113
SherpaOnnxOfflineSpeechDenoiserModelConfig model
Definition c-api.h:4115
DPDFNet offline denoiser model configuration.
Definition c-api.h:4088
GTCRN offline denoiser model configuration.
Definition c-api.h:4082
Speech denoiser model configuration shared by offline and online APIs.
Definition c-api.h:4099
SherpaOnnxOfflineSpeechDenoiserGtcrnModelConfig gtcrn
Definition c-api.h:4101
SherpaOnnxOfflineSpeechDenoiserDpdfNetModelConfig dpdfnet
Definition c-api.h:4109
Configuration for a TDNN model.
Definition c-api.h:931
Configuration for a non-streaming transducer model.
Definition c-api.h:831
Configuration for offline text-to-speech.
Definition c-api.h:2440
const char * rule_fars
Definition c-api.h:2448
SherpaOnnxOfflineTtsModelConfig model
Definition c-api.h:2442
const char * rule_fsts
Definition c-api.h:2444
Configuration for a Kitten TTS model.
Definition c-api.h:2307
Configuration for a Kokoro TTS model.
Definition c-api.h:2287
Configuration for a Matcha TTS model.
Definition c-api.h:2267
Configuration shared by offline TTS models.
Definition c-api.h:2399
SherpaOnnxOfflineTtsVitsModelConfig vits
Definition c-api.h:2401
SherpaOnnxOfflineTtsKokoroModelConfig kokoro
Definition c-api.h:2411
SherpaOnnxOfflineTtsSupertonicModelConfig supertonic
Definition c-api.h:2419
SherpaOnnxOfflineTtsKittenModelConfig kitten
Definition c-api.h:2413
SherpaOnnxOfflineTtsPocketModelConfig pocket
Definition c-api.h:2417
SherpaOnnxOfflineTtsMatchaModelConfig matcha
Definition c-api.h:2409
SherpaOnnxOfflineTtsZipvoiceModelConfig zipvoice
Definition c-api.h:2415
Configuration for a Pocket TTS model.
Definition c-api.h:2345
Configuration for a Supertonic TTS model.
Definition c-api.h:2365
Configuration for a VITS TTS model.
Definition c-api.h:2247
Configuration for a ZipVoice TTS model.
Definition c-api.h:2321
Configuration for an offline WeNet CTC model.
Definition c-api.h:967
Configuration for a non-streaming Whisper model.
Definition c-api.h:855
Zipformer audio-tagging model configuration.
Definition c-api.h:3418
Configuration for an offline Zipformer CTC model.
Definition c-api.h:961
Configuration for HLG/FST-based online CTC decoding.
Definition c-api.h:286
Model configuration shared by streaming ASR recognizers.
Definition c-api.h:232
const char * model_type
Definition c-api.h:248
SherpaOnnxOnlineZipformer2CtcModelConfig zipformer2_ctc
Definition c-api.h:238
const char * modeling_unit
Definition c-api.h:257
SherpaOnnxOnlineNemoCtcModelConfig nemo_ctc
Definition c-api.h:266
const char * provider
Definition c-api.h:244
SherpaOnnxOnlineToneCtcModelConfig t_one_ctc
Definition c-api.h:268
const char * bpe_vocab
Definition c-api.h:259
const char * tokens_buf
Definition c-api.h:262
SherpaOnnxOnlineTransducerModelConfig transducer
Definition c-api.h:234
SherpaOnnxOnlineParaformerModelConfig paraformer
Definition c-api.h:236
Configuration for a streaming NeMo CTC model.
Definition c-api.h:206
Configuration for a streaming Paraformer model.
Definition c-api.h:190
Configuration for online punctuation.
Definition c-api.h:3668
SherpaOnnxOnlinePunctuationModelConfig model
Definition c-api.h:3670
Online punctuation model configuration.
Definition c-api.h:3654
Configuration for a streaming ASR recognizer.
Definition c-api.h:338
SherpaOnnxOnlineCtcFstDecoderConfig ctc_fst_decoder_config
Definition c-api.h:369
SherpaOnnxOnlineModelConfig model_config
Definition c-api.h:342
SherpaOnnxHomophoneReplacerConfig hr
Definition c-api.h:382
SherpaOnnxFeatureConfig feat_config
Definition c-api.h:340
Incremental recognition result for a streaming ASR stream.
Definition c-api.h:393
const char *const * tokens_arr
Definition c-api.h:405
Configuration for streaming speech denoising.
Definition c-api.h:4211
SherpaOnnxOfflineSpeechDenoiserModelConfig model
Definition c-api.h:4213
Configuration for a streaming T-One CTC model.
Definition c-api.h:212
Configuration for a streaming transducer model.
Definition c-api.h:174
Configuration for a streaming Zipformer2 CTC model.
Definition c-api.h:200
Output chunk returned by SherpaOnnxLinearResamplerResample().
Definition c-api.h:3773
const float * samples
Definition c-api.h:3775
Configuration for a Silero VAD model.
Definition c-api.h:1874
Output of a source-separation run.
Definition c-api.h:4386
const SherpaOnnxSourceSeparationStem * stems
Definition c-api.h:4388
A single stem (one output track) with one or more channels.
Definition c-api.h:4376
Configuration for speaker embedding extraction.
Definition c-api.h:3087
Collection of best speaker matches.
Definition c-api.h:3327
const SherpaOnnxSpeakerEmbeddingManagerSpeakerMatch * matches
Definition c-api.h:3329
One speaker match returned by the best-matches API.
Definition c-api.h:3315
One detected speech segment returned by the VAD.
Definition c-api.h:2072
Configuration for spoken language identification.
Definition c-api.h:2967
SherpaOnnxSpokenLanguageIdentificationWhisperConfig whisper
Definition c-api.h:2969
Result of spoken-language identification.
Definition c-api.h:3024
Whisper-based model files for spoken language identification.
Definition c-api.h:2942
Configuration for a Ten VAD model.
Definition c-api.h:1895
Configuration shared by voice activity detectors.
Definition c-api.h:1947
SherpaOnnxSileroVadModelConfig silero_vad
Definition c-api.h:1949
SherpaOnnxTenVadModelConfig ten_vad
Definition c-api.h:1959
const char * provider
Definition c-api.h:1955
Decoded mono WAVE file content.
Definition c-api.h:2843
int32_t num_samples
Definition c-api.h:2849
const float * samples
Definition c-api.h:2845
int32_t sample_rate
Definition c-api.h:2847