def get_read_available(self): """ Return the number of frames that can be read without waiting. :rtype: integer """ return pa.get_stream_read_available(self._stream)
print("* initializing") _portaudio.initialize() print("* opening") stream = _portaudio.open(format=get_format_from_width(wf.getsampwidth()), channels=wf.getnchannels(), rate=wf.getframerate(), input=True, output=True) data = wf.readframes(chunk) print("* starting stream") _portaudio.start_stream(stream) while data != '': _portaudio.write_stream(stream, data, chunk) data = wf.readframes(chunk) # OK... _portaudio.close(stream) # Fixed -- no longer relevant. An exception will be thrown. # -----DEPRECATED COMMENT: # BUT! don't re-use the stream object after closing it! # Depending on the platform, this might crash Python. print("* CRASH ----------*") print(_portaudio.get_stream_read_available(stream))
print "* initializing" _portaudio.initialize() print "* opening" stream = _portaudio.open(format = get_format_from_width(wf.getsampwidth()), channels = wf.getnchannels(), rate = wf.getframerate(), input = True, output = True) data = wf.readframes(chunk) print "* starting stream" _portaudio.start_stream(stream) while data != '': _portaudio.write_stream(stream, data, chunk) data = wf.readframes(chunk) # OK... _portaudio.close(stream) # Fixed -- no longer relevant. An exception will be thrown. # -----DEPRECATED COMMENT: # BUT! don't re-use the stream object after closing it! # Depending on the platform, this might crash Python. print "* CRASH ----------*" print _portaudio.get_stream_read_available(stream)