sonix-speech-recognition
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

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
}

Package Sidebar

Install

npm i sonix-speech-recognition

Weekly Downloads

1,165

Version

2.1.1

License

MIT

Unpacked Size

18.2 kB

Total Files

11

Last publish

Collaborators

  • enigmadalio7