This article introduces an online web-based real-time speech recognition tool that supports real-time microphone recording recognition and audio/video file speech recognition, and is available for free use (no usage restrictions).
Speech recognition technology, also known as speech-to-text, utilizes artificial intelligence to convert speech in audio or video into text. This technology has a wide range of applications in various fields, such as meeting minutes, voice assistants, subtitle generation, and more.
Currently, there are two main approaches to speech recognition:
1. Offline Model-Based Speech Recognition:
This approach requires deploying a speech recognition model on a local computer. A popular open-source solution is OpenAI Whisper. After downloading its large model (e.g., large-v2), it can be used offline, without internet connection and free of charge.
However, this method requires significant computing resources (e.g., a powerful graphics card), otherwise the recognition speed will be slow, and the accuracy will decrease.
2. Online API-Based Speech Recognition:
Some companies provide online speech recognition API services, such as ByteDance and OpenAI.
Users only need to upload audio data to the API to obtain transcription results.
This approach does not require local hardware resources, is fast and accurate, but requires paying a certain fee.
Real-time Speech Recognition
The above two methods are mainly for existing audio or video files. So, how can we perform real-time transcription of audio streams recorded in real-time from a microphone? For example, how to record speeches in a meeting in real-time and convert them into text?
Real-time speech recognition is similar in principle to file transcription, but technically more difficult. It requires:
- Real-time Data Stream Processing: Continuously receiving audio data from the microphone.
- Data Segmentation and Recognition: Dividing the continuous audio stream into smaller segments and recognizing them one by one.
- Result Integration and Error Correction: Integrating the recognition results of each segment and correcting errors to improve the accuracy of the final transcription. This usually requires more complex algorithms to handle speech pauses, overlaps, etc.
- Minimal Latency: It is necessary to minimize the delay from audio input to text output to ensure real-time performance.
Technical Principles and Usage Introduction
- Real-time Microphone Recording Recognition: Use a microphone to record audio in real-time and transcribe it in real-time.
- Audio/Video File Speech Recognition: Supports uploading local audio or video files for transcription.
Technical Principles:
Lightweight Speech Recognition Model (Vosk): In order to run in a browser environment, we adopted the small and lightweight Vosk speech recognition model. Although its accuracy is relatively low, it can effectively reduce resource consumption and ensure smooth operation in the browser.
Local Audio Processing (ffmpeg.wasm): Use ffmpeg.wasm to process audio and video files and extract speech within the user's browser, without uploading audio data to the server.
Client-Side Model Loading: The speech recognition model is downloaded and run in the browser's memory. This limits us from using larger and more accurate models and forces us to choose smaller models to avoid browser crashes. Even if the user's computer has strong performance, large models are not currently supported due to server bandwidth limitations.
Usage Instructions
- Model Loading: Before use, please load the Chinese or English model as needed.
- Microphone Recognition: Click the button in the left area to start real-time recording and recognition using the microphone. The recognition result will be displayed in the text box in real-time.
- File Recognition: Select a local audio or video file in the right area, and the tool will use ffmpeg.wasm to process it locally and perform speech recognition. The result is displayed in the text box.
- Result Download: The transcribed text can be downloaded as a TXT file.
Precautions
- Mutually Exclusive Functions: Microphone real-time recognition and file recognition functions cannot be used simultaneously.
- Local Processing: The model and audio processing are performed locally in the user's browser.
- Language Support: Currently, only Chinese and English speech recognition are supported.
- Performance Limitations: Due to the use of a lightweight model, the recognition accuracy may not be as good as larger models.
Common Questions
- Q: What if the recognition accuracy is low? A: We use a lightweight model to ensure browser compatibility and running speed. If you need higher accuracy, it is recommended to download pyVideoTrans and use the large-v2 model locally.
- Q: Which languages are supported? A: Currently, only Chinese and English are supported.
- Q: Why is the speed slow? A: This may be due to network conditions, browser performance, or insufficient computer resources.
- Q: How large files can I upload? A: The file size is limited by browser memory and processing power.