Skip to content

πŸŽ™οΈ Recognize and transcribe speech using React Native

License

Notifications You must be signed in to change notification settings

kuatsu/react-native-voicekit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

53 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ™οΈ react-native-voicekit

VoiceKit is a powerful speech recognition library for React Native that enables voice transcription across platforms. It provides direct access to native speech recognition APIs for optimal performance and aligns the API behavior between the different platforms.

npm bundle size GitHub GitHub last commit

Warning

This project is still considered unstable and under active development. The API might change drastically in new versions. Please proceed with caution.

  • ⚑ Real-time speech-to-text transcription
  • πŸ“± iOS and Android support using native speech recognition APIs
  • πŸ§ͺ Fully compatible with Expo
  • ⚑ iOS and Android APIs aligned for consistent behavior and superior developer experience
  • πŸŽ›οΈ Single and continuous recognition modes
  • 🎨 Simple and intuitive React Hooks API
  • πŸ’ͺ TypeScript support out of the box
  • πŸ‘Œ Lightweight with zero dependencies

Installation

React Native

npm install react-native-voicekit
cd ios && pod install

Expo

npx expo install react-native-voicekit

Afterwards, add the config plugin to the plugins section of your app.json:

{
  "plugins": [
    [
      "react-native-voicekit",
      {
        "speechRecognitionPermission": "Custom iOS speech recognition permission message (optional)",
        "microphonePermission": "Custom iOS microphone permission message (optional)"
      }
    ]
  ]
}

Finally, expo prebuild or rebuild your development client.

Quick Start

import React from 'react';
import { View, Text, Button } from 'react-native';
import { useVoice, VoiceMode } from 'react-native-voicekit';

const App = () => {
  const { available, listening, transcript, startListening, stopListening } = useVoice({
    locale: 'en-US',
    mode: VoiceMode.Continuous,
    enablePartialResults: true,
  });

  return (
    <View>
      {available ? (
        <>
          <Text>Is listening: {listening ? 'Yes' : 'No'}</Text>
          <Text>Transcript: {transcript}</Text>
          <Button onPress={startListening} title="Start Listening" />
          <Button onPress={stopListening} title="Stop Listening" />
        </>
      ) : (
        <Text>Speech recognition is not available on this device.</Text>
      )}
    </View>
  );
};

Documentation

A documentation is work in progress.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT