Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ai.picovoice.porcupine.Porcupine Class Reference

Classes

class  Builder
 
enum  BuiltInKeyword
 

Public Member Functions

void delete ()
 
void delete ()
 
native int getFrameLength ()
 
native int getFrameLength ()
 
native int getSampleRate ()
 
native int getSampleRate ()
 
native String getVersion ()
 
native String getVersion ()
 
 Porcupine (String accessKey, String libraryPath, String modelPath, String[] keywordPaths, float[] sensitivities) throws PorcupineException
 
int process (short[] pcm) throws PorcupineException
 
int process (short[] pcm) throws PorcupineException
 

Static Public Attributes

static final String LIBRARY_PATH
 
static final String MODEL_PATH
 

Private Member Functions

native void delete (long object)
 
native void delete (long object)
 
native long init (String accessKey, String modelPath, String[] keywordPaths, float[] sensitivities)
 
native long init (String accessKey, String modelPath, String[] keywordPaths, float[] sensitivities)
 
 Porcupine (String accessKey, String modelPath, String[] keywordPaths, float[] sensitivities) throws PorcupineException
 
native int process (long object, short[] pcm)
 
native int process (long object, short[] pcm)
 

Private Attributes

long handle
 
final long libraryHandle
 

Static Private Attributes

static final HashMap< BuiltInKeyword, String > BUILT_IN_KEYWORD_PATHS = new HashMap<>()
 
static String DEFAULT_MODEL_PATH
 
static boolean isExtracted
 
static final int[] KEYWORDS_RESOURCES
 

Detailed Description

Android 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 getFrameLength(). The incoming audio needs to have a sample rate equal to getSampleRate() and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.

Java 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 getFrameLength(). The incoming audio needs to have a sample rate equal to getSampleRate() and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.

Definition at line 35 of file android/Porcupine/porcupine/src/main/java/ai/picovoice/porcupine/Porcupine.java.

Constructor & Destructor Documentation

◆ Porcupine() [1/2]

ai.picovoice.porcupine.Porcupine.Porcupine ( String  accessKey,
String  modelPath,
String[]  keywordPaths,
float[]  sensitivities 
) throws PorcupineException
inlineprivate

Constructor.

