Amir231123 / Meo

Apache License 2.0
0 stars 0 forks source link

transcribe_audio.py. #2

Open Amir231123 opened 3 days ago

Amir231123 commented 3 days ago

import speech_recognition as sr

Path to your .wav file

audio_file_path = "path_to_your_file.wav"

Initialize recognizer class (for recognizing the speech)

recognizer = sr.Recognizer()

Recognize the speech in the audio file

with sr.AudioFile(audio_file_path) as source: audio_data = recognizer.record(source)

Convert speech to text

text = recognizer.recognize_google(audio_data)

Print the transcribed text

print("Transcription:\n", text)