Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ublib/aws-speech-to-text

Amazon Transcribe's speech to text client for TypeScript.
https://github.com/ublib/aws-speech-to-text

amazon-transcribe amazon-transcribe-api api-client packaging speech-to-text type-safe typescript

Last synced: 26 days ago
JSON representation

Amazon Transcribe's speech to text client for TypeScript.

Awesome Lists containing this project

README

        

# aws-speech-to-text

Amazon Transcribe's speech to text client for TypeScript.

status: early development (**not published**)

## Usage

### Basic Usage

```sh
npm install aws-s2t

# install amplify core if you don't have it (for signing)
npm install @aws-amplify/core
```

```ts
import { Credentials, Signer } from "@aws-amplify/core";
import { createTranscribeClient } from "aws-s2t";

const transcribe = createTranscribeClient(Signer, await Credentials.get(), {
region: "us-east-1",
languageCode: "en-US",
});

// send your audio rawChunks
const result = await transcribe(rawChunks);
console.log(result);
```

### Use with Recorder on Browser

```sh
npm install @aws-s2t/record
```

```ts
import { Credentials, Signer } from "@aws-amplify/core";
import { createTranscribeClient } from "aws-s2t";
import { AudioRecorder } from "@aws-s2t/record";

const transcribe = createTranscribeClient(Signer, await Credentials.get(), {
region: "us-east-1",
languageCode: "en-US",
});

const recorder = new AudioRecorder({
onStopped: async (rawChunks) => {
const result = await transcribe(rawChunks);
console.log(result);
},
});

// bind actions
document
.getElementById("start-btn")
?.addEventListener("click", () => recorder.start());
document
.getElementById("stop-btn")
?.addEventListener("click", () => recorder.stop());
```

### Streaming

WIP