def __init__(self): self.CHUNK = 1024 self.pysoundio_object = pysoundio.PySoundIo(backend=None) self.params = "2,9,44100" self.buffer = queue.Queue(maxsize=CHUNK * 50) logging.info("Starting stream") self.pysoundio_object.start_input_stream( device_id=None, channels=2, sample_rate=44100, block_size=self.CHUNK, dtype=pysoundio.SoundIoFormatS16LE, read_callback=self.callback, )
def setUp(self): self.sio = pysoundio.PySoundIo( backend=pysoundio.SoundIoBackendDummy) self.sio.input['channels'] = 2 self.sio.input['sample_rate'] = 44100 self.sio.input['format'] = pysoundio.SoundIoFormatFloat32LE self.sio.input['block_size'] = None self.sio.output['channels'] = 2 self.sio.output['sample_rate'] = 44100 self.sio.output['format'] = pysoundio.SoundIoFormatFloat32LE self.sio.output['block_size'] = None self.sio.testing = True self.callback_called = False
def __init__(self, device_id: Optional[int] = None) -> None: import pysoundio self.responses: queue.Queue = queue.Queue() # This is typically a single utterance from TTS self.response: Optional[bytes] = None self.idx: int = 0 self.CHUNK: int = CHUNK self.pysoundio_object: pysoundio.PySoundIo = pysoundio.PySoundIo( backend=None) self.pysoundio_object.start_output_stream( device_id=device_id, channels=MONO, sample_rate=22000, block_size=CHUNK, dtype=pysoundio.SoundIoFormatS16LE, write_callback=self.callback, )
def __init__(self, device_id: Optional[int] = None) -> None: import pysoundio logging.debug("Initializing PySoundIo streamer") self.mute = False self.buffer: queue.Queue = queue.Queue(maxsize=CHUNK * 50) logging.info("Starting stream") # start recording self.pysoundio_object: pysoundio.PySoundIo = pysoundio.PySoundIo( backend=None) self.pysoundio_object.start_input_stream( device_id=device_id, channels=MONO, sample_rate=RATE, block_size=CHUNK, dtype=pysoundio.SoundIoFormatS16LE, read_callback=self.callback, ) logger_console.debug("Streamer initialized")
def setUp(self): self.sio = pysoundio.PySoundIo(backend=pysoundio.SoundIoBackendDummy) self.sio.input['channels'] = 2 self.sio.input['sample_rate'] = 44100 self.sio.input['format'] = pysoundio.SoundIoFormatFloat32LE self.sio.input['block_size'] = None self.sio.output['channels'] = 2 self.sio.output['sample_rate'] = 44100 self.sio.output['format'] = pysoundio.SoundIoFormatFloat32LE self.sio.output['block_size'] = None self.stream_kwargs = { 'device_id': 0, 'sample_rate': 44100, 'block_size': 128, 'dtype': pysoundio.SoundIoFormatFloat32LE, 'channels': 2, } self.to_read = False self.callback_called = False
def test_multiple_instances(self): self.sio2 = pysoundio.PySoundIo() self.sio2.close()
def setUp(self): self.sio = pysoundio.PySoundIo(backend=pysoundio.SoundIoBackendDummy) self.sio.testing = True self.callback_called = False