Socket
Socket
Sign inDemoInstall

@aws-sdk/client-transcribe-streaming

Package Overview
Dependencies
31
Maintainers
4
Versions
387
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/client-transcribe-streaming


Version published
Maintainers
4
Created

Package description

What is @aws-sdk/client-transcribe-streaming?

@aws-sdk/client-transcribe-streaming is an AWS SDK for JavaScript package that allows developers to use Amazon Transcribe Streaming, a service that provides real-time speech-to-text capabilities. This package enables applications to transcribe audio streams into text in real-time, which can be useful for various applications such as live captioning, real-time transcription, and voice command processing.

What are @aws-sdk/client-transcribe-streaming's main functionalities?

Real-time Transcription

This feature allows you to start a real-time transcription session. The code sample demonstrates how to set up a TranscribeStreamingClient, create an audio stream, and start the transcription process. The transcription results are logged to the console as they are received.

const { TranscribeStreamingClient, StartStreamTranscriptionCommand } = require('@aws-sdk/client-transcribe-streaming');
const { Readable } = require('stream');

const client = new TranscribeStreamingClient({ region: 'us-west-2' });

const audioStream = new Readable();
audioStream._read = () => {}; // No-op

const command = new StartStreamTranscriptionCommand({
  LanguageCode: 'en-US',
  MediaSampleRateHertz: 16000,
  MediaEncoding: 'pcm',
  AudioStream: audioStream
});

const response = await client.send(command);

response.TranscriptResultStream.on('data', (event) => {
  console.log(event.TranscriptEvent.Transcript.Results);
});

audioStream.push(audioBuffer); // Push audio data to the stream

Handling Transcription Events

This feature demonstrates how to handle transcription events. The code sample shows how to process partial and final transcription results from the TranscriptResultStream.

response.TranscriptResultStream.on('data', (event) => {
  event.TranscriptEvent.Transcript.Results.forEach(result => {
    if (result.IsPartial) {
      console.log('Partial transcript:', result.Alternatives[0].Transcript);
    } else {
      console.log('Final transcript:', result.Alternatives[0].Transcript);
    }
  });
});

Stopping the Transcription

This feature shows how to stop the transcription process by signaling the end of the audio stream. The code sample demonstrates how to push a null value to the audio stream to indicate that no more audio data will be sent.

audioStream.push(null); // Signal the end of the audio stream

Other packages similar to @aws-sdk/client-transcribe-streaming

Readme

Source

@aws-sdk/client-transcribe-streaming

NPM version NPM downloads

For SDK usage, please step to SDK reademe.

FAQs

Last updated on 07 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc