def setUp(self): self.p = outport.PyAudio() (self.loopback_input_idx, self.loopback_output_idx) = self.get_audio_loopback() assert (self.loopback_input_idx is None or self.loopback_input_idx >= 0), "No loopback device found" assert (self.loopback_output_idx is None or self.loopback_output_idx >= 0), "No loopback device found"
""" from __future__ import division import outport import sys CHUNK = 1024 WIDTH = 2 CHANNELS = 2 RATE = 44100 RECORD_SECONDS = 5 if sys.platform == 'darwin': CHANNELS = 1 p = outport.PyAudio() stream = p.open(format=p.get_format_from_width(WIDTH), channels=CHANNELS, rate=RATE, input=True, output=True, frames_per_buffer=CHUNK) print("* recording") for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)): data = stream.read(CHUNK) stream.write(data, CHUNK) print("* done")
def setUp(self): self.p = outport.PyAudio()