Python Forum
Getting MemoryError frames.write(buffer)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting MemoryError frames.write(buffer)
#1
I am trying to use the code given in below link: https://pypi.org/project/SpeechRecognition/1.2.3/

Below is the code:


import speech_recognition as sr
r = sr.Recognizer()
with sr.WavFile("audio.wav") as source:              # use "test.wav" as the audio source
    audio = r.record(source)                        # extract audio data from the file

try:
    print("Transcription: " + r.recognize(audio))   # recognize speech using Google Speech Recognition
except LookupError:                                 # speech is unintelligible
    print("Could not understand audio")
But it ran into below error:

Quote:>python s2t.py
Traceback (most recent call last):
File "s2t.py", line 4, in <module>
audio = r.record(source) # extract audio data from the file
File "C:\Users\<myuser>\AppData\Local\Programs\Python\Python36-32\lib\site-packages\speech_recognition\__init__.py", line 504, in record
frames.write(buffer)
MemoryError

Can you please suggest how to resolve this memory or code error?

Few other details:

1. I am on windows 10
2. I tried replacing recognize(audio) with recognize_google(audio) . Same error.
3. The size of audio.wav is 750MB. I have 16GB ram on my PC.

Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  MemoryError in pywinauto.findwindows.find_windows – Need Help! ktw3857 1 253 Yesterday, 04:28 PM
Last Post: itegumo
  Read buffer from bluetooth frohr 2 2,132 Jun-01-2022, 01:31 PM
Last Post: frohr
  JS Buffer.from VS struct.pack DreamingInsanity 3 2,449 Apr-05-2021, 06:27 PM
Last Post: DreamingInsanity
  Seperate output buffer matt_the_hall 2 2,350 Mar-15-2021, 08:44 PM
Last Post: matt_the_hall
  PyAudio Buffer Data Calculation MclarenF1 0 2,128 Aug-21-2020, 10:55 AM
Last Post: MclarenF1
  Code starts slowing down? MemoryError AshkanDev 1 2,146 May-19-2020, 11:38 PM
Last Post: AshkanDev
  Additional buffer for Windows constantin01 0 1,392 Mar-31-2020, 10:24 AM
Last Post: constantin01
  MemoryError AwaAgathe 0 1,728 Feb-26-2019, 02:57 AM
Last Post: AwaAgathe
  MemoryError mitmoot 5 3,812 Dec-07-2018, 04:53 PM
Last Post: mitmoot
  The supplied user buffer is not valid for the requested operation. py2exe 1 3,305 Apr-27-2018, 12:17 AM
Last Post: py2exe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020