class_docstr: A class to record audio in a streaming basis.
class_docstr_tok: ["A","class","to","record","audio","in","a","streaming","basis","."]
docstr: Reads the latest audio data captured in the buffer.
  
  Args:
    size: Number of samples to read from the buffer.
  
  Returns:
    A NumPy array containing the audio data.
  
  Raises:
    ValueError: Raised if `size` is larger than the buffer size.
docstr_tok: ["Reads","the","latest","audio","data","captured","in","the","buffer",".","Args",":","size",":","Number","of","samples","to","read","from","the","buffer",".","Returns",":","A","NumPy","array","containing","the","audio","data",".","Raises",":","ValueError",":","Raised","if","`","size","`","is","larger","than","the","buffer","size","."]
code: def read(self, size: int) -> np.ndarray:
      """Reads the latest audio data captured in the buffer.
  
      Args:
        size: Number of samples to read from the buffer.
  
      Returns:
        A NumPy array containing the audio data.
  
      Raises:
        ValueError: Raised if `size` is larger than the buffer size.
      """
      if size > self._buffer_size:
          raise ValueError(
              "Cannot read more samples than the size of the buffer."
          )
      elif size <= 0:
          raise ValueError("Size must be positive.")
  
      start_index = self._buffer_size - size
      return np.copy(self._buffer[start_index:])
  
file_path: mediapipe/mediapipe/tasks/python/audio/core/audio_record.py
imports: import threading
  import numpy
label_desc: Use image node_id 7 for calling the AudioRecord obj's underlying member method code with example usage: obj.read(size) and returns: np