code: def setUp(self):
      self.log_dir = tempfile.mkdtemp()
  
      # We use numpy.random to generate audio. We seed to avoid non-determinism
      # in this test.
      numpy.random.seed(42)
  
      # Create old-style audio summaries for run "foo".
      tf.compat.v1.reset_default_graph()
      with tf.compat.v1.Graph().as_default():
          sess = tf.compat.v1.Session()
          placeholder = tf.compat.v1.placeholder(tf.float32)
          tf.compat.v1.summary.audio(
              name="baz", tensor=placeholder, sample_rate=44100
          )
          merged_summary_op = tf.compat.v1.summary.merge_all()
          foo_directory = os.path.join(self.log_dir, "foo")
          with test_util.FileWriterCache.get(foo_directory) as writer:
              writer.add_graph(sess.graph)
              for step in range(2):
                  # The floats (sample data) range from -1 to 1.
                  writer.add_summary(
                      sess.run(
                          merged_summary_op,
                          feed_dict={
                              placeholder: numpy.random.rand(42, 22050)
                              * 2
                              - 1
                          },
                      ),
                      global_step=step,
                  )
  
      # Create new-style audio summaries for run "bar".
      tf.compat.v1.reset_default_graph()
      with tf.compat.v1.Graph().as_default():
          sess = tf.compat.v1.Session()
          audio_placeholder = tf.compat.v1.placeholder(tf.float32)
          labels_placeholder = tf.compat.v1.placeholder(tf.string)
          summary.op(
              "quux",
              audio_placeholder,
              sample_rate=44100,
              labels=labels_placeholder,
              description="how do you pronounce that, anyway?",
          )
          merged_summary_op = tf.compat.v1.summary.merge_all()
          bar_directory = os.path.join(self.log_dir, "bar")
          with test_util.FileWriterCache.get(bar_directory) as writer:
              writer.add_graph(sess.graph)
              for step in range(2):
                  # The floats (sample data) range from -1 to 1.
                  writer.add_summary(
                      sess.run(
                          merged_summary_op,
                          feed_dict={
                              audio_placeholder: numpy.random.rand(
                                  42, 11025, 1
                              )
                              * 2
                              - 1,
                              labels_placeholder: [
                                  tf.compat.as_bytes(
                                      "step **%s**, sample %s"
                                      % (step, sample)
                                  )
                                  for sample in range(42)
                              ],
                          },
                      ),
                      global_step=step,
                  )
  
      # Start a server with the plugin.
      multiplexer = event_multiplexer.EventMultiplexer(
          {
              "foo": foo_directory,
              "bar": bar_directory,
          }
      )
      multiplexer.Reload()
      provider = data_provider.MultiplexerDataProvider(
          multiplexer, self.log_dir
      )
      context = base_plugin.TBContext(
          logdir=self.log_dir, data_provider=provider
      )
      self.plugin = audio_plugin.AudioPlugin(context)
      wsgi_app = application.TensorBoardWSGI([self.plugin])
      self.server = werkzeug_test.Client(wsgi_app, wrappers.Response)
  
imports: import collections.abc
  import json
  import os
  import shutil
  import tempfile
  import urllib.parse
  import numpy
  import tensorflow
  from werkzeug import test
  from werkzeug import wrappers
  from tensorboard.backend import application
  from tensorboard.backend.event_processing import plugin_event_multiplexer
  from tensorboard.backend.event_processing import data_provider
  from tensorboard.plugins import base_plugin
  from tensorboard.plugins.audio import audio_plugin
  from tensorboard.plugins.audio import summary
  from tensorboard.util import test_util
label_desc: Use image node_id 1 for calling the AudioPluginTest obj's underlying member method code with example usage: obj.setUp() without return types