Example #1
0
    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)
Example #2
0
    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)
Example #3
0
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))
Example #4
0
File: bad.py Project: DNESS/PyAudio
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)