MCPcopy Create free account
hub / github.com/Standard-Intelligence/hertz-dev / output_stream_callback

Method output_stream_callback

inference_client.py:52–66  ·  view source on GitHub ↗

Callback for output stream to get audio data

(self, outdata, frames, time, status)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected