@algrith/transcriber
v1.0.2
Published
A lightweight npm utility built on the Google speech-to-text API for converting pre-recorded speech to text, ideal for processing audio files, creating captions, and enhancing accessibility.
Maintainers
Readme
Features
The Algrith Transcriber (npm package) supports:
- 🎵 Wide range of audio files - mp3, wav, aac, etc.
- 🎙️ Speech-to-text(STT) transcription.
- 🤖 Supports Google STT engine.
Quick start
npm install @algrith/transcriberor via yarn
yarn add @algrith/transcriberUsage & Examples
Currently, there is an implemented usage for NextJs (Using page router) example.
Note: Currently, we only support Google STT engine.
import useTranscriber from '@algrith/transcriber';
const apiKey = // Your Google API key;
const options = {
engine: 'google' // Currently only Google engine is supported.
}
const Transcriber = (somePreRecordedBlob: Blob) => {
const { transcribe, response } = useTranscriber(apiKey, options);
// You can call transcribe with an audio blob
const handleTranscription = () => transcribe(somePreRecordedBlob);
return (
<div>
<button type="button" disabled={response.loading} onClick={handleTranscription}>
Transcribe audio
</button>
<div>
{response.transcript && (
<p>{response.transcript}</p>
)}
{response.loading && (
<p>Transcribing audio...please wait!</p>
)}
{response.error && (
<p>An error occurred: {response.error}</p>
)}
</div>
</div>
);
};
export default Transcriber;TypeScript Support
Types can be found at https://github.com/algrith/transcriber/tree/main/src/types.
Contributing
- Missing something or found a bug? Report here.
