# react-native-whisper

> React Native implementation of OpenAI's Whisper automatic speech recognition (ASR) model

Latest version **0.0.1** (published 2023-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-whisper
pnpm add react-native-whisper
yarn add react-native-whisper
bun add react-native-whisper
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-03-12 |
| First published | 2023-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 862.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | psquizzle |
| Maintainers | psquizzle |
| Keywords | react-native, ios, android, whisper, OpenAI |

## Links

- npm: https://www.npmjs.com/package/react-native-whisper
- Repository: https://github.com/psquizzle/react-native-whisper
- Issues: https://github.com/psquizzle/react-native-whisper/issues
- npm.io page: https://npm.io/package/react-native-whisper

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2023-03-12

## README

#  react-native-whisper

This is a proof of concept of a JSI library for [OpenAI Whisper ](https://openai.com/research/whisper), it combines a C++ port of Whisper from [whisper.cpp](https://github.com/ggerganov/whisper.cpp) and a JSI template from [this blog.](https://blog.notesnook.com/getting-started-react-native-jsi/)


## Usage 

```js
import Whisper from 'react-native-whisper'

Whisper.transcribeWavToText(pathOfModel,pathOfAudio,(text)=>{alert(text)})

```

You can specify the location of the model or .wav audio file by providing either its full path (e.g., file:///path/to/file) or its Unix-style path (e.g., /path/to/file).




This project is in no way stable or complete!! Feel free to contribute.


## Installation

```sh
npm install react-native-whisper
```

```sh
yarn add react-native-whisper
```

For iOS also run `pod install` in `/ios` folder.

If you are using with Expo, run

```sh
expo prebuild
```


## Prerequisites
You must have Android NDK and CMake installed on android to build the library.

## Methods
The following methods are implemented.

### Platfom agnostic
The relevant code is present in `cpp/example.cpp` file.
```ts
    helloWorld():string;

    multiplyWithCallback(x:number,y:number,callback:(z:number) => void):void
    
    multiply(x:number,y:number):number
```

### Platform specific
The relevant code on android is in `android/cpp-adapter.cpp` and `ios/SimpleJsi.mm` on iOS.
```ts
    getDeviceName():string
    
    setItem(key:string,value:string):boolean

    getItem(key:string):string
```

## Basic usage example
```tsx
import simpleJsiModule from "react-native-jsi-template";

simpleJsiModule.helloWorld() // returns helloworld.
```
Run the example app for more.


## Thanks to these libraries & their authors:
The initial work done by authors of the following libraries has helped a lot in writing the blog and keeping this repo updated.

- [react-native-mmkv](https://github.com/mrousavy/react-native-mmkv/)
- [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated/)

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT

---
_Source: https://npm.io/package/react-native-whisper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
