This Python script performs speech-to-text conversion using the SpeechRecognition
library, which utilizes the Google Web Speech API. It takes an audio file as input and outputs the recognized text.
- Python 3.x
SpeechRecognition
library
-
Clone this repository or download the script
speech_to_text.py
to your local machine. -
Install the required
SpeechRecognition
library using the following command:
-
Place your audio file (in WAV format) that you want to convert to text in the same directory as the
speech_to_text.py
script. -
Open a terminal and navigate to the directory containing the script.
-
Run the script using the following command:
-
To perform speech recognition on a recorded audio file: python script_name.py path_to_audio_file.wav
5.To perform live speech recognition using the microphone: python script_name.py live
-
The script will prompt you to provide the name of the audio file. Enter the name of the audio file (e.g.,
your_audio.wav
) and press Enter. -
The script will perform speech-to-text conversion using the Google Web Speech API and display the recognized text on the terminal.
-
The Google Web Speech API requires an internet connection to function.
-
If the API cannot recognize the audio or encounters an error, the script will provide appropriate error messages.
-
This script serves as a basic example of speech-to-text conversion. For more advanced features and customization, you might need to explore other speech recognition libraries and APIs.
This project is licensed under the MIT License.