Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Leopard Speech-to-Text — C API


API Reference for the Leopard C SDK.


pv_leopard_t

typedef struct pv_leopard pv_leopard_t;

Container representing the Leopard Speech-to-Text engine.


pv_leopard_init()

pv_status_t pv_leopard_init(
const char *access_key,
const char *model_path,
bool enable_automatic_punctuation,
pv_leopard_t **object);

Create a Leopard instance. Resources should be cleaned when you are done using the pv_leopard_delete() function.

Parameters

  • access_key const char * : AccessKey obtained from Picovoice Console.
  • model_path const char * : Absolute path to the file containing model parameters (.pv).
  • enable_automatic_punctuation bool : Set to true to enable automatic punctuation insertion.
  • object pv_leopard_t * * : Constructed instance of Leopard.

Returns

  • pv_status_t : Status code.

pv_leopard_delete()

void pv_leopard_delete(pv_leopard_t *object);

Releases resources acquired by Leopard.

Parameters

  • object pv_leopard_t * : Picovoice object.

pv_leopard_process()

pv_status_t pv_leopard_process(
pv_leopard_t *object,
const int16_t *pcm,
int32_t num_samples,
char **transcript,
int32_t *num_words,
pv_word_t **words);

Processes a given audio data and returns its transcription. The caller is responsible for freeing the transcription buffers. The audio needs to have a sample rate equal to pv_sample_rate() and be 16-bit linearly-encoded. This function operates on single-channel audio.

Parameters

  • object pv_leopard_t * : Leopard object.
  • pcm int16_t : A frame of audio samples.
  • num_samples int32_t : Number of audio samples to process.
  • transcript char * * : Inferred transcription.
  • num_words int32_t * : Number of transcribed words.
  • words pv_word_t * * : Transcribed words and their associated metadata.

Returns

  • pv_status_t : Status code.

pv_leopard_process_file()

pv_status_t pv_leopard_process_file(
pv_leopard_t *object,
const char *audio_path,
char **transcript,
int32_t *num_words,
pv_word_t **words);

Processes a given audio file and returns its transcription. The caller is responsible for freeing the transcription buffers. The supported formats are: 3gp (AMR), FLAC, MP3, MP4/m4a (AAC), Ogg, WAV and WebM.

Parameters

  • object pv_leopard_t * : Leopard object.
  • audio_path const char * : Absolute path to the audio file.
  • transcript char * * : Inferred transcription.
  • num_words int32_t * : Number of transcribed words.
  • words pv_word_t * * : Transcribed words and their associated metadata.

Returns

  • pv_status_t : Status code.

pv_leopard_version()

const char *pv_leopard_version(void);

Getter for version.

Returns

  • const char * : Leopard version.

pv_sample_rate()

int32_t pv_sample_rate(void);

Audio sample rate accepted by Leopard.

Returns

  • int32_t : Sample rate.

pv_word_t

typedef struct {
const char *word; /** Transcribed word. */
float start_sec; /** Start of word in seconds. */
float end_sec; /** End of word in seconds. */
float confidence; /** Transcription confidence. It is a number within [0, 1]. */
} pv_status_t;

Struct for a transcribed word and its associated metadata.


pv_status_t

typedef enum {
PV_STATUS_SUCCESS = 0,
PV_STATUS_OUT_OF_MEMORY,
PV_STATUS_IO_ERROR,
PV_STATUS_INVALID_ARGUMENT,
PV_STATUS_STOP_ITERATION,
PV_STATUS_KEY_ERROR,
PV_STATUS_INVALID_STATE,
PV_STATUS_RUNTIME_ERROR,
PV_STATUS_ACTIVATION_ERROR,
PV_STATUS_ACTIVATION_LIMIT_REACHED,
PV_STATUS_ACTIVATION_THROTTLED,
PV_STATUS_ACTIVATION_REFUSED
} pv_status_t;

Status code enum.


pv_status_to_string()

const char *pv_status_to_string(pv_status_t status);

Parameters

  • status int32_t : Status code.

Returns

  • const char * : String representation of status code.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Leopard Speech-to-Text — C API
  • pv_leopard_t
  • pv_leopard_init()
  • pv_leopard_delete()
  • pv_leopard_process()
  • pv_leopard_process_file()
  • pv_leopard_version()
  • pv_sample_rate()
  • pv_word_t
  • pv_status_t
  • pv_status_to_string()
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.