Typedefs | Functions
pv_porcupine_mcu.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "picovoice.h"
Include dependency graph for pv_porcupine_mcu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct pv_porcupine pv_porcupine_t
 

Functions

PV_API void pv_porcupine_delete (pv_porcupine_t *object)
 
PV_API int32_t pv_porcupine_frame_length (void)
 
PV_API pv_status_t pv_porcupine_get_min_memory_buffer_size (int32_t preliminary_memory_size, void *preliminary_memory_buffer, int32_t num_keywords, const int32_t *keyword_model_sizes, const void *const *keyword_models, int32_t *min_memory_buffer_size)
 
PV_API pv_status_t pv_porcupine_init (const char *access_key, int32_t memory_size, void *memory_buffer, int32_t num_keywords, const int32_t *keyword_model_sizes, const void *const *keyword_models, const float *sensitivities, pv_porcupine_t **object)
 
PV_API pv_status_t pv_porcupine_process (pv_porcupine_t *object, const int16_t *pcm, int32_t *keyword_index)
 
const PV_API char * pv_porcupine_version (void)
 

Typedef Documentation

◆ pv_porcupine_t

typedef struct pv_porcupine pv_porcupine_t

Forward declaration for Porcupine wake word engine. It detects utterances of given keywords within an incoming stream of audio in real-time. It processes incoming audio in consecutive frames and for each frame emits the detection result. The number of samples per frame can be attained by calling 'pv_porcupine_frame_length()'. The incoming audio needs to have a sample rate equal to 'pv_sample_rate()' and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.

Definition at line 33 of file pv_porcupine_mcu.h.

Function Documentation

◆ pv_porcupine_delete()

PV_API void pv_porcupine_delete ( pv_porcupine_t object)

Destructor.

Parameters
objectPorcupine object.

◆ pv_porcupine_frame_length()

PV_API int32_t pv_porcupine_frame_length ( void  )

Getter for number of audio samples per frame.

Returns
Frame length.

◆ pv_porcupine_get_min_memory_buffer_size()

PV_API pv_status_t pv_porcupine_get_min_memory_buffer_size ( int32_t  preliminary_memory_size,
void *  preliminary_memory_buffer,
int32_t  num_keywords,
const int32_t *  keyword_model_sizes,
const void *const *  keyword_models,
int32_t *  min_memory_buffer_size 
)

Computes the minimum required memory buffer size, in bytes, for the given keyword model. A relatively large value for 'preliminary_memory_buffer' is suggested (e.g., 30 kilobytes). Then, 'pv_porcupine_init' can be called optimally passing a memory buffer with the size of 'min_memory_buffer_size'.

Parameters
preliminary_memory_sizeMemory size in bytes.
preliminary_memory_bufferMemory needs to be 8-byte aligned.
num_keywordsNumber of keywords to monitor.
keyword_model_sizesSize of each keyword model in bytes.
keyword_modelsKeyword models.
[out]min_memory_buffer_sizeminimum required memory buffer size in bytes.
Returns
Status code. Returns 'PV_STATUS_INVALID_ARGUMENT', 'PV_STATUS_INVALID_STATE', or 'PV_STATUS_OUT_OF_MEMORY' on failure.

◆ pv_porcupine_init()

PV_API pv_status_t pv_porcupine_init ( const char *  access_key,
int32_t  memory_size,
void *  memory_buffer,
int32_t  num_keywords,
const int32_t *  keyword_model_sizes,
const void *const *  keyword_models,
const float *  sensitivities,
pv_porcupine_t **  object 
)

Constructor.

Parameters
access_keyAccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
memory_sizeMemory size in bytes.
memory_bufferMemory buffer needs to be 8-byte aligned.
num_keywordsNumber of keywords to monitor.
keyword_model_sizesSize of each keyword model in bytes.
keyword_modelsKeyword models.
sensitivitiesSensitivities for detecting keywords. Each value should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
[out]objectConstructed instance of Porcupine.
Returns
Status code. Returns 'PV_STATUS_INVALID_ARGUMENT' or 'PV_STATUS_OUT_OF_MEMORY' on failure.

◆ pv_porcupine_process()

PV_API pv_status_t pv_porcupine_process ( pv_porcupine_t object,
const int16_t *  pcm,
int32_t *  keyword_index 
)

Processes a frame of the incoming audio stream and emits the detection result.

Parameters
objectPorcupine object.
pcmA frame of audio samples. The number of samples per frame can be attained by calling 'pv_porcupine_frame_length()'. The incoming audio needs to have a sample rate equal to 'pv_sample_rate()' and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.
[out]keyword_indexIndex of observed keyword at the end of the current frame. Indexing is 0-based and matches the ordering of keyword models provided to 'pv_porcupine_init()'. If no keyword is detected then it is set to -1.
Returns
Status code. Returns 'PV_STATUS_INVALID_ARGUMENT' or 'PV_STATUS_OUT_OF_MEMORY' on failure.

◆ pv_porcupine_version()

const PV_API char* pv_porcupine_version ( void  )

Getter for version.

Returns
Version.


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:15:00