A client for Amazon Transcribe using the websocket interface
With NPM install the module with:
npm install aws-transcribe --save
With YARN install the module with:
yarn add aws-transcribe
An example of streaming from microphone can be found in src/examples/stream-from-microphone.ts
.createStreamingClient// enums for returning the event names which the stream will emit.onStreamingClient.EVENTS.OPEN,console.log`transcribe connection opened`.onStreamingClient.EVENTS.ERROR, console.error.onStreamingClient.EVENTS.CLOSE,console.log`transcribe connection closed`.onStreamingClient.EVENTS.DATA,yourStream.pipetranscribeStream
This creates a service wrapper which can then be used to create a streaming client
clientConfig is optional and can be provided with the following properties:
accessKeyIdif not provided, the package will look for
secretAccessKeyif not provided, the package will look for
This will create a presigned url using the config and return an instance of StreamingClient which is a wrapper around the websocket. It will decode binary messages coming from AWS and encode messages to binary when sending them
transcribeStreamConfig is required and must have the following properties:
regionmust be one of "us-east-1", "us-east-2", "us-west-2", "ap-southeast-2", "ca-central-1", "eu-west-1"
languageCodemust be one of "en-US", "en-AU", "en-GB", "fr-CA", "fr-FR", "es-US"
sampleRatemust be between 8000 and 44100 - the supported sample rate differs depending on the language code being used. For more information, go here
open- when the socket to aws is opened
error- any errors sent as part of websocket message or websocket error
data- emits the transcription object
close- when the socket to aws closes
set environment variable to below when running your application.
If you discover a bug, please raise an issue on Github. https://github.com/qasim9872/aws-transcribe/issues
Pull requests are very welcome. Please:
- ensure all tests pass before submitting PR
- add tests for new features
- document new functionality/API additions in README.md
Copyright (c) 2020 Muhammad Qasim. Licensed under the MIT license.