Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rxtoolkit/stt-gcp
👂 RxJS operator for realtime speech-to-text (STT/S2T) using GCP speech-to-text
https://github.com/rxtoolkit/stt-gcp
fp functional-programming observables package reactive-programming rxjs speech-to-text stt transcription
Last synced: 6 days ago
JSON representation
👂 RxJS operator for realtime speech-to-text (STT/S2T) using GCP speech-to-text
- Host: GitHub
- URL: https://github.com/rxtoolkit/stt-gcp
- Owner: rxtoolkit
- License: mit
- Created: 2021-02-09T21:25:55.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-16T18:40:09.000Z (11 months ago)
- Last Synced: 2024-12-15T19:25:40.805Z (26 days ago)
- Topics: fp, functional-programming, observables, package, reactive-programming, rxjs, speech-to-text, stt, transcription
- Language: JavaScript
- Homepage:
- Size: 3.57 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @rxtk/stt-gcp
> 👂 An RxJS operator for real-time speech-to-text (STT/S2T) streaming using the GCP speech-to-text API.> 🍎 If you are using an Apple Silicon (ARM) machine, this package only works in node >15.x
```bash
npm i @rxtk/stt-gcp
``````bash
yarn add @rxtk/stt-gcp
```⚠️ To run the GCP transcription pipeline, you will need to provide a path to JSON containing your `GOOGLE_APPLICATION_CREDENTIALS`. You can set this as an environment variable or pass it in.
⚠️ node.js only. This has not been tested on Browsers but it might be possible to make it work. If you get it working, please make a PR!
## API
### `toGCPSpeech`
Stream audio speech data to AWS Transcribe via WebSocket and get transcripts back:
```js
import {map} from 'rxjs/operators';
import {toGCPSpeech} from '@rxtk/stt-gcp';// The pipeline can take a stream of audio chunks encoded as
// LINEAR16 (PCM encoded as 16-bit integers) in the form of a Buffer
const buffer$ = pcmChunkEncodedAs16BitIntegers$.pipe(
map(chunk => Buffer.from(chunk, 'base64')),
toGCPSpeech({
sampleRate: 16000, // optional
contentType: 'audio/l16', // optional
googleCreds: process.env.GOOGLE_APPLICATION_CREDENTIALS, // required
useSpeakerLabels: true, // optional
useWordConfidence: true, // optional
usePunctuation: true, // optional
})
);
buffer$.subscribe(console.log); // log transcript output
```## Guides
- [Introduction to audio data](https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Audio_concepts)