python-speech-recognition icon indicating copy to clipboard operation
python-speech-recognition copied to clipboard

speech file can't be longer than 30 seconds

Open jzoudavy opened this issue 7 years ago • 1 comments

hi

i modifed your code a bit to read from sample file. My sample file is 55 seconds long and I noticed that it get's cut off.

I am using recognize_google.

I am guessing this is some sort of api limitation and that I should probably get my own key.

jzoudavy avatar May 15 '18 03:05 jzoudavy

@jzoudavy Yes, this is a limitation of the Google Web Speech API. Unfortunately, I don't think you get any additional length by using your own key. For longer files, you have a couple of options:

  1. Break them up into chunks, either manually with audio editing software, or using the offset and duration keyword arguments for the .record() method.
  2. Use the .listen() method to capture speech until a pause is detected. This is not covered in the article. You can find information about this method in the Speech Recognition docs.
  3. Use the Google Cloud Speech API. That is not a free API, although you can get an account with a free $300 credit for one year at https://cloud.google.com. I don't cover setting up an account and obtaining a key for the Google Cloud platform in the article. Here is a quick start on how to do that from the Google Cloud docs: https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries.

Hope that helps!

somacdivad avatar May 15 '18 12:05 somacdivad