JSPM

sonix-speech-recognition

2.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5923
  • Score
    100M100P100Q134223F
  • License MIT

A library that produces audio transcriptions and translations using the Sonix.AI service.

Package Exports

  • sonix-speech-recognition
  • sonix-speech-recognition/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sonix-speech-recognition) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sonix-speech-recognition

A library for producing audio transcriptions and translations using the Sonix AI service https://sonix.ai/.

Getting started

  1. Create an account on https://sonix.ai/
  2. Obtain the auth key from https://my.sonix.ai/api page

Install

npm install sonix-speech-recognition

Usage

Transcribe a publicly available file

import { SonixSpeechRecognitionService } from 'sonix-speech-recognition';

const recognitionService = new SonixSpeechRecognitionService(AUTH_KEY);
const { jobId, text, status, error } = await recognitionService.speechToText({
  audioUrl: audioPublicUrl,
  fileName,
  language: 'en',
});

if (status === 'failed') {
  // handle error
}

Transcribe a local file

import { SonixSpeechRecognitionService } from 'sonix-speech-recognition';

const recognitionService = new SonixSpeechRecognitionService(AUTH_KEY);
const { jobId, text, status, error } = await recognitionService.speechToText({
  audioFilePath,
  fileName,
  language: 'en',
});

if (status === 'failed') {
  // handle error
}

Transcribe and translate a local file

import { SonixSpeechRecognitionService } from 'sonix-speech-recognition';

const recognitionService = new SonixSpeechRecognitionService(AUTH_KEY);
const { jobId, text } = await recognitionService.speechToText({
  audioFilePath,
  fileName,
  language: 'en',
});

const {
  text: translatedText,
  status,
  error,
} = await sonixSpeechKitService.translateTranscription({
  transcriptionJobId: jobId,
  language: 'fr',
});

if (status === 'failed') {
  // handle error
}