Skip to content

NotGeorgeMessier/nitro-speech

Repository files navigation

react-native-nitro-speech

npm version license npm downloads

React Native real-time Speech Recognition Library powered by Nitro Modules

This is react-native-nitro-speech package (npm). The old name @gmessier/nitro-speech will be deprecated soon (npm). If you are using the old name, please switch to the new one.

The API is identical β€” no migration needed.

Key Features:

  • ⚑ Built with Nitro Modules for low-overhead native binding
  • 🌎 Supports 60+ languages
  • 🍎 The only library implementing new SpeechAnalyzer with SpeechTranscriber or DictationTranscriber API for iOS 26+ (with fallback to legacy SFSpeechRecognition for older versions)
  • 🧡 Full support of react-native-worklets - each method is accessible from any runtime
  • ⏱️ Timer for silence
    • Configurable and mutable autoFinishRecognitionMs value (default: 8 sec)
    • Callback onAutoFinishProgress fires periodically with an interval
    • Configurable and mutable interval autoFinishProgressIntervalMs value (default: 1 sec)
    • Method resetAutoFinishTime resets the timer to the threshold
    • Method addAutoFinishTime adds time once without changing threshold
    • Configurable volume-based sensitivity resetAutoFinishVoiceSensitivity
  • 🎀 Rich user voice input management
    • Hook useVoiceInputVolume and method getVoiceInputVolume for displaying volume in dB or making UI animations with smoothedVolume
    • Callback onVolumeChange for advanced use cases
  • 🧩 Session Lifecycle methods: prewarm and updateConfig
  • πŸ‘† Configurable Haptic Feedback on start and finish
  • 🎚️ Speech-quality features: see full list here
  • πŸ”“ Embedded Permission handling
    • Callback onPermissionDenied and method getPermissions
    • Option requestPermission for prewarm method
  • πŸ“¦ Everything else that could be found in Expo or other libraries

Table of Contents

Installation

npm install react-native-nitro-speech react-native-nitro-modules
# or
yarn add react-native-nitro-speech react-native-nitro-modules
# or
bun add react-native-nitro-speech react-native-nitro-modules

Expo

This library works with Expo. You need to run prebuild to generate native code:

npx expo prebuild

Note: Make sure New Arch is enabled in your Expo configuration before running prebuild.

iOS

cd ios && pod install

Android

No additional setup required.

Permissions

More about permissions here

Android

No actions required. The library declares the required permission in its AndroidManifest.xml (merged automatically):

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

iOS

Add the following keys to your app's Info.plist:

<key>NSMicrophoneUsageDescription</key>
<string>This app needs microphone access for speech recognition</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>This app needs speech recognition to convert speech to text</string>

Both permissions are required for speech recognition to work on iOS.

Features

Feature Documentation page iOS Android
Real-time transcription Link πŸ”— βœ… βœ…
Full worklets support Link πŸ”— βœ… βœ…
New advanced iOS models Link πŸ”— βœ… βœ…
Locale support Link πŸ”— βœ… βœ…
Auto-finish on silence Link πŸ”— βœ… βœ…
Auto-finish progress Link πŸ”— βœ… βœ…
Auto-finish progress interval Link πŸ”— βœ… βœ…
Add Auto-finish Time Link πŸ”— βœ… βœ…
Reset Auto-finish Time Link πŸ”— βœ… βœ…
Reset Auto-finish Sensitivity Link πŸ”— βœ… βœ…
Voice input volume Link πŸ”— βœ… βœ…
Prewarm Link πŸ”— βœ… βœ…
Update config Link πŸ”— βœ… βœ…
Active state Link πŸ”— βœ… βœ…
Haptic feedback Link πŸ”— βœ… βœ…
Permission handling Link πŸ”— βœ… βœ…
Background handling Link πŸ”— βœ… βœ…
Repeating word filter Link πŸ”— βœ… βœ…
Offensive word masking Link πŸ”— iOS 26+ βœ…
Contextual strings Link πŸ”— βœ… βœ…
Language model selection Link πŸ”— Auto βœ…
Batch handling Link πŸ”— Auto βœ…
Formatting quality Link πŸ”— Auto βœ…
Transcription preset Link πŸ”— βœ… Auto
Automatic punctuation Link πŸ”— βœ… Auto
Atypical speech hint Link πŸ”— βœ… Auto
getSupportedLocalesIOS Link πŸ”— βœ… X

Requirements

  • React Native >= 0.76
  • New Arch Only
  • react-native-nitro-modules

Compatibility

react-native-nitro-modules published a version 0.35.0 that is incompatible with older versions.

If your project can't migrate to the latest version of react-native-nitro-modules, you can use the older versions of @gmessier/nitro-speech

nitro-speech react-native-nitro-modules
@gmessier/nitro-speech < 0.3.* react-native-nitro-modules < 0.35.0
@gmessier/nitro-speech >= 0.3.* react-native-nitro-modules >= 0.35.0
react-native-nitro-speech * react-native-nitro-modules >= 0.35.0

Contributions and feedback

If you hit an issue or want to request a feature, please open a GitHub issue or reach out to me on Discord / Twitter (X) β€” response is guaranteed.

Troubleshooting

Android Gradle sync issues

If you're having issues with Android Gradle sync, try running the prebuild for the library that causes the issue:

e.g. failed in react-native-nitro-modules:

cd android && ./gradlew :react-native-nitro-modules:preBuild

e.g. failed in react-native-worklets:

cd android && ./gradlew :react-native-worklets:preBuild

License

MIT

About

React Native Speech Recognition Library powered by Nitro Modules

Resources

License

Stars

18 stars

Watchers

0 watching

Forks

Contributors