Callback function for the audio stream. Don't use directly.

def get_frame(self, outdata, frames, timedata, status):
		""" Callback function for the audio stream. Don't use directly. """

		if not self.keep_listening:
			raise sd.CallbackStop
		
		try:
			chunk = self.queue.get_nowait()
			# Check if the chunk contains the expected number of frames
			# The callback function raises a ValueError otherwise.
			if chunk.shape[0] == frames:
				outdata[:] = chunk
			else:
				outdata.fill(0)
		except Empty:
			outdata.fill(0)