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
- Create an account on https://sonix.ai/
- 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
}