I have tried to run the Google speech recognition code found here: <a href="https://github.com/jeysonmc/python-google-speech-scripts/blob/master/stt_google.py">https://github.com/jeysonmc/python-google-speech-scripts/blob/master/stt_google.py</a><div>
<br></div><div>I am getting the following traceback:</div><div><div>Traceback (most recent call last):</div><div>  File "<stdin>", line 1, in <module></div><div>  File "GoogSTT.py", line 43, in listen_for_speech</div>
<div>    data = stream.read(chunk)</div><div>  File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 605, in read</div><div>    return pa.read_stream(self._stream, num_frames)</div></div><div><br></div><div>which refers to this part of the code:</div>
<div><br></div><div><div>while (True):</div><div>        data = stream.read(chunk)</div><div><br></div><div>        slid_win.append (abs(audioop.avg(data, 2)))</div><div><br></div><div>        if(True in [ x>THRESHOLD for x in slid_win]):</div>
<div>            if(not started):</div><div>                print "starting record"</div><div>            started = True</div><div>            all_m.append(data)</div><div>        elif (started==True):</div><div>
            print "finished"</div><div>            #the limit was reached, finish capture and deliver</div><div>            filename = save_speech(all_m,p)</div><div>            stt_google_wav(filename)</div><div>
            #reset all</div><div>            started = False</div><div>            slid_win = deque(maxlen=SILENCE_LIMIT*rel)</div><div>            all_m= []</div><div>            print "listening ..."</div></div>
<div><br></div><div>I have run another bit of code is very similar to the above, to wit:</div><div><br></div><div><div>while 1:</div><div>        data = stream.read(CHUNK_SIZE)</div><div>        L = unpack('<' + ('h'*(len(data)/2)), data) # little endian, signed short</div>
<div>        L = array('h', L)</div><div>        LRtn.extend(L)</div><div><br></div><div>        </div></div><div>and get no errors, the code runs fine and records. Please note that the line in question is virtually identical in both snippets of code, one works, one does not. To the best of my ability I have verified what I know how to, for example chunk is set with a value previous, etc. Not sure where I'm running into problems, could use some guidance. NOTE: I did not post the entire code here for brevity, but it is available at the listed website or, if it is preferred, I can post it in a follow-on email.</div>
<div><br></div><div>regards, Richard </div><div><br></div><div><div><br></div>-- <br>
        
        
        <dl><dt>
        
        
        


<p style="margin-bottom:0in;line-height:0.18in" align="LEFT">
<font color="#333333"><font face="comic sans ms, sans-serif" size="4">quando om<font size="4">ni flunkus moritati</font><br></font></font></p></dt></dl>
</div>