Callback for output stream to get audio data
(self, outdata, frames, time, status)
| 50 | self.audio_queue.put(indata_int16) |
| 51 | |
| 52 | def output_stream_callback(self, outdata, frames, time, status): |
| 53 | """Callback for output stream to get audio data""" |
| 54 | if status: |
| 55 | print(status) |
| 56 | |
| 57 | try: |
| 58 | data = self.output_queue.get_nowait() |
| 59 | data = data.astype(np.float32) / 32767.0 |
| 60 | if len(data) < len(outdata): |
| 61 | outdata[:len(data)] = data |
| 62 | outdata[len(data):] = 0 |
| 63 | else: |
| 64 | outdata[:] = data[:len(outdata)] |
| 65 | except queue.Empty: |
| 66 | outdata.fill(0) |
| 67 | |
| 68 | async def process_audio(self): |
| 69 | async with websockets.connect(self.server_url) as ws: |
nothing calls this directly
no outgoing calls
no test coverage detected