#include <stdbool.h>
#include <stdint.h>
#include "picovoice.h"
Go to the source code of this file.
◆ 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 include/pv_porcupine.h.
◆ pv_porcupine_delete()
◆ 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_init()
PV_API pv_status_t pv_porcupine_init |
( |
const char * |
access_key, |
|
|
const char * |
model_path, |
|
|
int32_t |
num_keywords, |
|
|
const char *const * |
keyword_paths, |
|
|
const float * |
sensitivities, |
|
|
pv_porcupine_t ** |
object |
|
) |
| |
Constructor.
- Parameters
-
| access_key | AccessKey obtained from Picovoice Console (https://console.picovoice.ai/). |
| model_path | Absolute path to the file containing model parameters. |
| num_keywords | Number of keywords to monitor. |
| keyword_paths | Absolute paths to keyword model files. |
| sensitivities | Sensitivities 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] | object | Constructed instance of Porcupine. |
- Returns
- Status code. Returns 'PV_STATUS_INVALID_ARGUMENT', 'PV_STATUS_IO_ERROR', or 'PV_STATUS_OUT_OF_MEMORY' on failure.
◆ pv_porcupine_process()
Processes a frame of the incoming audio stream and emits the detection result.
- Parameters
-
| object | Porcupine object. |
| pcm | A 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_index | Index 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.