Skip to content

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

License

Notifications You must be signed in to change notification settings

rxtoolkit/stt-ibm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@rxtk/stt-ibm

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

npm i @rxtk/stt-ibm
yarn add @rxtk/stt-ibm

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

Demo

To run the demo pipeline:

yarn demo:run <myInstanceId> --secret <secretAccessKey> --write-output

API

toIBM

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