code: def run(self):
  		
  		if not hasattr(self, 'queue'):
  			raise RuntimeError("Audio queue is not intialized.")
  
  		self.stream.start_stream()
  		self.keep_listening = True	
  		
  		while self.keep_listening:
  			try:
  				frame = self.queue.get(False, timeout=queue_timeout)
  				self.stream.write(frame)
  			except Empty:
  				continue
  			time.sleep(0.01)
  
  		self.stream.stop_stream()
  		self.stream.close()
  		self.pa.terminate()
docs: Initializes the stream.