code: def audio_summary(tag, audio, sample_rate=44100):
      """Outputs a `Summary` protocol buffer with audio data.
  
      Parameters
      ----------
          tag : str
              A name for the generated summary. Will also serve as a series name in TensorBoard.
          audio : MXNet `NDArray` or `numpy.ndarray`
              Audio data that can be squeezed into 1D array. The values are in the range [-1, 1].
          sample_rate : int
              Sampling frequency. 44,100Hz is a common sampling frequency.
  
      Returns
      -------
          A `Summary` protobuf of the audio data.
      """
      audio = audio.squeeze()
      if audio.ndim != 1:
          raise ValueError(
              "input audio must be squeezable to 1D, input audio squeezed "
              "shape is {}".format(audio.shape)
          )
      audio = _make_numpy_array(audio)
      tensor_list = [int(32767.0 * x) for x in audio]
      fio = io.BytesIO()
      wave_writer = wave.open(fio, "wb")
      wave_writer.setnchannels(1)
      wave_writer.setsampwidth(2)
      wave_writer.setframerate(sample_rate)
      tensor_enc = b""
      for v in tensor_list:  # pylint: disable=invalid-name
          tensor_enc += struct.pack("<h", v)
      wave_writer.writeframes(tensor_enc)
      wave_writer.close()
      audio_string = fio.getvalue()
      fio.close()
      audio = Summary.Audio(
          sample_rate=sample_rate,
          num_channels=1,
          length_frames=len(tensor_list),
          encoded_audio_string=audio_string,
          content_type="audio/wav",
      )
      return Summary(value=[Summary.Value(tag=tag, audio=audio)])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import io
  import wave
  import struct
  import json
  import re
  import numpy
  from mxnet.ndarray import NDArray
  from mxnet.symbol import Symbol
  from mxnet.gluon import HybridBlock
  from .proto.summary_pb2 import Summary
  from .proto.summary_pb2 import HistogramProto
  from .proto.summary_pb2 import SummaryMetadata
  from .proto.tensor_pb2 import TensorProto
  from .proto.tensor_shape_pb2 import TensorShapeProto
  from .proto.plugin_pr_curve_pb2 import PrCurvePluginData
  from .proto.node_def_pb2 import NodeDef
  from .proto.graph_pb2 import GraphDef
  from .proto.attr_value_pb2 import AttrValue
  from .proto.versions_pb2 import VersionDef
  from .utils import _make_numpy_array, _prepare_image
label_desc: Use image node_id 7 for calling a global function with example usage: audio_summary(tag, audio, sample_rate) and returns: Summary