Exemple #1
0
    def close(self):
        """ Close the stream """

        pa.close(self._stream)

        self._is_running = False

        self._parent._remove_stream(self)
Exemple #2
0
    def close(self):
        """ Close the stream """

        pa.close(self._stream)

        self._is_running = False

        self._parent._remove_stream(self)
Exemple #3
0
 def close(self):
     if self._stream is not None:
         try:
             if not pa.is_stream_stopped(self._stream):
                 pa.stop_stream(self._stream)
         finally:
             pa.close(self._stream)
             self._stream = None
Exemple #4
0
stream_output = _portaudio.open(format = FORMAT,
                                channels = CHANNELS,
                                rate = RATE,
                                output = True,
                                frames_per_buffer = chunk)

print "* starting stream"
_portaudio.start_stream(stream_input)
_portaudio.start_stream(stream_output)

print "* recording"

for i in range(0, 44100 / chunk * RECORD_SECONDS):
    data = _portaudio.read_stream(stream_input, chunk)
    _portaudio.write_stream(stream_output, data, chunk)
    
print "* stopping stream"
_portaudio.stop_stream(stream_input)
_portaudio.stop_stream(stream_output)

print "* closing stream"
_portaudio.close(stream_input)
_portaudio.close(stream_output)

# match initialize() with terminate() calls
_portaudio.terminate()



Exemple #5
0
print "* initializing"
_portaudio.initialize()

print "* opening"
stream = _portaudio.open(format = FORMAT, 
                         channels = CHANNELS, 
                         rate = RATE, 
                         input = True,
                         output = True,
                         frames_per_buffer = chunk)

print "* starting stream"
_portaudio.start_stream(stream)

print "* recording"

for i in range(0, 44100 / chunk * RECORD_SECONDS):
    data = _portaudio.read_stream(stream, chunk)
    _portaudio.write_stream(stream, data, chunk)
    
print "* stopping stream"
_portaudio.stop_stream(stream)

print "* closing stream"
_portaudio.close(stream)

# match all initialize() with terminate() calls
_portaudio.terminate()