pythonRhino - Python Quick Start

  • Speech-to-Intent Engine
  • Domain Specific NLU
  • Offline NLU
  • Local Voice Recognition
  • Raspberry Pi
  • ARM Linux
  • Linux
  • Mac
  • Windows
  • Python

This document outlines how to integrate Rhino Speech-to-Intent engine within an application using its Python API.

Requirements

  • Python3
  • PIP

Compatibility

  • Linux (x86_64)
  • macOS (x86_64)
  • Windows (x86_64)
  • Raspberry Pi (all variants)
  • BeagleBone.

Cloning the Repository

If using SSH, clone the repository with:

git clone --recurse-submodules [email protected]:Picovoice/picovoice.git

If using HTTPS, then type

git clone --recurse-submodules https://github.com/Picovoice/picovoice.git

Installation

Install PyAudio and then the demo package:

sudo pip3 install pvrhinodemo

Check the usage information:

rhino_demo_mic --help

Demo Applications

There are two command-line demo applications shipped with the demo package: microphone demo and file demo. Microphone demo starts an audio stream from the microphone and infers the user's intent from the voice command. The file demo performs the same operation on an already pre-recorded audio file.

Microphone Demo

With a working microphone connected to your device and from the root of the repository run the following in the terminal:

rhino_demo_mic --context_path resources/context/${PLATFORM}/smart_lighting_${PLATFORM}.rhn

In the above replace ${PLATFORM} with one of the followig depending on the device you are running on:

  • linux
  • mac
  • windows
  • raspberry-pi
  • beaglebone

With a working microphone connected, say:

turn on the lights in the kichen

You should see this in the terminal:

{
intent : 'changeLightState'
slots : {
state : 'on'
location : 'kitchen'
}
}

File Demo

The demo opens a pre-recorded audio file, processes it, and outputs into the terminal user's intent is inferred from the voice command.

rhino_demo_file \
--input_audio_path ${INPUT_AUDIO_PATH} \
--context_path ${CONTEXT_PATH}

Replace ${INPUT_AUDIO_PATH} with the path to an audio file containing utterances of desired wake phrase followed by spoken commands and ${CONTEXT_PATH} with the absolute path to a Rhino context file (.rhn).

Custom Context

You can create custom Rhino context models using Picovoice Console.