This is called for each audio block
(self, indata, frames, time, status)
| 39 | print(response.json()['message']) |
| 40 | |
| 41 | def audio_callback(self, indata, frames, time, status): |
| 42 | """This is called for each audio block""" |
| 43 | if status: |
| 44 | print(status) |
| 45 | # if np.isclose(indata, 0).all(): |
| 46 | # raise Exception('Audio input is not working - received all zeros') |
| 47 | # Convert float32 to int16 for efficient transmission |
| 48 | indata_int16 = (indata.copy() * 32767).astype(np.int16) |
| 49 | # indata_int16 = np.zeros_like(indata_int16) |
| 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""" |
nothing calls this directly
no outgoing calls
no test coverage detected