Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
JavaScript speech recognition libraries turn recorded or live audio into text. Most send the audio to a cloud speech-to-text service that returns a transcript with timestamps and speaker labels. These libraries let voice agents, meeting tools, and captioning apps act on what people say.
Popularity
The ElevenLabs JavaScript SDK has the most monthly downloads in this comparison, at 5.7M, a count that covers every ElevenLabs API rather than speech recognition alone.
async function asyncRecognizeGCS(
gcsUri,
encoding,
sampleRateHertz,
languageCode
) {
// [START speech_transcribe_async_gcs] // Imports the Google Cloud client library const speech = require('@google-cloud/speech');
// Creates a client const client = new speech.SpeechClient();
/**
* TODO(developer): Uncomment the following lines before running the sample.
*/
// const gcsUri = 'gs://my-bucket/audio.raw'; // const encoding = 'Encoding of the audio file, e.g. LINEAR16'; // const sampleRateHertz = 16000; // const languageCode = 'BCP-47 language code, e.g. en-US'; const config = {
encoding: encoding,
sampleRateHertz: sampleRateHertz,
languageCode: languageCode,
};
const audio = {
uri: gcsUri,
};
const request = {
config: config,
audio: audio,
};
// Detects speech in the audio file. This creates a recognition job that you // can wait for now, or get its result later. const [operation] = await client.longRunningRecognize(request);
// Get a Promise representation of the final result of the job const [response] = await operation.promise();
const transcription = response.results
.map(result => result.alternatives[0].transcript)
.join('\n');
console.log(`Transcription: ${transcription}`);
// [END speech_transcribe_async_gcs]}
@aws-sdk/client-transcribe
Provides the AWS SDK client for Amazon Transcribe in Node.js, browsers, and React Native.
export default function BrowserNativeSTT({ sendCommand }) {
const previousTranscriptRef = useRef("");
const {
transcript,
listening,
resetTranscript,
browserSupportsSpeechRecognition,
browserSupportsContinuousListening,
isMicrophoneAvailable,
} = useSpeechRecognition({
clearTranscriptOnListen: true,
});
function startSTTSession() {
if (!isMicrophoneAvailable) {
alert(
"AnythingLLM does not have access to microphone. Please enable for this site to use this feature."
);
return;
}
resetTranscript();
previousTranscriptRef.current = "";
SpeechRecognition.startListening({
continuous: browserSupportsContinuousListening,
language: window?.navigator?.language ?? "en-US",
});
}
function endSTTSession() {
SpeechRecognition.stopListening();
// If auto submit is enabled, send an empty string to the chat window to submit the current transcript // since every chunk of text should have been streamed to the chat window by now. if (Appearance.get("autoSubmitSttInput")) {
sendCommand({
text: "",
autoSubmit: true,
writeMode: "append",
});
}
resetTranscript();
previousTranscriptRef.current = "";
clearTimeout(timeout);
}
useEffect(() => {
if (transcript?.length > 0 && listening) {
const previousTranscript = previousTranscriptRef.current;
const newContent = transcript.slice(previousTranscript.length);
// Stream just the diff of the new content since transcript is an accumulating string. // and not just the new content transcribed. if (newContent.length > 0)
sendCommand({ text: newContent, writeMode: "append" });
previousTranscriptRef.current = transcript;
clearTimeout(timeout);
timeout = setTimeout(() => {
endSTTSession();
}, SILENCE_INTERVAL);
}
}, [transcript, listening]);
if (!browserSupportsSpeechRecognition) return null;
return (
<MicButton
listening={listening}
onStart={startSTTSession}
onStop={endSTTSession}
/>
);
}
FAQ
The speech service decides the library. Deepgram, AssemblyAI, and ElevenLabs offer SDKs for prerecorded and live transcription. react-speech-recognition suits React apps that use the browser's own speech recognition.
Speaker diarization labels which speaker said each part of a transcript. Every cloud SDK in this comparison except react-speech-recognition returns speaker labels.
The Web Speech API is the browser's built-in speech recognition interface. react-speech-recognition wraps it in a React hook that returns the transcript and reports browser support.
Both Deepgram and AssemblyAI offer JavaScript SDKs for prerecorded and live audio with speaker labels. A test on the app's own recordings shows which service transcribes them better.