Classes | Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes | List of all members
python.porcupine.Porcupine Class Reference
Inheritance diagram for python.porcupine.Porcupine:
Inheritance graph
[legend]

Classes

class  CPorcupine
 
class  PicovoiceStatuses
 

Public Member Functions

def __init__ (self, access_key, library_path, model_path, keyword_paths, sensitivities)
 
def delete (self)
 
def frame_length (self)
 
def process (self, pcm)
 
def sample_rate (self)
 
def version (self)
 

Public Attributes

 process_func
 

Private Attributes

 _delete_func
 
 _frame_length
 
 _handle
 
 _sample_rate
 
 _version
 

Static Private Attributes

 _PICOVOICE_STATUS_TO_EXCEPTION
 

Detailed Description

Python binding 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 `.frame_length`. The incoming audio needs to have a
sample rate equal to `.sample_rate` and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.

Definition at line 65 of file porcupine.py.

Constructor & Destructor Documentation

◆ __init__()

def python.porcupine.Porcupine.__init__ (   self,
  access_key,
  library_path,
  model_path,
  keyword_paths,
  sensitivities 
)
Constructor.

:param access_key: AccessKey obtained from Picovoice Console.
:param library_path: Absolute path to Porcupine's dynamic library.
:param model_path: Absolute path to the file containing model parameters.
:param keyword_paths: Absolute paths to keyword model files.
:param 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.

Definition at line 104 of file porcupine.py.

Member Function Documentation

◆ delete()

def python.porcupine.Porcupine.delete (   self)
Releases resources acquired by Porcupine.

Definition at line 177 of file porcupine.py.

◆ frame_length()

def python.porcupine.Porcupine.frame_length (   self)
Number of audio samples per frame.

Definition at line 210 of file porcupine.py.

◆ process()

def python.porcupine.Porcupine.process (   self,
  pcm 
)
Processes a frame of the incoming audio stream and emits the detection result.

:param pcm: A frame of audio samples. The number of samples per frame can be attained by calling
`.frame_length`. The incoming audio needs to have a sample rate equal to `.sample_rate` and be 16-bit
linearly-encoded. Porcupine operates on single-channel audio.
:return: Index of observed keyword at the end of the current frame. Indexing is 0-based and matches the ordering
of keyword models provided to the constructor. If no keyword is detected then it returns -1.

Definition at line 182 of file porcupine.py.

◆ sample_rate()

def python.porcupine.Porcupine.sample_rate (   self)
Audio sample rate accepted by Picovoice.

Definition at line 216 of file porcupine.py.

◆ version()

def python.porcupine.Porcupine.version (   self)
Version

Definition at line 204 of file porcupine.py.

Member Data Documentation

◆ _delete_func

python.porcupine.Porcupine._delete_func
private

Definition at line 160 of file porcupine.py.

◆ _frame_length

python.porcupine.Porcupine._frame_length
private

Definition at line 173 of file porcupine.py.

◆ _handle

python.porcupine.Porcupine._handle
private

Definition at line 148 of file porcupine.py.

◆ _PICOVOICE_STATUS_TO_EXCEPTION

python.porcupine.Porcupine._PICOVOICE_STATUS_TO_EXCEPTION
staticprivate

Definition at line 87 of file porcupine.py.

◆ _sample_rate

python.porcupine.Porcupine._sample_rate
private

Definition at line 175 of file porcupine.py.

◆ _version

python.porcupine.Porcupine._version
private

Definition at line 171 of file porcupine.py.

◆ process_func

python.porcupine.Porcupine.process_func

Definition at line 164 of file porcupine.py.


The documentation for this class was generated from the following file:


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