Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

transcript with timestamps in python

import os
import sys
import speech_recognition as sr

with open("~/Documents/speech-to-text/speech2textgoogleapi.json") as f:
  GOOGLE_CLOUD_SPEECH_CREDENTIALS = f.read()
name = sys.argv[1] # wav file
r = sr.Recognizer()
all_text = []
with sr.AudioFile(name) as source:
  audio = r.record(source)
  # Transcribe audio file
  text = r.recognize_google_cloud(audio, credentials_json=GOOGLE_CLOUD_SPEECH_CREDENTIALS)
all_text.append(text)
with open("~/Documents/speech-to-text/transcript.txt", "w") as f:
  f.write(str(all_text))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #transcript #timestamps #python
ADD COMMENT
Topic
Name
9+7 =