|
sherpa-onnx C API 1.0
Public C API and C++ wrapper for sherpa-onnx
|
Public C API for sherpa-onnx. More...
#include <stdint.h>
Include dependency graph for c-api.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | SherpaOnnxOnlineTransducerModelConfig |
| Configuration for a streaming transducer model. More... | |
| struct | SherpaOnnxOnlineParaformerModelConfig |
| Configuration for a streaming Paraformer model. More... | |
| struct | SherpaOnnxOnlineZipformer2CtcModelConfig |
| Configuration for a streaming Zipformer2 CTC model. More... | |
| struct | SherpaOnnxOnlineNemoCtcModelConfig |
| Configuration for a streaming NeMo CTC model. More... | |
| struct | SherpaOnnxOnlineToneCtcModelConfig |
| Configuration for a streaming T-One CTC model. More... | |
| struct | SherpaOnnxOnlineModelConfig |
| Model configuration shared by streaming ASR recognizers. More... | |
| struct | SherpaOnnxFeatureConfig |
| Feature extraction settings for ASR. More... | |
| struct | SherpaOnnxOnlineCtcFstDecoderConfig |
| Configuration for HLG/FST-based online CTC decoding. More... | |
| struct | SherpaOnnxHomophoneReplacerConfig |
| Configuration for homophone replacement. More... | |
| struct | SherpaOnnxOnlineRecognizerConfig |
| Configuration for a streaming ASR recognizer. More... | |
| struct | SherpaOnnxOnlineRecognizerResult |
| Incremental recognition result for a streaming ASR stream. More... | |
| struct | SherpaOnnxOfflineTransducerModelConfig |
| Configuration for a non-streaming transducer model. More... | |
| struct | SherpaOnnxOfflineParaformerModelConfig |
| Configuration for a non-streaming Paraformer model. More... | |
| struct | SherpaOnnxOfflineNemoEncDecCtcModelConfig |
| Configuration for a non-streaming NeMo CTC model. More... | |
| struct | SherpaOnnxOfflineWhisperModelConfig |
| Configuration for a non-streaming Whisper model. More... | |
| struct | SherpaOnnxOfflineCanaryModelConfig |
| Configuration for a Canary model. More... | |
| struct | SherpaOnnxOfflineCohereTranscribeModelConfig |
| Configuration for a Cohere Transcribe model. More... | |
| struct | SherpaOnnxOfflineFireRedAsrModelConfig |
| Configuration for a FireRedAsr encoder/decoder model. More... | |
| struct | SherpaOnnxOfflineFireRedAsrCtcModelConfig |
| Configuration for a FireRedAsr CTC model. More... | |
| struct | SherpaOnnxOfflineMoonshineModelConfig |
| Configuration for a Moonshine model. More... | |
| struct | SherpaOnnxOfflineTdnnModelConfig |
| Configuration for a TDNN model. More... | |
| struct | SherpaOnnxOfflineLMConfig |
| Configuration for an offline language model. More... | |
| struct | SherpaOnnxOfflineSenseVoiceModelConfig |
| Configuration for a SenseVoice model. More... | |
| struct | SherpaOnnxOfflineDolphinModelConfig |
| Configuration for a Dolphin model. More... | |
| struct | SherpaOnnxOfflineZipformerCtcModelConfig |
| Configuration for an offline Zipformer CTC model. More... | |
| struct | SherpaOnnxOfflineWenetCtcModelConfig |
| Configuration for an offline WeNet CTC model. More... | |
| struct | SherpaOnnxOfflineOmnilingualAsrCtcModelConfig |
| Configuration for an omnilingual offline CTC model. More... | |
| struct | SherpaOnnxOfflineFunASRNanoModelConfig |
| Configuration for an offline FunASR Nano model. More... | |
| struct | SherpaOnnxOfflineQwen3ASRModelConfig |
| Configuration for an offline Qwen3-ASR model. More... | |
| struct | SherpaOnnxOfflineMedAsrCtcModelConfig |
| Configuration for a MedASR CTC model. More... | |
| struct | SherpaOnnxOfflineModelConfig |
| Model configuration shared by offline ASR recognizers. More... | |
| struct | SherpaOnnxOfflineRecognizerConfig |
| Configuration for a non-streaming ASR recognizer. More... | |
| struct | SherpaOnnxOfflineRecognizerResult |
| Recognition result for a non-streaming ASR stream. More... | |
| struct | SherpaOnnxKeywordResult |
| Snapshot of the current keyword spotting result. More... | |
| struct | SherpaOnnxKeywordSpotterConfig |
| Configuration for keyword spotting. More... | |
| struct | SherpaOnnxSileroVadModelConfig |
| Configuration for a Silero VAD model. More... | |
| struct | SherpaOnnxTenVadModelConfig |
| Configuration for a Ten VAD model. More... | |
| struct | SherpaOnnxVadModelConfig |
| Configuration shared by voice activity detectors. More... | |
| struct | SherpaOnnxSpeechSegment |
| One detected speech segment returned by the VAD. More... | |
| struct | SherpaOnnxOfflineTtsVitsModelConfig |
| Configuration for a VITS TTS model. More... | |
| struct | SherpaOnnxOfflineTtsMatchaModelConfig |
| Configuration for a Matcha TTS model. More... | |
| struct | SherpaOnnxOfflineTtsKokoroModelConfig |
| Configuration for a Kokoro TTS model. More... | |
| struct | SherpaOnnxOfflineTtsKittenModelConfig |
| Configuration for a Kitten TTS model. More... | |
| struct | SherpaOnnxOfflineTtsZipvoiceModelConfig |
| Configuration for a ZipVoice TTS model. More... | |
| struct | SherpaOnnxOfflineTtsPocketModelConfig |
| Configuration for a Pocket TTS model. More... | |
| struct | SherpaOnnxOfflineTtsSupertonicModelConfig |
| Configuration for a Supertonic TTS model. More... | |
| struct | SherpaOnnxOfflineTtsModelConfig |
| Configuration shared by offline TTS models. More... | |
| struct | SherpaOnnxOfflineTtsConfig |
| Configuration for offline text-to-speech. More... | |
| struct | SherpaOnnxGeneratedAudio |
| Generated waveform returned by TTS APIs. More... | |
| struct | SherpaOnnxGenerationConfig |
| Generation-time parameters shared by advanced TTS APIs. More... | |
| struct | SherpaOnnxWave |
| Decoded mono WAVE file content. More... | |
| struct | SherpaOnnxMultiChannelWave |
| Decoded multi-channel WAVE file content. More... | |
| struct | SherpaOnnxSpokenLanguageIdentificationWhisperConfig |
| Whisper-based model files for spoken language identification. More... | |
| struct | SherpaOnnxSpokenLanguageIdentificationConfig |
| Configuration for spoken language identification. More... | |
| struct | SherpaOnnxSpokenLanguageIdentificationResult |
| Result of spoken-language identification. More... | |
| struct | SherpaOnnxSpeakerEmbeddingExtractorConfig |
| Configuration for speaker embedding extraction. More... | |
| struct | SherpaOnnxSpeakerEmbeddingManagerSpeakerMatch |
| One speaker match returned by the best-matches API. More... | |
| struct | SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult |
| Collection of best speaker matches. More... | |
| struct | SherpaOnnxOfflineZipformerAudioTaggingModelConfig |
| Zipformer audio-tagging model configuration. More... | |
| struct | SherpaOnnxAudioTaggingModelConfig |
| Audio-tagging model configuration. More... | |
| struct | SherpaOnnxAudioTaggingConfig |
| Configuration for audio tagging. More... | |
| struct | SherpaOnnxAudioEvent |
| One audio-tagging prediction. More... | |
| struct | SherpaOnnxOfflinePunctuationModelConfig |
| Offline punctuation model configuration. More... | |
| struct | SherpaOnnxOfflinePunctuationConfig |
| Configuration for offline punctuation. More... | |
| struct | SherpaOnnxOnlinePunctuationModelConfig |
| Online punctuation model configuration. More... | |
| struct | SherpaOnnxOnlinePunctuationConfig |
| Configuration for online punctuation. More... | |
| struct | SherpaOnnxResampleOut |
| Output chunk returned by SherpaOnnxLinearResamplerResample(). More... | |
| struct | SherpaOnnxOfflineSpeakerSegmentationPyannoteModelConfig |
| Pyannote speaker-segmentation model configuration. More... | |
| struct | SherpaOnnxOfflineSpeakerSegmentationModelConfig |
| Segmentation model configuration for offline speaker diarization. More... | |
| struct | SherpaOnnxFastClusteringConfig |
| Fast clustering configuration. More... | |
| struct | SherpaOnnxOfflineSpeakerDiarizationConfig |
| Configuration for offline speaker diarization. More... | |
| struct | SherpaOnnxOfflineSpeakerDiarizationSegment |
| One diarization segment. More... | |
| struct | SherpaOnnxOfflineSpeechDenoiserGtcrnModelConfig |
| GTCRN offline denoiser model configuration. More... | |
| struct | SherpaOnnxOfflineSpeechDenoiserDpdfNetModelConfig |
| DPDFNet offline denoiser model configuration. More... | |
| struct | SherpaOnnxOfflineSpeechDenoiserModelConfig |
| Speech denoiser model configuration shared by offline and online APIs. More... | |
| struct | SherpaOnnxOfflineSpeechDenoiserConfig |
| Configuration for offline speech denoising. More... | |
| struct | SherpaOnnxDenoisedAudio |
| Denoised audio returned by offline or online speech enhancement APIs. More... | |
| struct | SherpaOnnxOnlineSpeechDenoiserConfig |
| Configuration for streaming speech denoising. More... | |
| struct | SherpaOnnxOfflineSourceSeparationSpleeterModelConfig |
| Spleeter source-separation model configuration. More... | |
| struct | SherpaOnnxOfflineSourceSeparationUvrModelConfig |
| UVR (MDX-Net) source-separation model configuration. More... | |
| struct | SherpaOnnxOfflineSourceSeparationModelConfig |
| Source-separation model configuration. More... | |
| struct | SherpaOnnxOfflineSourceSeparationConfig |
| Top-level source-separation configuration. More... | |
| struct | SherpaOnnxSourceSeparationStem |
| A single stem (one output track) with one or more channels. More... | |
| struct | SherpaOnnxSourceSeparationOutput |
| Output of a source-separation run. More... | |
Macros | |
| #define | SHERPA_ONNX_EXPORT __attribute__((visibility("default"))) |
| #define | SHERPA_ONNX_IMPORT SHERPA_ONNX_EXPORT |
| #define | SHERPA_ONNX_API SHERPA_ONNX_IMPORT |
Functions | |
| const char * | SherpaOnnxGetVersionStr () |
| Return the sherpa-onnx version string. | |
| const char * | SherpaOnnxGetGitSha1 () |
| Return the Git SHA1 used to build the library. | |
| const char * | SherpaOnnxGetGitDate () |
| Return the Git build date used to build the library. | |
| int32_t | SherpaOnnxFileExists (const char *filename) |
| Check whether a file exists. | |
| const SherpaOnnxOnlineRecognizer * | SherpaOnnxCreateOnlineRecognizer (const SherpaOnnxOnlineRecognizerConfig *config) |
| Create a streaming ASR recognizer. | |
| void | SherpaOnnxDestroyOnlineRecognizer (const SherpaOnnxOnlineRecognizer *recognizer) |
| Destroy a streaming recognizer. | |
| const SherpaOnnxOnlineStream * | SherpaOnnxCreateOnlineStream (const SherpaOnnxOnlineRecognizer *recognizer) |
| Create a streaming ASR state object. | |
| const SherpaOnnxOnlineStream * | SherpaOnnxCreateOnlineStreamWithHotwords (const SherpaOnnxOnlineRecognizer *recognizer, const char *hotwords) |
| Create a streaming ASR state object with per-stream hotwords. | |
| void | SherpaOnnxDestroyOnlineStream (const SherpaOnnxOnlineStream *stream) |
| Destroy a streaming ASR state object. | |
| void | SherpaOnnxOnlineStreamAcceptWaveform (const SherpaOnnxOnlineStream *stream, int32_t sample_rate, const float *samples, int32_t n) |
| Append audio samples to a streaming ASR stream. | |
| int32_t | SherpaOnnxIsOnlineStreamReady (const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream) |
| Check whether a streaming ASR stream is ready to decode. | |
| void | SherpaOnnxDecodeOnlineStream (const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream) |
| Decode one step of a streaming ASR stream. | |
| void | SherpaOnnxDecodeMultipleOnlineStreams (const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream **streams, int32_t n) |
| Decode multiple streaming ASR streams in parallel. | |
| const SherpaOnnxOnlineRecognizerResult * | SherpaOnnxGetOnlineStreamResult (const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream) |
| Get the current streaming ASR result for a stream. | |
| void | SherpaOnnxDestroyOnlineRecognizerResult (const SherpaOnnxOnlineRecognizerResult *r) |
| Destroy a result returned by SherpaOnnxGetOnlineStreamResult(). | |
| const char * | SherpaOnnxGetOnlineStreamResultAsJson (const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream) |
| Get the current streaming ASR result as JSON. | |
| void | SherpaOnnxDestroyOnlineStreamResultJson (const char *s) |
| Free a JSON string returned by SherpaOnnxGetOnlineStreamResultAsJson(). | |
| void | SherpaOnnxOnlineStreamReset (const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream) |
| Reset a streaming ASR stream after an endpoint or utterance boundary. | |
| void | SherpaOnnxOnlineStreamInputFinished (const SherpaOnnxOnlineStream *stream) |
| Signal end-of-input for a streaming ASR stream. | |
| void | SherpaOnnxOnlineStreamSetOption (const SherpaOnnxOnlineStream *stream, const char *key, const char *value) |
| Set a per-stream runtime option. | |
| const char * | SherpaOnnxOnlineStreamGetOption (const SherpaOnnxOnlineStream *stream, const char *key) |
| Get a per-stream runtime option. | |
| int32_t | SherpaOnnxOnlineStreamHasOption (const SherpaOnnxOnlineStream *stream, const char *key) |
| Check whether a per-stream runtime option exists. | |
| int32_t | SherpaOnnxOnlineStreamIsEndpoint (const SherpaOnnxOnlineRecognizer *recognizer, const SherpaOnnxOnlineStream *stream) |
| Check whether endpoint detection has triggered for a stream. | |
| const SherpaOnnxDisplay * | SherpaOnnxCreateDisplay (int32_t max_word_per_line) |
| Create a display helper. | |
| void | SherpaOnnxDestroyDisplay (const SherpaOnnxDisplay *display) |
| Destroy a display helper. | |
| void | SherpaOnnxPrint (const SherpaOnnxDisplay *display, int32_t idx, const char *s) |
| Print one line of text using the display helper. | |
| const SherpaOnnxOfflineRecognizer * | SherpaOnnxCreateOfflineRecognizer (const SherpaOnnxOfflineRecognizerConfig *config) |
| Create a non-streaming ASR recognizer. | |
| void | SherpaOnnxOfflineRecognizerSetConfig (const SherpaOnnxOfflineRecognizer *recognizer, const SherpaOnnxOfflineRecognizerConfig *config) |
| Update the configuration of an existing offline recognizer. | |
| void | SherpaOnnxDestroyOfflineRecognizer (const SherpaOnnxOfflineRecognizer *recognizer) |
| Destroy a non-streaming recognizer. | |
| const SherpaOnnxOfflineStream * | SherpaOnnxCreateOfflineStream (const SherpaOnnxOfflineRecognizer *recognizer) |
| Create a non-streaming ASR input stream. | |
| const SherpaOnnxOfflineStream * | SherpaOnnxCreateOfflineStreamWithHotwords (const SherpaOnnxOfflineRecognizer *recognizer, const char *hotwords) |
| Create a non-streaming ASR input stream with per-stream hotwords. | |
| void | SherpaOnnxDestroyOfflineStream (const SherpaOnnxOfflineStream *stream) |
| Destroy a non-streaming ASR stream. | |
| void | SherpaOnnxAcceptWaveformOffline (const SherpaOnnxOfflineStream *stream, int32_t sample_rate, const float *samples, int32_t n) |
| Provide the full utterance to an offline ASR stream. | |
| void | SherpaOnnxOfflineStreamSetOption (const SherpaOnnxOfflineStream *stream, const char *key, const char *value) |
| Set a per-stream runtime option for offline ASR. | |
| const char * | SherpaOnnxOfflineStreamGetOption (const SherpaOnnxOfflineStream *stream, const char *key) |
| Get a per-stream runtime option for offline ASR. | |
| int32_t | SherpaOnnxOfflineStreamHasOption (const SherpaOnnxOfflineStream *stream, const char *key) |
| Check whether a per-stream runtime option exists. | |
| void | SherpaOnnxDecodeOfflineStream (const SherpaOnnxOfflineRecognizer *recognizer, const SherpaOnnxOfflineStream *stream) |
| Run offline ASR on one stream. | |
| void | SherpaOnnxDecodeMultipleOfflineStreams (const SherpaOnnxOfflineRecognizer *recognizer, const SherpaOnnxOfflineStream **streams, int32_t n) |
| Run offline ASR on multiple streams in parallel. | |
| const SherpaOnnxOfflineRecognizerResult * | SherpaOnnxGetOfflineStreamResult (const SherpaOnnxOfflineStream *stream) |
| Get the recognition result for an offline ASR stream. | |
| void | SherpaOnnxDestroyOfflineRecognizerResult (const SherpaOnnxOfflineRecognizerResult *r) |
| Destroy a result returned by SherpaOnnxGetOfflineStreamResult(). | |
| const char * | SherpaOnnxGetOfflineStreamResultAsJson (const SherpaOnnxOfflineStream *stream) |
| Get the offline ASR result as JSON. | |
| void | SherpaOnnxDestroyOfflineStreamResultJson (const char *s) |
| Free a JSON string returned by SherpaOnnxGetOfflineStreamResultAsJson(). | |
| const SherpaOnnxKeywordSpotter * | SherpaOnnxCreateKeywordSpotter (const SherpaOnnxKeywordSpotterConfig *config) |
| Create a keyword spotter. | |
| void | SherpaOnnxDestroyKeywordSpotter (const SherpaOnnxKeywordSpotter *spotter) |
| Destroy a keyword spotter. | |
| const SherpaOnnxOnlineStream * | SherpaOnnxCreateKeywordStream (const SherpaOnnxKeywordSpotter *spotter) |
| Create a keyword spotting stream using the spotter's built-in keyword list. | |
| const SherpaOnnxOnlineStream * | SherpaOnnxCreateKeywordStreamWithKeywords (const SherpaOnnxKeywordSpotter *spotter, const char *keywords) |
| Create a keyword spotting stream with extra or replacement keywords. | |
| int32_t | SherpaOnnxIsKeywordStreamReady (const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream) |
| Check whether a keyword stream has enough audio for decoding. | |
| void | SherpaOnnxDecodeKeywordStream (const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream) |
| Decode one ready keyword stream. | |
| void | SherpaOnnxResetKeywordStream (const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream) |
| Reset a keyword stream after a keyword is detected. | |
| void | SherpaOnnxDecodeMultipleKeywordStreams (const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream **streams, int32_t n) |
| Decode multiple ready keyword streams in parallel. | |
| const SherpaOnnxKeywordResult * | SherpaOnnxGetKeywordResult (const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream) |
| Get the current keyword spotting result for a stream. | |
| void | SherpaOnnxDestroyKeywordResult (const SherpaOnnxKeywordResult *r) |
| Destroy a keyword result snapshot. | |
| const char * | SherpaOnnxGetKeywordResultAsJson (const SherpaOnnxKeywordSpotter *spotter, const SherpaOnnxOnlineStream *stream) |
| Get the current keyword spotting result as JSON. | |
| void | SherpaOnnxFreeKeywordResultJson (const char *s) |
| Free a JSON string returned by SherpaOnnxGetKeywordResultAsJson(). | |
| const SherpaOnnxCircularBuffer * | SherpaOnnxCreateCircularBuffer (int32_t capacity) |
| Create a floating-point circular buffer. | |
| void | SherpaOnnxDestroyCircularBuffer (const SherpaOnnxCircularBuffer *buffer) |
| Destroy a circular buffer. | |
| void | SherpaOnnxCircularBufferPush (const SherpaOnnxCircularBuffer *buffer, const float *p, int32_t n) |
| Append samples to a circular buffer. | |
| const float * | SherpaOnnxCircularBufferGet (const SherpaOnnxCircularBuffer *buffer, int32_t start_index, int32_t n) |
| Copy out a slice of samples from a circular buffer. | |
| void | SherpaOnnxCircularBufferFree (const float *p) |
| Free an array returned by SherpaOnnxCircularBufferGet(). | |
| void | SherpaOnnxCircularBufferPop (const SherpaOnnxCircularBuffer *buffer, int32_t n) |
| Drop samples from the front of a circular buffer. | |
| int32_t | SherpaOnnxCircularBufferSize (const SherpaOnnxCircularBuffer *buffer) |
| Return the number of currently stored samples. | |
| int32_t | SherpaOnnxCircularBufferHead (const SherpaOnnxCircularBuffer *buffer) |
| Return the current head index of the buffer timeline. | |
| void | SherpaOnnxCircularBufferReset (const SherpaOnnxCircularBuffer *buffer) |
| Clear a circular buffer and reset its head index. | |
| const SherpaOnnxVoiceActivityDetector * | SherpaOnnxCreateVoiceActivityDetector (const SherpaOnnxVadModelConfig *config, float buffer_size_in_seconds) |
| Create a voice activity detector. | |
| void | SherpaOnnxDestroyVoiceActivityDetector (const SherpaOnnxVoiceActivityDetector *p) |
| Destroy a voice activity detector. | |
| void | SherpaOnnxVoiceActivityDetectorAcceptWaveform (const SherpaOnnxVoiceActivityDetector *p, const float *samples, int32_t n) |
| Feed audio samples to the VAD. | |
| int32_t | SherpaOnnxVoiceActivityDetectorEmpty (const SherpaOnnxVoiceActivityDetector *p) |
| Check whether the detector currently has any completed speech segment. | |
| int32_t | SherpaOnnxVoiceActivityDetectorDetected (const SherpaOnnxVoiceActivityDetector *p) |
| Check whether the detector is currently inside speech. | |
| void | SherpaOnnxVoiceActivityDetectorPop (const SherpaOnnxVoiceActivityDetector *p) |
| Remove the front speech segment from the detector queue. | |
| void | SherpaOnnxVoiceActivityDetectorClear (const SherpaOnnxVoiceActivityDetector *p) |
| Remove all queued speech segments. | |
| const SherpaOnnxSpeechSegment * | SherpaOnnxVoiceActivityDetectorFront (const SherpaOnnxVoiceActivityDetector *p) |
| Get the first queued speech segment. | |
| void | SherpaOnnxDestroySpeechSegment (const SherpaOnnxSpeechSegment *p) |
| Destroy a speech segment returned by SherpaOnnxVoiceActivityDetectorFront(). | |
| void | SherpaOnnxVoiceActivityDetectorReset (const SherpaOnnxVoiceActivityDetector *p) |
| Reset a voice activity detector so it can process a new stream. | |
| void | SherpaOnnxVoiceActivityDetectorFlush (const SherpaOnnxVoiceActivityDetector *p) |
| Flush buffered tail samples and force final segmentation. | |
| const SherpaOnnxOfflineTts * | SherpaOnnxCreateOfflineTts (const SherpaOnnxOfflineTtsConfig *config) |
| Create an offline TTS engine. | |
| void | SherpaOnnxDestroyOfflineTts (const SherpaOnnxOfflineTts *tts) |
| Destroy an offline TTS engine. | |
| int32_t | SherpaOnnxOfflineTtsSampleRate (const SherpaOnnxOfflineTts *tts) |
| Return the output sample rate of a TTS engine. | |
| int32_t | SherpaOnnxOfflineTtsNumSpeakers (const SherpaOnnxOfflineTts *tts) |
| Return the number of available speaker IDs. | |
| const SherpaOnnxGeneratedAudio * | SherpaOnnxOfflineTtsGenerate (const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid, float speed) |
| Generate speech from text using the simple sid/speed interface. | |
| 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. | |
| const SherpaOnnxGeneratedAudio * | SherpaOnnxOfflineTtsGenerateWithProgressCallback (const SherpaOnnxOfflineTts *tts, const char *text, int32_t sid, float speed, SherpaOnnxGeneratedAudioProgressCallback callback) |
| Generate speech with a progress callback. | |
| 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. | |
| 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. | |
| 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 SherpaOnnxGeneratedAudio * | SherpaOnnxOfflineTtsGenerateWithConfig (const SherpaOnnxOfflineTts *tts, const char *text, const SherpaOnnxGenerationConfig *config, SherpaOnnxGeneratedAudioProgressCallbackWithArg callback, void *arg) |
| Generate speech using the advanced configuration interface. | |
| void | SherpaOnnxDestroyOfflineTtsGeneratedAudio (const SherpaOnnxGeneratedAudio *p) |
| Destroy audio returned by a TTS generation API. | |
| 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. | |
| int64_t | SherpaOnnxWaveFileSize (int32_t n_samples) |
| Return the number of bytes needed for a mono 16-bit WAVE file. | |
| 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 | 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 SherpaOnnxWave * | SherpaOnnxReadWave (const char *filename) |
| Read a mono 16-bit PCM WAVE file. | |
| const SherpaOnnxWave * | SherpaOnnxReadWaveFromBinaryData (const char *data, int32_t n) |
| Read a mono 16-bit PCM WAVE file from binary memory. | |
| void | SherpaOnnxFreeWave (const SherpaOnnxWave *wave) |
| Destroy a wave object returned by SherpaOnnxReadWave() or SherpaOnnxReadWaveFromBinaryData(). | |
| const SherpaOnnxMultiChannelWave * | SherpaOnnxReadWaveMultiChannel (const char *filename) |
| Read a multi-channel 16-bit PCM WAVE file. | |
| void | SherpaOnnxFreeMultiChannelWave (const SherpaOnnxMultiChannelWave *wave) |
| Destroy a multi-channel wave object. | |
| const SherpaOnnxSpokenLanguageIdentification * | SherpaOnnxCreateSpokenLanguageIdentification (const SherpaOnnxSpokenLanguageIdentificationConfig *config) |
| Create a spoken-language identifier. | |
| void | SherpaOnnxDestroySpokenLanguageIdentification (const SherpaOnnxSpokenLanguageIdentification *slid) |
| Destroy a spoken-language identifier. | |
| SherpaOnnxOfflineStream * | SherpaOnnxSpokenLanguageIdentificationCreateOfflineStream (const SherpaOnnxSpokenLanguageIdentification *slid) |
| Create an offline stream for spoken-language identification. | |
| const SherpaOnnxSpokenLanguageIdentificationResult * | SherpaOnnxSpokenLanguageIdentificationCompute (const SherpaOnnxSpokenLanguageIdentification *slid, const SherpaOnnxOfflineStream *s) |
| Run spoken-language identification on an offline stream. | |
| void | SherpaOnnxDestroySpokenLanguageIdentificationResult (const SherpaOnnxSpokenLanguageIdentificationResult *r) |
| Destroy a spoken-language identification result. | |
| const SherpaOnnxSpeakerEmbeddingExtractor * | SherpaOnnxCreateSpeakerEmbeddingExtractor (const SherpaOnnxSpeakerEmbeddingExtractorConfig *config) |
| Create a speaker embedding extractor. | |
| void | SherpaOnnxDestroySpeakerEmbeddingExtractor (const SherpaOnnxSpeakerEmbeddingExtractor *p) |
| Destroy a speaker embedding extractor. | |
| int32_t | SherpaOnnxSpeakerEmbeddingExtractorDim (const SherpaOnnxSpeakerEmbeddingExtractor *p) |
| Return the embedding dimension produced by the extractor. | |
| const SherpaOnnxOnlineStream * | SherpaOnnxSpeakerEmbeddingExtractorCreateStream (const SherpaOnnxSpeakerEmbeddingExtractor *p) |
| Create a streaming feature buffer for embedding extraction. | |
| int32_t | SherpaOnnxSpeakerEmbeddingExtractorIsReady (const SherpaOnnxSpeakerEmbeddingExtractor *p, const SherpaOnnxOnlineStream *s) |
| Check whether enough audio has been provided to compute an embedding. | |
| const float * | SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding (const SherpaOnnxSpeakerEmbeddingExtractor *p, const SherpaOnnxOnlineStream *s) |
| Compute the embedding for a stream. | |
| void | SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding (const float *v) |
| Destroy an embedding vector returned by SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding(). | |
| const SherpaOnnxSpeakerEmbeddingManager * | SherpaOnnxCreateSpeakerEmbeddingManager (int32_t dim) |
| Create a speaker embedding manager. | |
| void | SherpaOnnxDestroySpeakerEmbeddingManager (const SherpaOnnxSpeakerEmbeddingManager *p) |
| Destroy a speaker embedding manager. | |
| int32_t | SherpaOnnxSpeakerEmbeddingManagerAdd (const SherpaOnnxSpeakerEmbeddingManager *p, const char *name, const float *v) |
| Add one enrollment embedding for a speaker. | |
| int32_t | SherpaOnnxSpeakerEmbeddingManagerAddList (const SherpaOnnxSpeakerEmbeddingManager *p, const char *name, const float **v) |
| Add multiple enrollment embeddings for one speaker. | |
| int32_t | SherpaOnnxSpeakerEmbeddingManagerAddListFlattened (const SherpaOnnxSpeakerEmbeddingManager *p, const char *name, const float *v, int32_t n) |
| Add multiple enrollment embeddings packed in one flat array. | |
| int32_t | SherpaOnnxSpeakerEmbeddingManagerRemove (const SherpaOnnxSpeakerEmbeddingManager *p, const char *name) |
| Remove a speaker from the manager. | |
| const char * | SherpaOnnxSpeakerEmbeddingManagerSearch (const SherpaOnnxSpeakerEmbeddingManager *p, const float *v, float threshold) |
| Search for the best matching enrolled speaker. | |
| void | SherpaOnnxSpeakerEmbeddingManagerFreeSearch (const char *name) |
| Free a string returned by SherpaOnnxSpeakerEmbeddingManagerSearch(). | |
| const SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult * | SherpaOnnxSpeakerEmbeddingManagerGetBestMatches (const SherpaOnnxSpeakerEmbeddingManager *p, const float *v, float threshold, int32_t n) |
Return up to n best matches above a similarity threshold. | |
| void | SherpaOnnxSpeakerEmbeddingManagerFreeBestMatches (const SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult *r) |
| Destroy a best-matches result. | |
| int32_t | SherpaOnnxSpeakerEmbeddingManagerVerify (const SherpaOnnxSpeakerEmbeddingManager *p, const char *name, const float *v, float threshold) |
| Verify whether a query embedding matches a named speaker. | |
| int32_t | SherpaOnnxSpeakerEmbeddingManagerContains (const SherpaOnnxSpeakerEmbeddingManager *p, const char *name) |
| Check whether a speaker is enrolled. | |
| int32_t | SherpaOnnxSpeakerEmbeddingManagerNumSpeakers (const SherpaOnnxSpeakerEmbeddingManager *p) |
| Return the number of enrolled speakers. | |
| const char *const * | SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers (const SherpaOnnxSpeakerEmbeddingManager *p) |
| Return all enrolled speaker names. | |
| void | SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers (const char *const *names) |
| Free an array returned by SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers(). | |
| const SherpaOnnxAudioTagging * | SherpaOnnxCreateAudioTagging (const SherpaOnnxAudioTaggingConfig *config) |
| Create an audio tagger. | |
| void | SherpaOnnxDestroyAudioTagging (const SherpaOnnxAudioTagging *tagger) |
| Destroy an audio tagger. | |
| const SherpaOnnxOfflineStream * | SherpaOnnxAudioTaggingCreateOfflineStream (const SherpaOnnxAudioTagging *tagger) |
| Create an offline stream for audio tagging. | |
| const SherpaOnnxAudioEvent *const * | SherpaOnnxAudioTaggingCompute (const SherpaOnnxAudioTagging *tagger, const SherpaOnnxOfflineStream *s, int32_t top_k) |
| Run audio tagging on an offline stream. | |
| void | SherpaOnnxAudioTaggingFreeResults (const SherpaOnnxAudioEvent *const *p) |
| Destroy results returned by SherpaOnnxAudioTaggingCompute(). | |
| const SherpaOnnxOfflinePunctuation * | SherpaOnnxCreateOfflinePunctuation (const SherpaOnnxOfflinePunctuationConfig *config) |
| Create an offline punctuation processor. | |
| void | SherpaOnnxDestroyOfflinePunctuation (const SherpaOnnxOfflinePunctuation *punct) |
| Destroy an offline punctuation processor. | |
| const char * | SherpaOfflinePunctuationAddPunct (const SherpaOnnxOfflinePunctuation *punct, const char *text) |
| Add punctuation to a complete input text. | |
| void | SherpaOfflinePunctuationFreeText (const char *text) |
| Free a string returned by SherpaOfflinePunctuationAddPunct(). | |
| const SherpaOnnxOnlinePunctuation * | SherpaOnnxCreateOnlinePunctuation (const SherpaOnnxOnlinePunctuationConfig *config) |
| Create an online punctuation processor. | |
| void | SherpaOnnxDestroyOnlinePunctuation (const SherpaOnnxOnlinePunctuation *punctuation) |
| Destroy an online punctuation processor. | |
| const char * | SherpaOnnxOnlinePunctuationAddPunct (const SherpaOnnxOnlinePunctuation *punctuation, const char *text) |
| Add punctuation to one text chunk using the online punctuation model. | |
| void | SherpaOnnxOnlinePunctuationFreeText (const char *text) |
| Free a string returned by SherpaOnnxOnlinePunctuationAddPunct(). | |
| 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. | |
| void | SherpaOnnxDestroyLinearResampler (const SherpaOnnxLinearResampler *p) |
| Destroy a linear resampler. | |
| void | SherpaOnnxLinearResamplerReset (const SherpaOnnxLinearResampler *p) |
| Reset a linear resampler to its initial state. | |
| const SherpaOnnxResampleOut * | SherpaOnnxLinearResamplerResample (const SherpaOnnxLinearResampler *p, const float *input, int32_t input_dim, int32_t flush) |
| Resample one chunk of input audio. | |
| void | SherpaOnnxLinearResamplerResampleFree (const SherpaOnnxResampleOut *p) |
| Destroy a resampler output chunk. | |
| int32_t | SherpaOnnxLinearResamplerResampleGetInputSampleRate (const SherpaOnnxLinearResampler *p) |
| Return the resampler input sample rate. | |
| int32_t | SherpaOnnxLinearResamplerResampleGetOutputSampleRate (const SherpaOnnxLinearResampler *p) |
| Return the resampler output sample rate. | |
| const SherpaOnnxOfflineSpeakerDiarization * | SherpaOnnxCreateOfflineSpeakerDiarization (const SherpaOnnxOfflineSpeakerDiarizationConfig *config) |
| Create an offline speaker diarization pipeline. | |
| void | SherpaOnnxDestroyOfflineSpeakerDiarization (const SherpaOnnxOfflineSpeakerDiarization *sd) |
| Destroy an offline speaker diarizer. | |
| int32_t | SherpaOnnxOfflineSpeakerDiarizationGetSampleRate (const SherpaOnnxOfflineSpeakerDiarization *sd) |
| Return the expected input sample rate. | |
| void | SherpaOnnxOfflineSpeakerDiarizationSetConfig (const SherpaOnnxOfflineSpeakerDiarization *sd, const SherpaOnnxOfflineSpeakerDiarizationConfig *config) |
| Update clustering-related settings of an existing diarizer. | |
| int32_t | SherpaOnnxOfflineSpeakerDiarizationResultGetNumSpeakers (const SherpaOnnxOfflineSpeakerDiarizationResult *r) |
| Return the number of speakers in a diarization result. | |
| int32_t | SherpaOnnxOfflineSpeakerDiarizationResultGetNumSegments (const SherpaOnnxOfflineSpeakerDiarizationResult *r) |
| Return the number of diarization segments. | |
| const SherpaOnnxOfflineSpeakerDiarizationSegment * | SherpaOnnxOfflineSpeakerDiarizationResultSortByStartTime (const SherpaOnnxOfflineSpeakerDiarizationResult *r) |
| Return segments sorted by start time. | |
| void | SherpaOnnxOfflineSpeakerDiarizationDestroySegment (const SherpaOnnxOfflineSpeakerDiarizationSegment *s) |
| Destroy a segment array returned by SherpaOnnxOfflineSpeakerDiarizationResultSortByStartTime(). | |
| const SherpaOnnxOfflineSpeakerDiarizationResult * | SherpaOnnxOfflineSpeakerDiarizationProcess (const SherpaOnnxOfflineSpeakerDiarization *sd, const float *samples, int32_t n) |
| Run offline speaker diarization. | |
| 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 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 | SherpaOnnxOfflineSpeakerDiarizationDestroyResult (const SherpaOnnxOfflineSpeakerDiarizationResult *r) |
| Destroy a diarization result. | |
| const SherpaOnnxOfflineSpeechDenoiser * | SherpaOnnxCreateOfflineSpeechDenoiser (const SherpaOnnxOfflineSpeechDenoiserConfig *config) |
| Create an offline speech denoiser. | |
| void | SherpaOnnxDestroyOfflineSpeechDenoiser (const SherpaOnnxOfflineSpeechDenoiser *sd) |
| Destroy an offline speech denoiser. | |
| int32_t | SherpaOnnxOfflineSpeechDenoiserGetSampleRate (const SherpaOnnxOfflineSpeechDenoiser *sd) |
| Return the expected sample rate for the denoiser. | |
| 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 | SherpaOnnxDestroyDenoisedAudio (const SherpaOnnxDenoisedAudio *p) |
| Destroy denoised audio returned by a speech enhancement API. | |
| const SherpaOnnxOnlineSpeechDenoiser * | SherpaOnnxCreateOnlineSpeechDenoiser (const SherpaOnnxOnlineSpeechDenoiserConfig *config) |
| Create an online speech denoiser. | |
| void | SherpaOnnxDestroyOnlineSpeechDenoiser (const SherpaOnnxOnlineSpeechDenoiser *sd) |
| Destroy an online speech denoiser. | |
| int32_t | SherpaOnnxOnlineSpeechDenoiserGetSampleRate (const SherpaOnnxOnlineSpeechDenoiser *sd) |
| Return the expected input sample rate for the online denoiser. | |
| int32_t | SherpaOnnxOnlineSpeechDenoiserGetFrameShiftInSamples (const SherpaOnnxOnlineSpeechDenoiser *sd) |
| Return the recommended chunk size in samples for streaming input. | |
| const SherpaOnnxDenoisedAudio * | SherpaOnnxOnlineSpeechDenoiserRun (const SherpaOnnxOnlineSpeechDenoiser *sd, const float *samples, int32_t n, int32_t sample_rate) |
| Process one chunk of streaming audio. | |
| const SherpaOnnxDenoisedAudio * | SherpaOnnxOnlineSpeechDenoiserFlush (const SherpaOnnxOnlineSpeechDenoiser *sd) |
| Flush buffered samples and reset the online denoiser. | |
| void | SherpaOnnxOnlineSpeechDenoiserReset (const SherpaOnnxOnlineSpeechDenoiser *sd) |
| Reset an online denoiser so it can process a new stream. | |
| const SherpaOnnxOfflineSourceSeparation * | SherpaOnnxCreateOfflineSourceSeparation (const SherpaOnnxOfflineSourceSeparationConfig *config) |
| Create a source-separation engine. | |
| void | SherpaOnnxDestroyOfflineSourceSeparation (const SherpaOnnxOfflineSourceSeparation *ss) |
| Destroy a source-separation engine. | |
| int32_t | SherpaOnnxOfflineSourceSeparationGetOutputSampleRate (const SherpaOnnxOfflineSourceSeparation *ss) |
| Return the output sample rate of the source-separation engine. | |
| int32_t | SherpaOnnxOfflineSourceSeparationGetNumberOfStems (const SherpaOnnxOfflineSourceSeparation *ss) |
| Return the number of stems produced by the engine. | |
| 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. | |
| void | SherpaOnnxDestroySourceSeparationOutput (const SherpaOnnxSourceSeparationOutput *p) |
| Destroy the output of a source-separation run. | |
This header exposes the main sherpa-onnx inference features through a stable C interface. It is intended for native C/C++ applications and for language bindings that need a C ABI.
The file is organized by feature family. The major API groups are:
Common ownership rules:
SherpaOnnxCreate*() functions are generally destroyed with a matching SherpaOnnxDestroy*() functionFree/Destroy APIGeneral usage pattern:
memset(&config, 0, sizeof(config))SherpaOnnxCreate*()The examples in c-api-examples/ show complete end-to-end usage. Useful starting points include:
decode-file-c-api.c for ASRkws-c-api.c for keyword spottingvad-whisper-c-api.c for VADoffline-tts-c-api.c and kokoro-tts-en-c-api.c for TTSspeaker-identification-c-api.c for speaker embedding and verificationaudio-tagging-c-api.c for audio taggingadd-punctuation-c-api.c and add-punctuation-online-c-api.c for punctuationoffline-sepaker-diarization-c-api.c for diarizationspeech-enhancement-gtcrn-c-api.c and online-speech-enhancement-gtcrn-c-api.c for speech enhancement Definition in file c-api.h.
| #define SHERPA_ONNX_API SHERPA_ONNX_IMPORT |
| #define SHERPA_ONNX_EXPORT __attribute__((visibility("default"))) |
| #define SHERPA_ONNX_IMPORT SHERPA_ONNX_EXPORT |
| typedef struct SherpaOnnxAudioEvent SherpaOnnxAudioEvent |
| typedef struct SherpaOnnxAudioTagging SherpaOnnxAudioTagging |
| typedef struct SherpaOnnxAudioTaggingConfig SherpaOnnxAudioTaggingConfig |
Configure exactly one model family. If multiple model families are provided, one of them will be used and the choice is implementation-defined.
Example using sherpa-onnx-zipformer-audio-tagging-2024-04-09:
| typedef struct SherpaOnnxCircularBuffer SherpaOnnxCircularBuffer |
| typedef struct SherpaOnnxDenoisedAudio SherpaOnnxDenoisedAudio |
Free this object with SherpaOnnxDestroyDenoisedAudio().
| typedef struct SherpaOnnxDisplay SherpaOnnxDisplay |
| typedef struct SherpaOnnxFastClusteringConfig SherpaOnnxFastClusteringConfig |
If num_clusters is greater than 0, threshold is ignored. When the number of speakers is known in advance, setting num_clusters is strongly recommended.
| typedef struct SherpaOnnxFeatureConfig SherpaOnnxFeatureConfig |
The bundled ASR models typically expect 16 kHz mono audio and 80-bin features.
| typedef struct SherpaOnnxGeneratedAudio SherpaOnnxGeneratedAudio |
The returned structure owns samples. Free the whole object with SherpaOnnxDestroyOfflineTtsGeneratedAudio().
| typedef int32_t(* SherpaOnnxGeneratedAudioCallback) (const float *samples, int32_t n) |
| typedef int32_t(* SherpaOnnxGeneratedAudioCallbackWithArg) (const float *samples, int32_t n, void *arg) |
| typedef int32_t(* SherpaOnnxGeneratedAudioProgressCallback) (const float *samples, int32_t n, float p) |
| typedef int32_t(* SherpaOnnxGeneratedAudioProgressCallbackWithArg) (const float *samples, int32_t n, float p, void *arg) |
| typedef struct SherpaOnnxGenerationConfig SherpaOnnxGenerationConfig |
This struct supports both simple multi-speaker synthesis and more advanced zero-shot or reference-conditioned models.
Example for Pocket TTS:
| typedef struct SherpaOnnxKeywordResult SherpaOnnxKeywordResult |
Free this object with SherpaOnnxDestroyKeywordResult().
| typedef struct SherpaOnnxKeywordSpotter SherpaOnnxKeywordSpotter |
| typedef struct SherpaOnnxKeywordSpotterConfig SherpaOnnxKeywordSpotterConfig |
The acoustic model is configured through model_config. In practice this is usually a streaming transducer model.
Keyword definitions can be provided either through keywords_file or through keywords_buf/ If both are set, the buffer is used.keywords_buf_size.
Example using sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01-mobile:
| typedef struct SherpaOnnxLinearResampler SherpaOnnxLinearResampler |
| typedef struct SherpaOnnxMultiChannelWave SherpaOnnxMultiChannelWave |
Free this object with SherpaOnnxFreeMultiChannelWave().
| typedef struct SherpaOnnxOfflineCohereTranscribeModelConfig SherpaOnnxOfflineCohereTranscribeModelConfig |
| typedef struct SherpaOnnxOfflineLMConfig SherpaOnnxOfflineLMConfig |
| typedef struct SherpaOnnxOfflineModelConfig SherpaOnnxOfflineModelConfig |
Zero-initialize this struct before use, then fill in exactly the sub-config needed by the model family you want to run.
Exactly one model family should be configured for each recognizer. For example, set only one of transducer, paraformer, nemo_ctc, whisper, tdnn, sense_voice, moonshine, fire_red_asr, dolphin, zipformer_ctc, canary, cohere_transcribe, wenet_ctc, omnilingual, medasr, funasr_nano, fire_red_asr_ctc, or qwen3_asr.
If multiple model families are configured at the same time, the implementation will choose one of them, and which one is used is implementation-defined. Do not rely on any precedence rule.
| typedef struct SherpaOnnxOfflineOmnilingualAsrCtcModelConfig SherpaOnnxOfflineOmnilingualAsrCtcModelConfig |
| typedef struct SherpaOnnxOfflinePunctuation SherpaOnnxOfflinePunctuation |
Example:
| typedef struct SherpaOnnxOfflineRecognizer SherpaOnnxOfflineRecognizer |
Zero-initialize this struct before use.
Example using Whisper:
Example using SenseVoice:
Example using Parakeet TDT:
All pointers in this struct are owned by the result object returned from SherpaOnnxGetOfflineStreamResult() and become invalid after SherpaOnnxDestroyOfflineRecognizerResult() is called.
| typedef struct SherpaOnnxOfflineSourceSeparationModelConfig SherpaOnnxOfflineSourceSeparationModelConfig |
| typedef struct SherpaOnnxOfflineSourceSeparationSpleeterModelConfig SherpaOnnxOfflineSourceSeparationSpleeterModelConfig |
| typedef struct SherpaOnnxOfflineSourceSeparationUvrModelConfig SherpaOnnxOfflineSourceSeparationUvrModelConfig |
Example based on offline-sepaker-diarization-c-api.c:
| typedef int32_t(* SherpaOnnxOfflineSpeakerDiarizationProgressCallback) (int32_t num_processed_chunks, int32_t num_total_chunks, void *arg) |
| typedef int32_t(* SherpaOnnxOfflineSpeakerDiarizationProgressCallbackNoArg) (int32_t num_processed_chunks, int32_t num_total_chunks) |
| typedef struct SherpaOnnxOfflineSpeakerDiarizationSegment SherpaOnnxOfflineSpeakerDiarizationSegment |
| typedef struct SherpaOnnxOfflineSpeakerSegmentationModelConfig SherpaOnnxOfflineSpeakerSegmentationModelConfig |
Configure exactly one model family. If multiple model families are provided, one is chosen and the choice is implementation-defined.
| typedef struct SherpaOnnxOfflineSpeakerSegmentationPyannoteModelConfig SherpaOnnxOfflineSpeakerSegmentationPyannoteModelConfig |
| typedef struct SherpaOnnxOfflineSpeechDenoiser SherpaOnnxOfflineSpeechDenoiser |
| typedef struct SherpaOnnxOfflineSpeechDenoiserDpdfNetModelConfig SherpaOnnxOfflineSpeechDenoiserDpdfNetModelConfig |
| typedef struct SherpaOnnxOfflineSpeechDenoiserGtcrnModelConfig SherpaOnnxOfflineSpeechDenoiserGtcrnModelConfig |
| typedef struct SherpaOnnxOfflineSpeechDenoiserModelConfig SherpaOnnxOfflineSpeechDenoiserModelConfig |
Configure exactly one model family. If multiple model families are provided, one is chosen and the choice is implementation-defined.
| typedef struct SherpaOnnxOfflineStream SherpaOnnxOfflineStream |
| typedef struct SherpaOnnxOfflineTdnnModelConfig SherpaOnnxOfflineTdnnModelConfig |
| typedef struct SherpaOnnxOfflineTts SherpaOnnxOfflineTts |
| typedef struct SherpaOnnxOfflineTtsConfig SherpaOnnxOfflineTtsConfig |
| typedef struct SherpaOnnxOfflineTtsModelConfig SherpaOnnxOfflineTtsModelConfig |
Exactly one TTS model family should be configured. For example, set only one of vits, matcha, kokoro, kitten, zipvoice, pocket, or supertonic.
If multiple model families are configured at the same time, the implementation will choose one of them, and which one is used is implementation-defined. Do not rely on any precedence rule.
Concrete example model packages in this repository include:
kokoro-en-v0_19sherpa-onnx-pocket-tts-int8-2026-01-26matcha-icefall-en_US-ljspeechsherpa-onnx-zipvoice-distill-int8-zh-en-emilia | typedef struct SherpaOnnxOfflineZipformerAudioTaggingModelConfig SherpaOnnxOfflineZipformerAudioTaggingModelConfig |
| typedef struct SherpaOnnxOnlineModelConfig SherpaOnnxOnlineModelConfig |
Zero-initialize this struct before use, then fill in the sub-config for the model family you want to use together with the shared fields such as tokens, provider, and num_threads.
Exactly one model family should be configured for each recognizer. For example, set only one of transducer, paraformer, zipformer2_ctc, nemo_ctc, or t_one_ctc.
If multiple model families are configured at the same time, the implementation will choose one of them, and which one is used is implementation-defined. Do not rely on any precedence rule.
Please visit https://k2-fsa.github.io/sherpa/onnx/pretrained_models/online-paraformer/index.html to download compatible models.
| typedef struct SherpaOnnxOnlinePunctuation SherpaOnnxOnlinePunctuation |
Example using sherpa-onnx-online-punct-en-2024-08-06:
| typedef struct SherpaOnnxOnlineRecognizer SherpaOnnxOnlineRecognizer |
| typedef struct SherpaOnnxOnlineRecognizerConfig SherpaOnnxOnlineRecognizerConfig |
Zero-initialize this struct before use. Then fill in feat_config, model_config, and any optional decoding, endpoint, or hotword settings.
Example model package: sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20
| typedef struct SherpaOnnxOnlineRecognizerResult SherpaOnnxOnlineRecognizerResult |
All pointers in this struct are owned by the result object returned from SherpaOnnxGetOnlineStreamResult() and become invalid after SherpaOnnxDestroyOnlineRecognizerResult() is called.
| typedef struct SherpaOnnxOnlineSpeechDenoiser SherpaOnnxOnlineSpeechDenoiser |
| typedef struct SherpaOnnxOnlineStream SherpaOnnxOnlineStream |
Please refer to https://k2-fsa.github.io/sherpa/onnx/pretrained_models/index.html to download compatible pre-trained models.
| typedef struct SherpaOnnxResampleOut SherpaOnnxResampleOut |
Free this object with SherpaOnnxLinearResamplerResampleFree().
| typedef struct SherpaOnnxSileroVadModelConfig SherpaOnnxSileroVadModelConfig |
| typedef struct SherpaOnnxSourceSeparationOutput SherpaOnnxSourceSeparationOutput |
| typedef struct SherpaOnnxSourceSeparationStem SherpaOnnxSourceSeparationStem |
Example using 3dspeaker_speech_campplus_sv_zh-cn_16k-common.onnx:
| typedef struct SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult |
Free this object with SherpaOnnxSpeakerEmbeddingManagerFreeBestMatches().
| typedef struct SherpaOnnxSpeakerEmbeddingManagerSpeakerMatch SherpaOnnxSpeakerEmbeddingManagerSpeakerMatch |
| typedef struct SherpaOnnxSpeechSegment SherpaOnnxSpeechSegment |
The segment owns samples. Free the whole object with SherpaOnnxDestroySpeechSegment().
| typedef struct SherpaOnnxSpokenLanguageIdentificationConfig SherpaOnnxSpokenLanguageIdentificationConfig |
The current implementation uses Whisper-based models.
Example using sherpa-onnx-whisper-tiny:
| typedef struct SherpaOnnxSpokenLanguageIdentificationResult SherpaOnnxSpokenLanguageIdentificationResult |
Free this object with SherpaOnnxDestroySpokenLanguageIdentificationResult().
| typedef struct SherpaOnnxSpokenLanguageIdentificationWhisperConfig SherpaOnnxSpokenLanguageIdentificationWhisperConfig |
Example:
| typedef struct SherpaOnnxTenVadModelConfig SherpaOnnxTenVadModelConfig |
| typedef struct SherpaOnnxVadModelConfig SherpaOnnxVadModelConfig |
Exactly one VAD model family should be configured. Set either silero_vad.model or ten_vad.model.
If both are configured, the implementation will choose one of them, and which one is used is implementation-defined. Do not rely on any precedence rule.
Example model files:
./silero_vad.onnx./ten-vad.onnx| typedef struct SherpaOnnxVoiceActivityDetector SherpaOnnxVoiceActivityDetector |
| typedef struct SherpaOnnxWave SherpaOnnxWave |
Free this object with SherpaOnnxFreeWave().
| const char * SherpaOfflinePunctuationAddPunct | ( | const SherpaOnnxOfflinePunctuation * | punct, |
| const char * | text | ||
| ) |
| punct | A pointer returned by SherpaOnnxCreateOfflinePunctuation(). |
| text | Input text without punctuation. |
| void SherpaOfflinePunctuationFreeText | ( | const char * | text | ) |
| text | A pointer returned by SherpaOfflinePunctuationAddPunct(). |
| void SherpaOnnxAcceptWaveformOffline | ( | const SherpaOnnxOfflineStream * | stream, |
| int32_t | sample_rate, | ||
| const float * | samples, | ||
| int32_t | n | ||
| ) |
The input is mono floating-point PCM normalized to the range [-1, 1]. If sample_rate differs from the recognizer feature sample rate, sherpa-onnx resamples internally.
| stream | A pointer returned by SherpaOnnxCreateOfflineStream(). |
| sample_rate | Sample rate of samples. |
| samples | Pointer to n samples in the range [-1, 1]. |
| n | Number of samples. |
| const SherpaOnnxAudioEvent *const * SherpaOnnxAudioTaggingCompute | ( | const SherpaOnnxAudioTagging * | tagger, |
| const SherpaOnnxOfflineStream * | s, | ||
| int32_t | top_k | ||
| ) |
The returned array is NULL-terminated. If top_k is -1, the value stored in config.top_k is used instead.
| tagger | A pointer returned by SherpaOnnxCreateAudioTagging(). |
| s | A pointer returned by SherpaOnnxAudioTaggingCreateOfflineStream(). |
| top_k | Number of top results to return, or -1 to use the configured default. |
| const SherpaOnnxOfflineStream * SherpaOnnxAudioTaggingCreateOfflineStream | ( | const SherpaOnnxAudioTagging * | tagger | ) |
| tagger | A pointer returned by SherpaOnnxCreateAudioTagging(). |
| void SherpaOnnxAudioTaggingFreeResults | ( | const SherpaOnnxAudioEvent *const * | p | ) |
| p | A pointer returned by SherpaOnnxAudioTaggingCompute(). |
| void SherpaOnnxCircularBufferFree | ( | const float * | p | ) |
| const float * SherpaOnnxCircularBufferGet | ( | const SherpaOnnxCircularBuffer * | buffer, |
| int32_t | start_index, | ||
| int32_t | n | ||
| ) |
| buffer | A pointer returned by SherpaOnnxCreateCircularBuffer(). |
| start_index | Absolute start index in the buffer timeline. |
| n | Number of samples to copy. |
n samples. Free it with SherpaOnnxCircularBufferFree().| int32_t SherpaOnnxCircularBufferHead | ( | const SherpaOnnxCircularBuffer * | buffer | ) |
The value is monotonically non-decreasing until SherpaOnnxCircularBufferReset() is called.
| buffer | A pointer returned by SherpaOnnxCreateCircularBuffer(). |
| void SherpaOnnxCircularBufferPop | ( | const SherpaOnnxCircularBuffer * | buffer, |
| int32_t | n | ||
| ) |
| buffer | A pointer returned by SherpaOnnxCreateCircularBuffer(). |
| n | Number of samples to remove. |
| void SherpaOnnxCircularBufferPush | ( | const SherpaOnnxCircularBuffer * | buffer, |
| const float * | p, | ||
| int32_t | n | ||
| ) |
| buffer | A pointer returned by SherpaOnnxCreateCircularBuffer(). |
| p | Pointer to n samples. |
| n | Number of samples. |
| void SherpaOnnxCircularBufferReset | ( | const SherpaOnnxCircularBuffer * | buffer | ) |
| buffer | A pointer returned by SherpaOnnxCreateCircularBuffer(). |
| int32_t SherpaOnnxCircularBufferSize | ( | const SherpaOnnxCircularBuffer * | buffer | ) |
| buffer | A pointer returned by SherpaOnnxCreateCircularBuffer(). |
| const SherpaOnnxAudioTagging * SherpaOnnxCreateAudioTagging | ( | const SherpaOnnxAudioTaggingConfig * | config | ) |
| config | Audio-tagging configuration. |
| const SherpaOnnxCircularBuffer * SherpaOnnxCreateCircularBuffer | ( | int32_t | capacity | ) |
| capacity | Maximum number of samples the buffer can keep. |
| const SherpaOnnxDisplay * SherpaOnnxCreateDisplay | ( | int32_t | max_word_per_line | ) |
| max_word_per_line | Maximum number of words to show per line. |
| const SherpaOnnxKeywordSpotter * SherpaOnnxCreateKeywordSpotter | ( | const SherpaOnnxKeywordSpotterConfig * | config | ) |
| config | Keyword spotter configuration. |
| const SherpaOnnxOnlineStream * SherpaOnnxCreateKeywordStream | ( | const SherpaOnnxKeywordSpotter * | spotter | ) |
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| const SherpaOnnxOnlineStream * SherpaOnnxCreateKeywordStreamWithKeywords | ( | const SherpaOnnxKeywordSpotter * | spotter, |
| const char * | keywords | ||
| ) |
The keywords string uses the same textual format as the keyword files used by the examples. For instance:
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| keywords | Inline keyword definition string. |
| const SherpaOnnxLinearResampler * SherpaOnnxCreateLinearResampler | ( | int32_t | samp_rate_in_hz, |
| int32_t | samp_rate_out_hz, | ||
| float | filter_cutoff_hz, | ||
| int32_t | num_zeros | ||
| ) |
A common choice is:
| samp_rate_in_hz | Input sample rate in Hz. |
| samp_rate_out_hz | Output sample rate in Hz. |
| filter_cutoff_hz | Low-pass cutoff frequency in Hz. |
| num_zeros | Low-pass filter width control parameter. |
| const SherpaOnnxOfflinePunctuation * SherpaOnnxCreateOfflinePunctuation | ( | const SherpaOnnxOfflinePunctuationConfig * | config | ) |
| config | Offline punctuation configuration. |
| const SherpaOnnxOfflineRecognizer * SherpaOnnxCreateOfflineRecognizer | ( | const SherpaOnnxOfflineRecognizerConfig * | config | ) |
| config | Recognizer configuration. |
Whisper example:
SenseVoice example:
Parakeet TDT example:
| const SherpaOnnxOfflineSourceSeparation * SherpaOnnxCreateOfflineSourceSeparation | ( | const SherpaOnnxOfflineSourceSeparationConfig * | config | ) |
| config | Source-separation configuration. |
| const SherpaOnnxOfflineSpeakerDiarization * SherpaOnnxCreateOfflineSpeakerDiarization | ( | const SherpaOnnxOfflineSpeakerDiarizationConfig * | config | ) |
| config | Offline speaker diarization configuration. |
| const SherpaOnnxOfflineSpeechDenoiser * SherpaOnnxCreateOfflineSpeechDenoiser | ( | const SherpaOnnxOfflineSpeechDenoiserConfig * | config | ) |
Example using gtcrn_simple.onnx:
| config | Offline denoiser configuration. |
| const SherpaOnnxOfflineStream * SherpaOnnxCreateOfflineStream | ( | const SherpaOnnxOfflineRecognizer * | recognizer | ) |
| recognizer | A pointer returned by SherpaOnnxCreateOfflineRecognizer(). |
| const SherpaOnnxOfflineStream * SherpaOnnxCreateOfflineStreamWithHotwords | ( | const SherpaOnnxOfflineRecognizer * | recognizer, |
| const char * | hotwords | ||
| ) |
| recognizer | A pointer returned by SherpaOnnxCreateOfflineRecognizer(). |
| hotwords | Hotwords text to associate with the stream. |
| const SherpaOnnxOfflineTts * SherpaOnnxCreateOfflineTts | ( | const SherpaOnnxOfflineTtsConfig * | config | ) |
| config | TTS configuration. |
| const SherpaOnnxOnlinePunctuation * SherpaOnnxCreateOnlinePunctuation | ( | const SherpaOnnxOnlinePunctuationConfig * | config | ) |
| config | Online punctuation configuration. |
| const SherpaOnnxOnlineRecognizer * SherpaOnnxCreateOnlineRecognizer | ( | const SherpaOnnxOnlineRecognizerConfig * | config | ) |
The returned recognizer runs locally and does not require Internet access.
| config | Recognizer configuration. |
| const SherpaOnnxOnlineSpeechDenoiser * SherpaOnnxCreateOnlineSpeechDenoiser | ( | const SherpaOnnxOnlineSpeechDenoiserConfig * | config | ) |
| config | Online denoiser configuration. |
| const SherpaOnnxOnlineStream * SherpaOnnxCreateOnlineStream | ( | const SherpaOnnxOnlineRecognizer * | recognizer | ) |
One stream corresponds to one decoding state. Reuse the same recognizer to create multiple streams.
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| const SherpaOnnxOnlineStream * SherpaOnnxCreateOnlineStreamWithHotwords | ( | const SherpaOnnxOnlineRecognizer * | recognizer, |
| const char * | hotwords | ||
| ) |
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| hotwords | Hotwords text to associate with the stream. |
| const SherpaOnnxSpeakerEmbeddingExtractor * SherpaOnnxCreateSpeakerEmbeddingExtractor | ( | const SherpaOnnxSpeakerEmbeddingExtractorConfig * | config | ) |
| config | Speaker embedding extractor configuration. |
| const SherpaOnnxSpeakerEmbeddingManager * SherpaOnnxCreateSpeakerEmbeddingManager | ( | int32_t | dim | ) |
The manager stores enrolled speaker embeddings and supports speaker search and verification.
| dim | Embedding dimension. This should match SherpaOnnxSpeakerEmbeddingExtractorDim(). |
| const SherpaOnnxSpokenLanguageIdentification * SherpaOnnxCreateSpokenLanguageIdentification | ( | const SherpaOnnxSpokenLanguageIdentificationConfig * | config | ) |
| config | Spoken-language identification configuration. |
| const SherpaOnnxVoiceActivityDetector * SherpaOnnxCreateVoiceActivityDetector | ( | const SherpaOnnxVadModelConfig * | config, |
| float | buffer_size_in_seconds | ||
| ) |
Example model files are shown in c-api-examples/vad-whisper-c-api.c.
| config | VAD configuration. |
| buffer_size_in_seconds | Internal buffering capacity in seconds. |
| void SherpaOnnxDecodeKeywordStream | ( | const SherpaOnnxKeywordSpotter * | spotter, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
Call this only when SherpaOnnxIsKeywordStreamReady() returns 1.
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| stream | A pointer returned by SherpaOnnxCreateKeywordStream() or SherpaOnnxCreateKeywordStreamWithKeywords(). |
| void SherpaOnnxDecodeMultipleKeywordStreams | ( | const SherpaOnnxKeywordSpotter * | spotter, |
| const SherpaOnnxOnlineStream ** | streams, | ||
| int32_t | n | ||
| ) |
The caller must ensure every stream in streams is ready before calling this function.
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| streams | Array of ready streams. |
| n | Number of elements in streams. |
| void SherpaOnnxDecodeMultipleOfflineStreams | ( | const SherpaOnnxOfflineRecognizer * | recognizer, |
| const SherpaOnnxOfflineStream ** | streams, | ||
| int32_t | n | ||
| ) |
The caller must have already provided one utterance to each stream via SherpaOnnxAcceptWaveformOffline().
| recognizer | A pointer returned by SherpaOnnxCreateOfflineRecognizer(). |
| streams | Array of n offline stream pointers. |
| n | Number of streams in streams. |
| void SherpaOnnxDecodeMultipleOnlineStreams | ( | const SherpaOnnxOnlineRecognizer * | recognizer, |
| const SherpaOnnxOnlineStream ** | streams, | ||
| int32_t | n | ||
| ) |
The caller must ensure every stream in streams is ready before calling this function.
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| streams | Array of n stream pointers. |
| n | Number of streams in streams. |
| void SherpaOnnxDecodeOfflineStream | ( | const SherpaOnnxOfflineRecognizer * | recognizer, |
| const SherpaOnnxOfflineStream * | stream | ||
| ) |
Call this after SherpaOnnxAcceptWaveformOffline().
| recognizer | A pointer returned by SherpaOnnxCreateOfflineRecognizer(). |
| stream | A pointer returned by SherpaOnnxCreateOfflineStream(). |
| void SherpaOnnxDecodeOnlineStream | ( | const SherpaOnnxOnlineRecognizer * | recognizer, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
Call this only when SherpaOnnxIsOnlineStreamReady() returns 1.
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| void SherpaOnnxDestroyAudioTagging | ( | const SherpaOnnxAudioTagging * | tagger | ) |
| tagger | A pointer returned by SherpaOnnxCreateAudioTagging(). |
| void SherpaOnnxDestroyCircularBuffer | ( | const SherpaOnnxCircularBuffer * | buffer | ) |
| buffer | A pointer returned by SherpaOnnxCreateCircularBuffer(). |
| void SherpaOnnxDestroyDenoisedAudio | ( | const SherpaOnnxDenoisedAudio * | p | ) |
| p | A pointer returned by SherpaOnnxOfflineSpeechDenoiserRun(), SherpaOnnxOnlineSpeechDenoiserRun(), or SherpaOnnxOnlineSpeechDenoiserFlush(). |
| void SherpaOnnxDestroyDisplay | ( | const SherpaOnnxDisplay * | display | ) |
| display | A pointer returned by SherpaOnnxCreateDisplay(). |
| void SherpaOnnxDestroyKeywordResult | ( | const SherpaOnnxKeywordResult * | r | ) |
| r | A pointer returned by SherpaOnnxGetKeywordResult(). |
| void SherpaOnnxDestroyKeywordSpotter | ( | const SherpaOnnxKeywordSpotter * | spotter | ) |
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| void SherpaOnnxDestroyLinearResampler | ( | const SherpaOnnxLinearResampler * | p | ) |
| p | A pointer returned by SherpaOnnxCreateLinearResampler(). |
| void SherpaOnnxDestroyOfflinePunctuation | ( | const SherpaOnnxOfflinePunctuation * | punct | ) |
| punct | A pointer returned by SherpaOnnxCreateOfflinePunctuation(). |
| void SherpaOnnxDestroyOfflineRecognizer | ( | const SherpaOnnxOfflineRecognizer * | recognizer | ) |
| recognizer | A pointer returned by SherpaOnnxCreateOfflineRecognizer(). |
| void SherpaOnnxDestroyOfflineRecognizerResult | ( | const SherpaOnnxOfflineRecognizerResult * | r | ) |
| r | A pointer returned by SherpaOnnxGetOfflineStreamResult(). |
| void SherpaOnnxDestroyOfflineSourceSeparation | ( | const SherpaOnnxOfflineSourceSeparation * | ss | ) |
| ss | A pointer returned by SherpaOnnxCreateOfflineSourceSeparation(). |
| void SherpaOnnxDestroyOfflineSpeakerDiarization | ( | const SherpaOnnxOfflineSpeakerDiarization * | sd | ) |
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeakerDiarization(). |
| void SherpaOnnxDestroyOfflineSpeechDenoiser | ( | const SherpaOnnxOfflineSpeechDenoiser * | sd | ) |
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeechDenoiser(). |
| void SherpaOnnxDestroyOfflineStream | ( | const SherpaOnnxOfflineStream * | stream | ) |
| stream | A pointer returned by SherpaOnnxCreateOfflineStream() or SherpaOnnxCreateOfflineStreamWithHotwords(). |
| void SherpaOnnxDestroyOfflineStreamResultJson | ( | const char * | s | ) |
| s | A pointer returned by SherpaOnnxGetOfflineStreamResultAsJson(). |
| void SherpaOnnxDestroyOfflineTts | ( | const SherpaOnnxOfflineTts * | tts | ) |
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| void SherpaOnnxDestroyOfflineTtsGeneratedAudio | ( | const SherpaOnnxGeneratedAudio * | p | ) |
| p | A pointer returned by one of the SherpaOnnxOfflineTtsGenerate* functions. |
| void SherpaOnnxDestroyOnlinePunctuation | ( | const SherpaOnnxOnlinePunctuation * | punctuation | ) |
| punctuation | A pointer returned by SherpaOnnxCreateOnlinePunctuation(). |
| void SherpaOnnxDestroyOnlineRecognizer | ( | const SherpaOnnxOnlineRecognizer * | recognizer | ) |
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| void SherpaOnnxDestroyOnlineRecognizerResult | ( | const SherpaOnnxOnlineRecognizerResult * | r | ) |
| r | A pointer returned by SherpaOnnxGetOnlineStreamResult(). |
| void SherpaOnnxDestroyOnlineSpeechDenoiser | ( | const SherpaOnnxOnlineSpeechDenoiser * | sd | ) |
| sd | A pointer returned by SherpaOnnxCreateOnlineSpeechDenoiser(). |
| void SherpaOnnxDestroyOnlineStream | ( | const SherpaOnnxOnlineStream * | stream | ) |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream() or SherpaOnnxCreateOnlineStreamWithHotwords(). |
| void SherpaOnnxDestroyOnlineStreamResultJson | ( | const char * | s | ) |
| s | A pointer returned by SherpaOnnxGetOnlineStreamResultAsJson(). |
| void SherpaOnnxDestroySourceSeparationOutput | ( | const SherpaOnnxSourceSeparationOutput * | p | ) |
| p | A pointer returned by SherpaOnnxOfflineSourceSeparationProcess(). |
| void SherpaOnnxDestroySpeakerEmbeddingExtractor | ( | const SherpaOnnxSpeakerEmbeddingExtractor * | p | ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingExtractor(). |
| void SherpaOnnxDestroySpeakerEmbeddingManager | ( | const SherpaOnnxSpeakerEmbeddingManager * | p | ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| void SherpaOnnxDestroySpeechSegment | ( | const SherpaOnnxSpeechSegment * | p | ) |
| p | A pointer returned by SherpaOnnxVoiceActivityDetectorFront(). |
| void SherpaOnnxDestroySpokenLanguageIdentification | ( | const SherpaOnnxSpokenLanguageIdentification * | slid | ) |
| slid | A pointer returned by SherpaOnnxCreateSpokenLanguageIdentification(). |
| void SherpaOnnxDestroySpokenLanguageIdentificationResult | ( | const SherpaOnnxSpokenLanguageIdentificationResult * | r | ) |
| r | A pointer returned by SherpaOnnxSpokenLanguageIdentificationCompute(). |
| void SherpaOnnxDestroyVoiceActivityDetector | ( | const SherpaOnnxVoiceActivityDetector * | p | ) |
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| int32_t SherpaOnnxFileExists | ( | const char * | filename | ) |
| filename | File path to test. |
| void SherpaOnnxFreeKeywordResultJson | ( | const char * | s | ) |
| s | A pointer returned by SherpaOnnxGetKeywordResultAsJson(). |
| void SherpaOnnxFreeMultiChannelWave | ( | const SherpaOnnxMultiChannelWave * | wave | ) |
| wave | A pointer returned by SherpaOnnxReadWaveMultiChannel(). |
| void SherpaOnnxFreeWave | ( | const SherpaOnnxWave * | wave | ) |
| const char * SherpaOnnxGetGitDate | ( | ) |
The returned pointer refers to statically allocated memory owned by the library. Do not free it and do not modify it.
"Fri Jun 20 11:22:52 2025". | const char * SherpaOnnxGetGitSha1 | ( | ) |
The returned pointer refers to statically allocated memory owned by the library. Do not free it and do not modify it.
"6982b86c". | const SherpaOnnxKeywordResult * SherpaOnnxGetKeywordResult | ( | const SherpaOnnxKeywordSpotter * | spotter, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
The returned snapshot may represent either "no trigger yet" or a detected keyword. A common pattern is to check whether strlen(r->keyword) != 0.
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| stream | A pointer returned by SherpaOnnxCreateKeywordStream() or SherpaOnnxCreateKeywordStreamWithKeywords(). |
| const char * SherpaOnnxGetKeywordResultAsJson | ( | const SherpaOnnxKeywordSpotter * | spotter, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| stream | A pointer returned by SherpaOnnxCreateKeywordStream() or SherpaOnnxCreateKeywordStreamWithKeywords(). |
| const SherpaOnnxOfflineRecognizerResult * SherpaOnnxGetOfflineStreamResult | ( | const SherpaOnnxOfflineStream * | stream | ) |
Call this after SherpaOnnxDecodeOfflineStream() or SherpaOnnxDecodeMultipleOfflineStreams().
| stream | A pointer returned by SherpaOnnxCreateOfflineStream(). |
| const char * SherpaOnnxGetOfflineStreamResultAsJson | ( | const SherpaOnnxOfflineStream * | stream | ) |
| stream | A pointer returned by SherpaOnnxCreateOfflineStream(). |
| const SherpaOnnxOnlineRecognizerResult * SherpaOnnxGetOnlineStreamResult | ( | const SherpaOnnxOnlineRecognizer * | recognizer, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
The returned snapshot is independent from the stream state. The caller owns it and must free it with SherpaOnnxDestroyOnlineRecognizerResult().
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| const char * SherpaOnnxGetOnlineStreamResultAsJson | ( | const SherpaOnnxOnlineRecognizer * | recognizer, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| const char * SherpaOnnxGetVersionStr | ( | ) |
The returned pointer refers to statically allocated memory owned by the library. Do not free it and do not modify it.
"1.12.1".| int32_t SherpaOnnxIsKeywordStreamReady | ( | const SherpaOnnxKeywordSpotter * | spotter, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| stream | A pointer returned by SherpaOnnxCreateKeywordStream() or SherpaOnnxCreateKeywordStreamWithKeywords(). |
| int32_t SherpaOnnxIsOnlineStreamReady | ( | const SherpaOnnxOnlineRecognizer * | recognizer, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| const SherpaOnnxResampleOut * SherpaOnnxLinearResamplerResample | ( | const SherpaOnnxLinearResampler * | p, |
| const float * | input, | ||
| int32_t | input_dim, | ||
| int32_t | flush | ||
| ) |
Set flush to 1 for the final chunk so buffered samples are emitted.
| p | A pointer returned by SherpaOnnxCreateLinearResampler(). |
| input | Input sample array. |
| input_dim | Number of input samples. |
| flush | 1 if this is the final chunk; otherwise 0. |
| void SherpaOnnxLinearResamplerResampleFree | ( | const SherpaOnnxResampleOut * | p | ) |
| p | A pointer returned by SherpaOnnxLinearResamplerResample(). |
| int32_t SherpaOnnxLinearResamplerResampleGetInputSampleRate | ( | const SherpaOnnxLinearResampler * | p | ) |
| p | A pointer returned by SherpaOnnxCreateLinearResampler(). |
| int32_t SherpaOnnxLinearResamplerResampleGetOutputSampleRate | ( | const SherpaOnnxLinearResampler * | p | ) |
| p | A pointer returned by SherpaOnnxCreateLinearResampler(). |
| void SherpaOnnxLinearResamplerReset | ( | const SherpaOnnxLinearResampler * | p | ) |
| p | A pointer returned by SherpaOnnxCreateLinearResampler(). |
| void SherpaOnnxOfflineRecognizerSetConfig | ( | const SherpaOnnxOfflineRecognizer * | recognizer, |
| const SherpaOnnxOfflineRecognizerConfig * | config | ||
| ) |
| recognizer | Recognizer handle. |
| config | New recognizer configuration. |
| int32_t SherpaOnnxOfflineSourceSeparationGetNumberOfStems | ( | const SherpaOnnxOfflineSourceSeparation * | ss | ) |
For Spleeter 2-stems this returns 2 (vocals + accompaniment).
| ss | A pointer returned by SherpaOnnxCreateOfflineSourceSeparation(). |
| int32_t SherpaOnnxOfflineSourceSeparationGetOutputSampleRate | ( | const SherpaOnnxOfflineSourceSeparation * | ss | ) |
| ss | A pointer returned by SherpaOnnxCreateOfflineSourceSeparation(). |
| const SherpaOnnxSourceSeparationOutput * SherpaOnnxOfflineSourceSeparationProcess | ( | const SherpaOnnxOfflineSourceSeparation * | ss, |
| const float *const * | samples, | ||
| int32_t | num_channels, | ||
| int32_t | num_samples, | ||
| int32_t | sample_rate | ||
| ) |
All input channels must have the same number of samples.
| ss | A pointer returned by SherpaOnnxCreateOfflineSourceSeparation(). |
| samples | samples[c] is a float array for channel c, values in [-1, 1]. |
| num_channels | Number of input channels. |
| num_samples | Number of samples per channel (all channels must have the same length). |
| sample_rate | Input sample rate in Hz. |
| void SherpaOnnxOfflineSpeakerDiarizationDestroyResult | ( | const SherpaOnnxOfflineSpeakerDiarizationResult * | r | ) |
| r | A pointer returned by one of the SherpaOnnxOfflineSpeakerDiarizationProcess*() functions. |
| void SherpaOnnxOfflineSpeakerDiarizationDestroySegment | ( | const SherpaOnnxOfflineSpeakerDiarizationSegment * | s | ) |
| s | A pointer returned by SherpaOnnxOfflineSpeakerDiarizationResultSortByStartTime(). |
| int32_t SherpaOnnxOfflineSpeakerDiarizationGetSampleRate | ( | const SherpaOnnxOfflineSpeakerDiarization * | sd | ) |
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeakerDiarization(). |
| const SherpaOnnxOfflineSpeakerDiarizationResult * SherpaOnnxOfflineSpeakerDiarizationProcess | ( | const SherpaOnnxOfflineSpeakerDiarization * | sd, |
| const float * | samples, | ||
| int32_t | n | ||
| ) |
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeakerDiarization(). |
| samples | Input mono PCM samples normalized to [-1, 1]. |
| n | Number of input samples. |
| const SherpaOnnxOfflineSpeakerDiarizationResult * SherpaOnnxOfflineSpeakerDiarizationProcessWithCallback | ( | const SherpaOnnxOfflineSpeakerDiarization * | sd, |
| const float * | samples, | ||
| int32_t | n, | ||
| SherpaOnnxOfflineSpeakerDiarizationProgressCallback | callback, | ||
| void * | arg | ||
| ) |
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeakerDiarization(). |
| samples | Input mono PCM samples normalized to [-1, 1]. |
| n | Number of input samples. |
| callback | Progress callback. |
| arg | User pointer forwarded to callback. |
| const SherpaOnnxOfflineSpeakerDiarizationResult * SherpaOnnxOfflineSpeakerDiarizationProcessWithCallbackNoArg | ( | const SherpaOnnxOfflineSpeakerDiarization * | sd, |
| const float * | samples, | ||
| int32_t | n, | ||
| SherpaOnnxOfflineSpeakerDiarizationProgressCallbackNoArg | callback | ||
| ) |
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeakerDiarization(). |
| samples | Input mono PCM samples normalized to [-1, 1]. |
| n | Number of input samples. |
| callback | Progress callback. |
| int32_t SherpaOnnxOfflineSpeakerDiarizationResultGetNumSegments | ( | const SherpaOnnxOfflineSpeakerDiarizationResult * | r | ) |
| r | A pointer returned by one of the SherpaOnnxOfflineSpeakerDiarizationProcess*() functions. |
| int32_t SherpaOnnxOfflineSpeakerDiarizationResultGetNumSpeakers | ( | const SherpaOnnxOfflineSpeakerDiarizationResult * | r | ) |
| r | A pointer returned by one of the SherpaOnnxOfflineSpeakerDiarizationProcess*() functions. |
| const SherpaOnnxOfflineSpeakerDiarizationSegment * SherpaOnnxOfflineSpeakerDiarizationResultSortByStartTime | ( | const SherpaOnnxOfflineSpeakerDiarizationResult * | r | ) |
The returned array contains exactly SherpaOnnxOfflineSpeakerDiarizationResultGetNumSegments() entries.
| r | A pointer returned by one of the SherpaOnnxOfflineSpeakerDiarizationProcess*() functions. |
| void SherpaOnnxOfflineSpeakerDiarizationSetConfig | ( | const SherpaOnnxOfflineSpeakerDiarization * | sd, |
| const SherpaOnnxOfflineSpeakerDiarizationConfig * | config | ||
| ) |
Only config->clustering is used. Other fields are ignored.
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeakerDiarization(). |
| config | Configuration whose clustering field will be applied. |
| int32_t SherpaOnnxOfflineSpeechDenoiserGetSampleRate | ( | const SherpaOnnxOfflineSpeechDenoiser * | sd | ) |
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeechDenoiser(). |
| const SherpaOnnxDenoisedAudio * SherpaOnnxOfflineSpeechDenoiserRun | ( | const SherpaOnnxOfflineSpeechDenoiser * | sd, |
| const float * | samples, | ||
| int32_t | n, | ||
| int32_t | sample_rate | ||
| ) |
| sd | A pointer returned by SherpaOnnxCreateOfflineSpeechDenoiser(). |
| samples | Input mono PCM samples normalized to [-1, 1]. |
| n | Number of input samples. |
| sample_rate | Input sample rate in Hz. |
| const char * SherpaOnnxOfflineStreamGetOption | ( | const SherpaOnnxOfflineStream * | stream, |
| const char * | key | ||
| ) |
| stream | A pointer returned by SherpaOnnxCreateOfflineStream(). |
| key | Option name. |
| int32_t SherpaOnnxOfflineStreamHasOption | ( | const SherpaOnnxOfflineStream * | stream, |
| const char * | key | ||
| ) |
| stream | A pointer returned by SherpaOnnxCreateOfflineStream(). |
| key | Option name. |
| void SherpaOnnxOfflineStreamSetOption | ( | const SherpaOnnxOfflineStream * | stream, |
| const char * | key, | ||
| const char * | value | ||
| ) |
| stream | A pointer returned by SherpaOnnxCreateOfflineStream(). |
| key | Option name. |
| value | Option value represented as text. |
| const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerate | ( | const SherpaOnnxOfflineTts * | tts, |
| const char * | text, | ||
| int32_t | sid, | ||
| float | speed | ||
| ) |
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| text | Input text. |
| sid | Speaker ID for multi-speaker models. |
| speed | Speech rate. Values > 1 are faster. |
| const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithCallback | ( | const SherpaOnnxOfflineTts * | tts, |
| const char * | text, | ||
| int32_t | sid, | ||
| float | speed, | ||
| SherpaOnnxGeneratedAudioCallback | callback | ||
| ) |
The callback receives newly generated samples. The sample pointer is valid only for the duration of the callback.
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| text | Input text. |
| sid | Speaker ID for multi-speaker models. |
| speed | Speech rate. Values > 1 are faster. |
| callback | Incremental callback. Return 0 to stop generation early. |
| const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithCallbackWithArg | ( | const SherpaOnnxOfflineTts * | tts, |
| const char * | text, | ||
| int32_t | sid, | ||
| float | speed, | ||
| SherpaOnnxGeneratedAudioCallbackWithArg | callback, | ||
| void * | arg | ||
| ) |
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| text | Input text. |
| sid | Speaker ID for multi-speaker models. |
| speed | Speech rate. Values > 1 are faster. |
| callback | Incremental callback with user pointer. |
| arg | User pointer forwarded to callback. |
| const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithConfig | ( | const SherpaOnnxOfflineTts * | tts, |
| const char * | text, | ||
| const SherpaOnnxGenerationConfig * | config, | ||
| SherpaOnnxGeneratedAudioProgressCallbackWithArg | callback, | ||
| void * | arg | ||
| ) |
This is the preferred API for new integrations. It supports callback-based progress reporting and model-specific options such as reference audio.
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| text | Input text. |
| config | Generation-time configuration. |
| callback | Optional progress callback with user pointer. Return 0 to stop early. |
| arg | User pointer forwarded to callback. |
| const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithProgressCallback | ( | const SherpaOnnxOfflineTts * | tts, |
| const char * | text, | ||
| int32_t | sid, | ||
| float | speed, | ||
| SherpaOnnxGeneratedAudioProgressCallback | callback | ||
| ) |
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| text | Input text. |
| sid | Speaker ID for multi-speaker models. |
| speed | Speech rate. Values > 1 are faster. |
| callback | Progress callback. Return 0 to stop generation early. |
| const SherpaOnnxGeneratedAudio * SherpaOnnxOfflineTtsGenerateWithProgressCallbackWithArg | ( | const SherpaOnnxOfflineTts * | tts, |
| const char * | text, | ||
| int32_t | sid, | ||
| float | speed, | ||
| SherpaOnnxGeneratedAudioProgressCallbackWithArg | callback, | ||
| void * | arg | ||
| ) |
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| text | Input text. |
| sid | Speaker ID for multi-speaker models. |
| speed | Speech rate. Values > 1 are faster. |
| callback | Progress callback with user pointer. Return 0 to stop early. |
| arg | User pointer forwarded to callback. |
| 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 | ||
| ) |
Use SherpaOnnxOfflineTtsGenerateWithConfig() instead.
| int32_t SherpaOnnxOfflineTtsNumSpeakers | ( | const SherpaOnnxOfflineTts * | tts | ) |
Single-speaker models often return 1.
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| int32_t SherpaOnnxOfflineTtsSampleRate | ( | const SherpaOnnxOfflineTts * | tts | ) |
| tts | A pointer returned by SherpaOnnxCreateOfflineTts(). |
| const char * SherpaOnnxOnlinePunctuationAddPunct | ( | const SherpaOnnxOnlinePunctuation * | punctuation, |
| const char * | text | ||
| ) |
| punctuation | A pointer returned by SherpaOnnxCreateOnlinePunctuation(). |
| text | Input text chunk. |
| void SherpaOnnxOnlinePunctuationFreeText | ( | const char * | text | ) |
| text | A pointer returned by SherpaOnnxOnlinePunctuationAddPunct(). |
| const SherpaOnnxDenoisedAudio * SherpaOnnxOnlineSpeechDenoiserFlush | ( | const SherpaOnnxOnlineSpeechDenoiser * | sd | ) |
This also resets the denoiser so it can be reused for a new utterance.
| sd | A pointer returned by SherpaOnnxCreateOnlineSpeechDenoiser(). |
| int32_t SherpaOnnxOnlineSpeechDenoiserGetFrameShiftInSamples | ( | const SherpaOnnxOnlineSpeechDenoiser * | sd | ) |
Example programs feed audio to the online denoiser in this chunk size.
| sd | A pointer returned by SherpaOnnxCreateOnlineSpeechDenoiser(). |
| int32_t SherpaOnnxOnlineSpeechDenoiserGetSampleRate | ( | const SherpaOnnxOnlineSpeechDenoiser * | sd | ) |
| sd | A pointer returned by SherpaOnnxCreateOnlineSpeechDenoiser(). |
| void SherpaOnnxOnlineSpeechDenoiserReset | ( | const SherpaOnnxOnlineSpeechDenoiser * | sd | ) |
| sd | A pointer returned by SherpaOnnxCreateOnlineSpeechDenoiser(). |
| const SherpaOnnxDenoisedAudio * SherpaOnnxOnlineSpeechDenoiserRun | ( | const SherpaOnnxOnlineSpeechDenoiser * | sd, |
| const float * | samples, | ||
| int32_t | n, | ||
| int32_t | sample_rate | ||
| ) |
This function is not thread-safe. It may return NULL when not enough input has been accumulated to produce denoised output yet.
| sd | A pointer returned by SherpaOnnxCreateOnlineSpeechDenoiser(). |
| samples | Input chunk normalized to [-1, 1]. |
| n | Number of input samples. |
| sample_rate | Input sample rate in Hz. |
| void SherpaOnnxOnlineStreamAcceptWaveform | ( | const SherpaOnnxOnlineStream * | stream, |
| int32_t | sample_rate, | ||
| const float * | samples, | ||
| int32_t | n | ||
| ) |
The input is mono floating-point PCM normalized to the range [-1, 1]. If sample_rate differs from the recognizer feature sample rate, sherpa-onnx resamples internally.
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| sample_rate | Sample rate of samples. |
| samples | Pointer to n samples in the range [-1, 1]. |
| n | Number of samples. |
| const char * SherpaOnnxOnlineStreamGetOption | ( | const SherpaOnnxOnlineStream * | stream, |
| const char * | key | ||
| ) |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| key | Option name. |
| int32_t SherpaOnnxOnlineStreamHasOption | ( | const SherpaOnnxOnlineStream * | stream, |
| const char * | key | ||
| ) |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| key | Option name. |
| void SherpaOnnxOnlineStreamInputFinished | ( | const SherpaOnnxOnlineStream * | stream | ) |
After calling this function, do not append more samples to the stream.
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| int32_t SherpaOnnxOnlineStreamIsEndpoint | ( | const SherpaOnnxOnlineRecognizer * | recognizer, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| void SherpaOnnxOnlineStreamReset | ( | const SherpaOnnxOnlineRecognizer * | recognizer, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
This clears the decoder state for the stream so that it can be reused for a new utterance.
| recognizer | A pointer returned by SherpaOnnxCreateOnlineRecognizer(). |
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| void SherpaOnnxOnlineStreamSetOption | ( | const SherpaOnnxOnlineStream * | stream, |
| const char * | key, | ||
| const char * | value | ||
| ) |
This is a generic extension point for model-specific or runtime-specific options such as "is_final" for streaming Paraformer.
| stream | A pointer returned by SherpaOnnxCreateOnlineStream(). |
| key | Option name. |
| value | Option value represented as text. |
| void SherpaOnnxPrint | ( | const SherpaOnnxDisplay * | display, |
| int32_t | idx, | ||
| const char * | s | ||
| ) |
| display | A pointer returned by SherpaOnnxCreateDisplay(). |
| idx | Segment or utterance index to print. |
| s | Text to print. |
| const SherpaOnnxWave * SherpaOnnxReadWave | ( | const char * | filename | ) |
| filename | Input WAVE filename. |
| const SherpaOnnxWave * SherpaOnnxReadWaveFromBinaryData | ( | const char * | data, |
| int32_t | n | ||
| ) |
| data | Pointer to the WAVE file bytes. |
| n | Size of data in bytes. |
| const SherpaOnnxMultiChannelWave * SherpaOnnxReadWaveMultiChannel | ( | const char * | filename | ) |
| filename | Input WAVE filename. |
| void SherpaOnnxResetKeywordStream | ( | const SherpaOnnxKeywordSpotter * | spotter, |
| const SherpaOnnxOnlineStream * | stream | ||
| ) |
The examples call this immediately after a successful trigger so the next keyword can be detected independently.
| spotter | A pointer returned by SherpaOnnxCreateKeywordSpotter(). |
| stream | A pointer returned by SherpaOnnxCreateKeywordStream() or SherpaOnnxCreateKeywordStreamWithKeywords(). |
| const float * SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding | ( | const SherpaOnnxSpeakerEmbeddingExtractor * | p, |
| const SherpaOnnxOnlineStream * | s | ||
| ) |
The returned vector has SherpaOnnxSpeakerEmbeddingExtractorDim(p) elements. Free it with SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding().
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingExtractor(). |
| s | A pointer returned by SherpaOnnxSpeakerEmbeddingExtractorCreateStream(). |
| const SherpaOnnxOnlineStream * SherpaOnnxSpeakerEmbeddingExtractorCreateStream | ( | const SherpaOnnxSpeakerEmbeddingExtractor * | p | ) |
Feed samples with SherpaOnnxOnlineStreamAcceptWaveform(), then call SherpaOnnxSpeakerEmbeddingExtractorIsReady() and SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding().
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingExtractor(). |
| void SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding | ( | const float * | v | ) |
| v | A pointer returned by SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding(). |
| int32_t SherpaOnnxSpeakerEmbeddingExtractorDim | ( | const SherpaOnnxSpeakerEmbeddingExtractor * | p | ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingExtractor(). |
| int32_t SherpaOnnxSpeakerEmbeddingExtractorIsReady | ( | const SherpaOnnxSpeakerEmbeddingExtractor * | p, |
| const SherpaOnnxOnlineStream * | s | ||
| ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingExtractor(). |
| s | A pointer returned by SherpaOnnxSpeakerEmbeddingExtractorCreateStream(). |
| int32_t SherpaOnnxSpeakerEmbeddingManagerAdd | ( | const SherpaOnnxSpeakerEmbeddingManager * | p, |
| const char * | name, | ||
| const float * | v | ||
| ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| name | Speaker name. |
| v | Embedding vector with exactly dim elements. |
| int32_t SherpaOnnxSpeakerEmbeddingManagerAddList | ( | const SherpaOnnxSpeakerEmbeddingManager * | p, |
| const char * | name, | ||
| const float ** | v | ||
| ) |
v is a NULL-terminated array of embedding pointers: v[0], v[1], ..., v[n - 1], followed by v[n] == NULL.
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| name | Speaker name. |
| v | NULL-terminated array of embedding pointers. |
| int32_t SherpaOnnxSpeakerEmbeddingManagerAddListFlattened | ( | const SherpaOnnxSpeakerEmbeddingManager * | p, |
| const char * | name, | ||
| const float * | v, | ||
| int32_t | n | ||
| ) |
The input contains n embeddings laid out consecutively, so the total array length must be n * dim.
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| name | Speaker name. |
| v | Flattened embedding array. |
| n | Number of embeddings in v. |
| int32_t SherpaOnnxSpeakerEmbeddingManagerContains | ( | const SherpaOnnxSpeakerEmbeddingManager * | p, |
| const char * | name | ||
| ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| name | Speaker name. |
| void SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers | ( | const char *const * | names | ) |
| names | A pointer returned by SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers(). |
| void SherpaOnnxSpeakerEmbeddingManagerFreeBestMatches | ( | const SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult * | r | ) |
| r | A pointer returned by SherpaOnnxSpeakerEmbeddingManagerGetBestMatches(). |
| void SherpaOnnxSpeakerEmbeddingManagerFreeSearch | ( | const char * | name | ) |
| name | A pointer returned by SherpaOnnxSpeakerEmbeddingManagerSearch(). |
| const char *const * SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers | ( | const SherpaOnnxSpeakerEmbeddingManager * | p | ) |
The returned array is NULL-terminated. If no speakers are enrolled, the returned array still exists and its first element is NULL.
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| const SherpaOnnxSpeakerEmbeddingManagerBestMatchesResult * SherpaOnnxSpeakerEmbeddingManagerGetBestMatches | ( | const SherpaOnnxSpeakerEmbeddingManager * | p, |
| const float * | v, | ||
| float | threshold, | ||
| int32_t | n | ||
| ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| v | Query embedding vector. |
| threshold | Minimum similarity threshold in the range [0, 1]. |
| n | Maximum number of matches to return. |
| int32_t SherpaOnnxSpeakerEmbeddingManagerNumSpeakers | ( | const SherpaOnnxSpeakerEmbeddingManager * | p | ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| int32_t SherpaOnnxSpeakerEmbeddingManagerRemove | ( | const SherpaOnnxSpeakerEmbeddingManager * | p, |
| const char * | name | ||
| ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| name | Speaker name to remove. |
| const char * SherpaOnnxSpeakerEmbeddingManagerSearch | ( | const SherpaOnnxSpeakerEmbeddingManager * | p, |
| const float * | v, | ||
| float | threshold | ||
| ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| v | Query embedding vector. |
| threshold | Minimum similarity threshold in the range [0, 1]. |
| int32_t SherpaOnnxSpeakerEmbeddingManagerVerify | ( | const SherpaOnnxSpeakerEmbeddingManager * | p, |
| const char * | name, | ||
| const float * | v, | ||
| float | threshold | ||
| ) |
| p | A pointer returned by SherpaOnnxCreateSpeakerEmbeddingManager(). |
| name | Speaker name to compare against. |
| v | Query embedding vector. |
| threshold | Minimum similarity threshold in the range [0, 1]. |
| const SherpaOnnxSpokenLanguageIdentificationResult * SherpaOnnxSpokenLanguageIdentificationCompute | ( | const SherpaOnnxSpokenLanguageIdentification * | slid, |
| const SherpaOnnxOfflineStream * | s | ||
| ) |
Example:
| slid | A pointer returned by SherpaOnnxCreateSpokenLanguageIdentification(). |
| s | A pointer returned by SherpaOnnxSpokenLanguageIdentificationCreateOfflineStream(). |
| SherpaOnnxOfflineStream * SherpaOnnxSpokenLanguageIdentificationCreateOfflineStream | ( | const SherpaOnnxSpokenLanguageIdentification * | slid | ) |
Feed audio to the returned stream with SherpaOnnxAcceptWaveformOffline(), and then call SherpaOnnxSpokenLanguageIdentificationCompute().
| slid | A pointer returned by SherpaOnnxCreateSpokenLanguageIdentification(). |
| void SherpaOnnxVoiceActivityDetectorAcceptWaveform | ( | const SherpaOnnxVoiceActivityDetector * | p, |
| const float * | samples, | ||
| int32_t | n | ||
| ) |
Input samples are mono floating-point PCM in the range [-1, 1].
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| samples | Pointer to n samples. |
| n | Number of samples. |
| void SherpaOnnxVoiceActivityDetectorClear | ( | const SherpaOnnxVoiceActivityDetector * | p | ) |
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| int32_t SherpaOnnxVoiceActivityDetectorDetected | ( | const SherpaOnnxVoiceActivityDetector * | p | ) |
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| int32_t SherpaOnnxVoiceActivityDetectorEmpty | ( | const SherpaOnnxVoiceActivityDetector * | p | ) |
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| void SherpaOnnxVoiceActivityDetectorFlush | ( | const SherpaOnnxVoiceActivityDetector * | p | ) |
Call this after the last chunk of input has been fed.
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| const SherpaOnnxSpeechSegment * SherpaOnnxVoiceActivityDetectorFront | ( | const SherpaOnnxVoiceActivityDetector * | p | ) |
The returned segment is a copy owned by the caller. Free it with SherpaOnnxDestroySpeechSegment().
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| void SherpaOnnxVoiceActivityDetectorPop | ( | const SherpaOnnxVoiceActivityDetector * | p | ) |
Call this after consuming the segment returned by SherpaOnnxVoiceActivityDetectorFront().
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| void SherpaOnnxVoiceActivityDetectorReset | ( | const SherpaOnnxVoiceActivityDetector * | p | ) |
| p | A pointer returned by SherpaOnnxCreateVoiceActivityDetector(). |
| int64_t SherpaOnnxWaveFileSize | ( | int32_t | n_samples | ) |
| n_samples | Number of PCM samples. |
| int32_t SherpaOnnxWriteWave | ( | const float * | samples, |
| int32_t | n, | ||
| int32_t | sample_rate, | ||
| const char * | filename | ||
| ) |
| samples | Pointer to n samples in the range [-1, 1]. |
| n | Number of samples. |
| sample_rate | Sample rate in Hz. |
| filename | Output filename. |
| int32_t SherpaOnnxWriteWaveMultiChannel | ( | const float *const * | samples, |
| int32_t | n, | ||
| int32_t | sample_rate, | ||
| int32_t | num_channels, | ||
| const char * | filename | ||
| ) |
| samples | samples[c] is a pointer to channel c samples in [-1, 1]. |
| n | Number of samples per channel. |
| sample_rate | Sample rate in Hz. |
| num_channels | Number of channels. |
| filename | Output filename. |
| void SherpaOnnxWriteWaveToBuffer | ( | const float * | samples, |
| int32_t | n, | ||
| int32_t | sample_rate, | ||
| char * | buffer | ||
| ) |
Allocate at least SherpaOnnxWaveFileSize(n) bytes before calling.
| samples | Pointer to n samples in the range [-1, 1]. |
| n | Number of samples. |
| sample_rate | Sample rate in Hz. |
| buffer | Output buffer. |