react-nativeLeopard - React Native Quick Start


  • Android 4.4+ (API 19+)
  • iOS 9.0+


Picovoice Account & AccessKey

Signup or Login to Picovoice Console to get your AccessKey. Make sure to keep your AccessKey secret.

Quick Start


  1. Setup the React Native environment.

  2. Install the npm packages:

npm install @picovoice/leopard-react-native
  1. Enable the proper permission for recording with the hardware's microphone on both iOS and Android:


Open your Info.plist and add the following line:

<string>[Permission explanation]</string>


Open your AndroidManifest.xml and add the following line:

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />

Adding Leopard Models


Add the Leopard model file to your Android application by:

  1. Create a custom model using the Picovoice Console or use the default model.
  2. Add the model as a bundled resource by placing it under the android/src/main/assets/ directory of your Android application.


Open ./ios/Leopard.xcodeproj in Xcode and add the Leopard model file in Xcode by:

  1. Create a custom model using the Picovoice Console or use the default model.
  2. Add the model as a bundled resource by selecting Build Phases and adding it to Copy Bundle Resources step.


Create an instance of Leopard using a model from Picovoice console or using the default model.

import {Leopard, LeopardErrors} from '@picovoice/leopard-react-native';
const accessKey = "${ACCESS_KEY}"
const modelPath = "${MODEL_FILE}"
try {
const leopard = await Leopard.create(accessKey, modelPath)
} catch (err: any) {
if (err instanceof LeopardErrors) {
// handle error

Transcribe an audio file by providing an absolute path to the file:

const transcript = await leopard.processFile("${AUDIO_FILE_PATH}")

Transcribe raw audio data (sample rate of 16 kHz, 16-bit linearly encoded and 1 channel):

const getAudioData = () => {
// ...
const transcript = await leopard.process(getAudioData())

Free resources used by Leopard:



For the Leopard React Native SDK, there is a React Native demo project available on the Picovoice GitHub repository.


Clone the Picovoice repository from GitHub:

git clone --recurse-submodules


  1. Install dependencies and setup environment:
cd leopard/demo/react-native
npm run android-install
# or
npm run ios-install
  1. Connect a mobile device or launch a simulator and run:
npm run android-run
# or
npm run ios-run

For more information on our Leopard demos for React Native, head over to our GitHub repository.






Issue with this doc? Please let us know.