Parameters
accessKeyAccessKey obtained from Picovoice Console (https://console.picovoice.ai/).
modelPathAbsolute path to the file containing model parameters.
keywordPathsAbsolute paths to keyword model files.
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.
Exceptions
PorcupineExceptionif there is an error while initializing Porcupine.

Definition at line 64 of file android/Porcupine/porcupine/src/main/java/ai/picovoice/porcupine/Porcupine.java.

◆ Porcupine() [2/2]

ai.picovoice.porcupine.Porcupine.Porcupine ( String  accessKey,
String  libraryPath,
String  modelPath,
String[]  keywordPaths,
float[]  sensitivities 
) throws PorcupineException
inline

Constructor.

Parameters
accessKeyAccessKey obtained from Picovoice Console.
libraryPathAbsolute path to the native Porcupine library.
modelPathAbsolute path to the file containing model parameters.
keywordPathsAbsolute paths to keyword model files.
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.
Exceptions
PorcupineExceptionif there is an error while initializing Porcupine.

Definition at line 55 of file java/src/ai/picovoice/porcupine/Porcupine.java.

Member Function Documentation

◆ delete() [1/4]

void ai.picovoice.porcupine.Porcupine.delete ( )
inline

Releases resources acquired by Porcupine.

Definition at line 67 of file java/src/ai/picovoice/porcupine/Porcupine.java.

◆ delete() [2/4]

void ai.picovoice.porcupine.Porcupine.delete ( )
inline

Releases resources acquired by Porcupine.

Definition at line 75 of file android/Porcupine/porcupine/src/main/java/ai/picovoice/porcupine/Porcupine.java.

◆ delete() [3/4]

native void ai.picovoice.porcupine.Porcupine.delete ( long  object)
private

◆ delete() [4/4]

native void ai.picovoice.porcupine.Porcupine.delete ( long  object)
private

◆ getFrameLength() [1/2]

native int ai.picovoice.porcupine.Porcupine.getFrameLength ( )

Getter for number of audio samples per frame.

Returns
Number of audio samples per frame.

◆ getFrameLength() [2/2]

native int ai.picovoice.porcupine.Porcupine.getFrameLength ( )

Getter for number of audio samples per frame..

Returns
Number of audio samples per frame.

◆ getSampleRate() [1/2]

native int ai.picovoice.porcupine.Porcupine.getSampleRate ( )

Getter for audio sample rate accepted by Picovoice.

Returns
Audio sample rate accepted by Picovoice.

◆ getSampleRate() [2/2]

native int ai.picovoice.porcupine.Porcupine.getSampleRate ( )

Getter for audio sample rate accepted by Picovoice.

Returns
Audio sample rate accepted by Picovoice.

◆ getVersion() [1/2]

native String ai.picovoice.porcupine.Porcupine.getVersion ( )

Getter for version.

Returns
Version.

◆ getVersion() [2/2]

native String ai.picovoice.porcupine.Porcupine.getVersion ( )

Getter for version.

Returns
Version.

◆ init() [1/2]

native long ai.picovoice.porcupine.Porcupine.init ( String  accessKey,
String  modelPath,
String[]  keywordPaths,
float[]  sensitivities 
)
private

◆ init() [2/2]

native long ai.picovoice.porcupine.Porcupine.init ( String  accessKey,
String  modelPath,
String[]  keywordPaths,
float[]  sensitivities 
)
private

◆ process() [1/4]

native int ai.picovoice.porcupine.Porcupine.process ( long  object,
short[]  pcm 
)
private

◆ process() [2/4]

native int ai.picovoice.porcupine.Porcupine.process ( long  object,
short[]  pcm 
)
private

◆ process() [3/4]

int ai.picovoice.porcupine.Porcupine.process ( short[]  pcm) throws PorcupineException
inline

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

Parameters
pcmA frame of audio samples. The number of samples per frame can be attained by calling getFrameLength(). The incoming audio needs to have a sample rate equal to getSampleRate() and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.
Returns
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.
Exceptions
PorcupineExceptionif there is an error while processing the audio frame.

Definition at line 83 of file java/src/ai/picovoice/porcupine/Porcupine.java.

◆ process() [4/4]

int ai.picovoice.porcupine.Porcupine.process ( short[]  pcm) throws PorcupineException
inline

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

Parameters
pcmA frame of audio samples. The number of samples per frame can be attained by calling getFrameLength(). The incoming audio needs to have a sample rate equal to getSampleRate() and be 16-bit linearly-encoded. Porcupine operates on single-channel audio.
Returns
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.
Exceptions
PorcupineExceptionif there is an error while processing the audio frame.

Definition at line 94 of file android/Porcupine/porcupine/src/main/java/ai/picovoice/porcupine/Porcupine.java.

Member Data Documentation

◆ BUILT_IN_KEYWORD_PATHS

static final HashMap< BuiltInKeyword, String > ai.picovoice.porcupine.Porcupine.BUILT_IN_KEYWORD_PATHS = new HashMap<>()
staticprivate

◆ DEFAULT_MODEL_PATH

String ai.picovoice.porcupine.Porcupine.DEFAULT_MODEL_PATH
staticprivate

◆ handle

long ai.picovoice.porcupine.Porcupine.handle
private

◆ isExtracted

boolean ai.picovoice.porcupine.Porcupine.isExtracted
staticprivate

◆ KEYWORDS_RESOURCES

final int [] ai.picovoice.porcupine.Porcupine.KEYWORDS_RESOURCES
staticprivate
Initial value:
= {
R.raw.alexa, R.raw.americano, R.raw.blueberry, R.raw.bumblebee, R.raw.computer, R.raw.grapefruit,
R.raw.grasshopper, R.raw.hey_google, R.raw.hey_siri, R.raw.jarvis, R.raw.ok_google, R.raw.picovoice,
R.raw.porcupine, R.raw.terminator,
}

Definition at line 37 of file android/Porcupine/porcupine/src/main/java/ai/picovoice/porcupine/Porcupine.java.

◆ LIBRARY_PATH

final String ai.picovoice.porcupine.Porcupine.LIBRARY_PATH
static

◆ libraryHandle

final long ai.picovoice.porcupine.Porcupine.libraryHandle
private

◆ MODEL_PATH

final String ai.picovoice.porcupine.Porcupine.MODEL_PATH
static

The documentation for this class was generated from the following file:
R
#define R
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/stb_vorbis.c:5104


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