예제 #1
0
파일: pyaudio.py 프로젝트: chai41104/NLP
    def close(self):
        """ Close the stream """

        pa.close(self._stream)

        self._is_running = False

        self._parent._remove_stream(self)
예제 #2
0
파일: pyaudio.py 프로젝트: endolith/PyAudio
    def close(self):
        """ Close the stream """

        pa.close(self._stream)

        self._is_running = False

        self._parent._remove_stream(self)
예제 #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
예제 #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()



예제 #5
0
파일: wire.py 프로젝트: b2220333/PyAudio-1
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()