npm

@lkennxyz/azure-stt-helper

1.0.6 • Public • Published

azure-STT-helper

npm Build Status

A simple Javascript wrapper over the Azure Speech Services Speech-To-Text (STT) REST API, because I didn't like the current Microsoft solution. Uses axios for the HTTP requests for Frontend & Backend support.

For an example usage see here.

Installing

$ npm install @lkennxyz/azure-stt-helper
/* or */
$ yarn add @lkennxyz/azure-stt-helper

Quickstart

import { azureSTT } from '@lkennxyz/azure-stt-helper'

async function stt () {

    /* Record or Import your wav file here... */

    const result = await azureSTT({
        region: 'YOUR_REGION',
        token: 'YOUR TOKEN',
        /* OR */
        subscriptionKey: 'YOUR_SUBSCRIPTION_KEY',
        language: 'YOUR_LANGUAGE',
        wav: yourWavFile,
    });
    //Output just the STT result text
    console.log(result.DisplayText);
}

Functions

azureSTT

Makes a request to the Azure Speech Service STT REST API, returns the body of the response.

parameters

  • region (required): The azure region for your Speech Services Instance

MUST USE EITHER TOKEN OR SUBSCRIPTION KEY

  • token (optional): The Bearer token obtained by the getToken function
  • subscriptionKey (optional): The subscription key for your Speech Services Instance
  • language (optional): language used in the recording (defaults to ‘en-US’)

getToken

Obtains a bearer token from azure to authenticate instead of using the subscriptionKey, returns the bearer token as a string.

parameters

  • region (required): The azure region for your Speech Services Instance
  • subscriptionKey (required): The subscription key for your Speech Services Instance

Resources

Microsoft STT REST documentation

License

MIT

Package Sidebar

Install

npm i @lkennxyz/azure-stt-helper

Weekly Downloads

8

Version

1.0.6

License

MIT

Unpacked Size

7.57 kB

Total Files

6

Last publish

Collaborators

  • lkennxyz