Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rxtoolkit/stt-ibm

👂 An RxJS operator for real-time speech-to-text (STT/S2T) streaming using the IBM Watson.
https://github.com/rxtoolkit/stt-ibm

ai fp functional-programming observables package reactive-programming rxjs speech-to-text stt transcription

Last synced: 7 days ago
JSON representation

👂 An RxJS operator for real-time speech-to-text (STT/S2T) streaming using the IBM Watson.

Awesome Lists containing this project

README

        

# @rxtk/stt-ibm
> 👂 An RxJS operator for real-time speech-to-text (STT/S2T) streaming using the IBM Watson.

```bash
npm i @rxtk/stt-ibm
```

```bash
yarn add @rxtk/stt-ibm
```

You'll need an IBM Watson account with credentials for the STT API.

## Demo
To run the demo pipeline:
```bash
yarn demo:run --secret --write-output
```

## API

### `toIBM`
```js
import {from} from 'rxjs';
import {myFunction} from '@rxtk/stt-ibm';
import {fromFile} from '@rxtk/fs';

const filePath = 'path/to/audio-file.linear16';
// For a full list of options, see ./src/lib/toIBM.js
const params = {
secretAccessKey: process.env.IBM_SECRET_ACCESS_KEY,
instanceId: process.env.IBM_STT_INSTANCE_ID,
region: 'us-east',
};
const audioChunk$ = fromFile(filePath);
const output$ = audioChunk$.pipe(toIBM(params));
output$.subscribe(console.log);
// Output:
// {...resultFromIBMWatson}
// {...anotherResultFromIBMWatson}
output$.error$.subscribe(console.error); // optional: handle Websocket Errors
```

## References
- [IBM Speech-to-text docs](https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websockets)