Skip to content

PryonLite Java Wake Word API

Details specific to wake word functionality are briefly described below.

1. Wake Word Configuration

The Java client must supply arguments for the following parameters as part of wake word configuration:

/**
 * Wake Word model binary.
 */
public byte[] wakewordModel;
/**
 * Wake Word detection threshold.  Integer in range [1, 1000].
 * Recommended value is 500.
 * 1 = most permissive threshold, most detections.
 * 1000 = least permissive threshold, fewest detections.
 */
public int detectThreshold;
/**
 * Flag for enabling voice activity detector pre-stage.
 * For most application-core integrations, this should be set to false.
 */
public boolean useVad;
/**
 * Flag for enabling low-latency detection mode.
 * Only valid for type 'U' models. Results in ~200ms lower detection
 * latency, at the cost of less accurate ww end index reporting.
 */
public boolean lowLatency;

2. Wake Word Attributes

Attributes associated with the wake word component of the PryonLite engine are listed below:

public String wakewordApiVersion; ///< Wake Word API version
public String wakewordConfigVersion; ///< Wake Word configuration version (wakeword model)

3. Wake Word Commands

3.1 Selecting Detection Threshold

The Wake Word detection threshold can be modified at run-time via the following method:

/**
 * Sets the wake word detection threshold.
 *
 * @param threshold [in] Threshold in range [1, 1000], with 1 being least and 1000 being most permissive.
 * @return Zero if successful, non-zero error code otherwise.
 * @note This function should be invoked only after initialize() has been called,
 * and should not be invoked after a destroy().
 * @note Here is a list of error codes for this function and their meanings.
 *   0: Success, nominal operation.
 *  -38: The object has not been initialized.
 * All other values:  Internal code, consult vendor.
 */
public synchronized int wakewordSetDetectionThreshold(final int threshold);

4. Wake Word Events

4.1 Wake Word Detection

    /**
     * Function signature of event handler for wake word detection events.
     *
     * @param wakeWord [in] The detected wake word.
     * @param beginSampleIndex [in] The first sample of the wake word, relative to the last sample pushed.
     * @param endSampleIndex [in]  The last sample of the wake word, relative to the last sample pushed.
     * @param metadata [in] Wake Word Engine Metadata associated with wake word event.
     */
    void wakeWordDetected(final String wakeWord, final long beginSampleIndex,
                          final long endSampleIndex, final byte[] metadata);

4.2 Voice Activity Detection

Historically, voice activity detection has been tightly coupled with the wake word detector; however, one could consider it a more generic engine event that may be emitted in future engine configurations where wake word detection is disabled. For the purpose of documentation, we leave this event in the Wake Word section, but reserve the right to move it to the Engine section.

    /**
     * Function signature of event handler for voice activity detection (VAD) state changes.
     *
     * @param state - new VAD state.
     */
    void vadStateChanged(final int state);
This event notifies the client when the PryonLite voice activity detector transitions between 'voice present' and 'voice not present' states.