title: I am developing a program that detects faces and distances and i want to play audio info of the distance at the same time
body: <p>I have an object detection code, in which i calculate the distance from the face to the camera ? What functions can I use and how to play an audio that says every 2-3 seconds the distance? Thank you
  below is the code</p>
  <pre><code>import cv2
  
  import cvzone
  
  from cvzone.FaceMeshModule import FaceMeshDetector
  
  import os
  
  class Face:
      window_name = &quot;Detected Objects in webcam&quot;
      video = cv2.VideoCapture(0)
  
  while video.isOpened():
      ret, frame = video.read()
      detector = FaceMeshDetector(maxFaces=3)
      img, faces = detector.findFaceMesh(frame, draw=False)
  
      if not ret:
          break
  
      image = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      cascade_classifier = cv2.CascadeClassifier(
          f&quot;{cv2.data.haarcascades}haarcascade_frontalface_default.xml&quot;)
      detected_objects = cascade_classifier.detectMultiScale(
          image, minSize=(20, 20))
  
      if len(detected_objects) != 0:
          for (x, y, height, width) in detected_objects:
              cv2.rectangle(
                  frame, (x, y), ((x + height), (y + width)), (0, 255, 0), 5
              )
  
      for face in faces:
          r_point = face[374]
          l_point = face[145]
          point_width, _ = detector.findDistance(l_point, r_point)
          width = 6.3
  
          distance = (width * 600) / point_width
          # text_to_speech(math.floor(distance))
          dis = str(distance)
          cvzone.putTextRect(
              frame, f&quot;Depth:{distance:.2f} cm&quot;, (face[10][0]-95, face[10][1]-5), scale=1.8
          )
  
      cv2.imshow(window_name, frame)
      key = cv2.waitKey(1) &amp; 0xFF
      if key == ord(&quot;q&quot;):
          break
  
  cv2.destroyAllWindows()
  </code></pre>