class_docstr: Log writer to write vdl records to log file.
  
  The class `LogWriter` provides APIs to create record file and add records to
  it. The class updates log file asynchronously without slowing down training.
class_docstr_tok: ["Log","writer","to","write","vdl","records","to","log","file",".","The","class","`","LogWriter","`","provides","APIs","to","create","record","file","and","add","records","to","it",".","The","class","updates","log","file","asynchronously","without","slowing","down","training","."]
docstr: Add an audio to vdl record file.
  
  Args:
      tag (string): Data identifier
      audio (np.ndarray or list): audio represented by a numpy.array
      step (int): Step of audio
      sample_rate (int): Sample rate of audio
      walltime (int): Wall time of audio
  
  Example:
      import wave
  
      CHUNK = 4096
      f = wave.open(audio_path, "rb")
      wavdata = []
      chunk = f.readframes(CHUNK)
      while chunk:
          data = np.frombuffer(chunk, dtype='uint8')
          wavdata.extend(data)
          chunk = f.readframes(CHUNK)
      audio_data = np.array(wavdata)
  
      writer.add_audio(tag="audio_test",
                       audio_array=audio_data,
                       step=0,
                       sample_rate=8000)
code: def add_audio(
      self, tag, audio_array, step, sample_rate=8000, walltime=None
  ):
      """Add an audio to vdl record file.
  
      Args:
          tag (string): Data identifier
          audio (np.ndarray or list): audio represented by a numpy.array
          step (int): Step of audio
          sample_rate (int): Sample rate of audio
          walltime (int): Wall time of audio
  
      Example:
          import wave
  
          CHUNK = 4096
          f = wave.open(audio_path, "rb")
          wavdata = []
          chunk = f.readframes(CHUNK)
          while chunk:
              data = np.frombuffer(chunk, dtype='uint8')
              wavdata.extend(data)
              chunk = f.readframes(CHUNK)
          audio_data = np.array(wavdata)
  
          writer.add_audio(tag="audio_test",
                           audio_array=audio_data,
                           step=0,
                           sample_rate=8000)
      """
      if "%" in tag:
          raise RuntimeError("% can't appear in tag!")
      walltime = (
          round(time.time() * 1000) if walltime is None else walltime
      )
      if isinstance(audio_array, list):
          audio_array = np.array(audio_array)
      self._get_file_writer().add_record(
          audio(
              tag=tag,
              audio_array=audio_array,
              sample_rate=sample_rate,
              step=step,
              walltime=walltime,
          )
      )
  
imports: import os
  import time
  import numpy
  from visualdl.component.base_component import audio
  from visualdl.component.base_component import embedding
  from visualdl.component.base_component import histogram
  from visualdl.component.base_component import hparam
  from visualdl.component.base_component import image
  from visualdl.component.base_component import meta_data
  from visualdl.component.base_component import pr_curve
  from visualdl.component.base_component import roc_curve
  from visualdl.component.base_component import scalar
  from visualdl.component.base_component import scalars
  from visualdl.component.base_component import text
  from visualdl.component.graph import translate_graph
  from visualdl.io import bfile
  from visualdl.server.log import logger
  from visualdl.utils.figure_util import figure_to_image
  from visualdl.utils.img_util import merge_images
  from visualdl.utils.md5_util import md5
  from visualdl.writer.record_writer import RecordFileWriter
label_desc: Use image node_id 13 for calling the LogWriter obj's underlying member method code with example usage: obj.add_audio(tag, audio_array, step, sample_rate, walltime) without return types