code: def audio(self, tag, audiodata, step=None, sample_rate=44100):
      
      audiodata = onp.array(audiodata)
      if step is None:
        step = self._step
      else:
        self._step = step
      audiodata = onp.clip(onp.squeeze(audiodata), -1, 1)
      if audiodata.ndim != 1:
        raise ValueError('Audio data must be 1D.')
      sample_list = (32767.0 * audiodata).astype(int).tolist()
      wio = io.BytesIO()
      wav_buf = wave.open(wio, 'wb')
      wav_buf.setnchannels(1)
      wav_buf.setsampwidth(2)
      wav_buf.setframerate(sample_rate)
      enc = b''.join([struct.pack('<h', v) for v in sample_list])
      wav_buf.writeframes(enc)
      wav_buf.close()
      encoded_audio_bytes = wio.getvalue()
      wio.close()
      audio = Summary.Audio(
          sample_rate=sample_rate,
          num_channels=1,
          length_frames=len(sample_list),
          encoded_audio_string=encoded_audio_bytes,
          content_type='audio/wav')
      summary = Summary(value=[Summary.Value(tag=tag, audio=audio)])
      self.add_summary(summary, step)
docs: Saves audio.
  
      NB: single channel only right now.
  
      Args:
        tag: str: label for this data
        audiodata: ndarray [Nsamples,]: data between (-1.0,1.0) to save as wave
        step: int: training step
        sample_rate: sample rate of passed in audio buffer