npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@picovoice/cheetah-react-native

v2.0.1

Published

Picovoice Cheetah React Native binding

Downloads

45

Readme

Cheetah Binding for React Native

Cheetah Speech-to-Text Engine

Made in Vancouver, Canada by Picovoice

Cheetah is an on-device speech-to-text engine. Cheetah is:

  • Private; All voice processing runs locally.
  • Accurate
  • Compact and Computationally-Efficient
  • Cross-Platform:
    • Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
    • Android and iOS
    • Chrome, Safari, Firefox, and Edge
    • Raspberry Pi (4, 3) and NVIDIA Jetson Nano

Compatibility

This binding is for running Cheetah on React Native 0.62.2+ on the following platforms:

  • Android 5.0+ (SDK 21+)
  • iOS 11.0+

Installation

To start install, ensure you have installed yarn and CocoaPods. Then, add the following native modules to your react-native project:

yarn add @picovoice/cheetah-react-native

or

npm i @picovoice/cheetah-react-native --save

Link the iOS package:

cd ios && pod install && cd ..

NOTE: Due to a limitation in React Native CLI auto-linking, the native module cannot be included as a transitive dependency. If you are creating a module that depends on cheetah-react-native, you will have to list these as peer dependencies and require developers to install it alongside.

AccessKey

Cheetah requires a valid Picovoice AccessKey at initialization. AccessKey acts as your credentials when using Cheetah SDKs. You can get your AccessKey for free. Make sure to keep your AccessKey secret. Signup or Login to Picovoice Console to get your AccessKey.

Adding Cheetah Models

Create a custom model using the Picovoice Console or use the default model.

Android

To add a Leopard model file to your Android application, add the file as a bundled resource by placing it under the assets directory of your Android application.

iOS

To add a Leopard model file to your iOS application, add the file as a bundled resource by selecting Build Phases in Xcode and adding it to the Copy Bundle Resources step.

Usage

Create an instance of Cheetah:

import {Cheetah, CheetahErrors} from '@picovoice/cheetah-react-native';

const accessKey = "${ACCESS_KEY}" // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
const modelPath = "${CHEETAH_MODEL_PATH}" // path relative to the assets folder or absolute path to file on device

try {
    const cheetah = await Cheetah.create(accessKey, modelPath)
} catch (err: any) {
  if (err instanceof CheetahErrors) {
    // handle error
  }
}

Transcribe real-time audio:

const getAudioFrame = () => {
  // get audio frames
}

let transcript = ""
try {
  while (1) {
    const partialResult = await cheetah.process(getAudioFrame())
    transcript += partialResult.transcript
    if (partialResult.isEndpoint) {
      const finalResult = await cheetah.flush()
      transcript += finalTranscript.transcript
    }
  }
} catch (err: any) {
  if (err instanceof CheetahErrors) {
    // handle error
  }
}

Finally, when done be sure to explicitly release the resources using cheetah.delete().

Demo App

For example usage refer to our React Native demo application.