code: def WriteAudioSeries(writer, tag, n_audio=1):
      """Write a few dummy audio clips to writer."""
      step = 0
      session = tf.compat.v1.Session()
  
      min_frequency_hz = 440
      max_frequency_hz = 880
      sample_rate = 4000
      duration_frames = sample_rate // 2  # 0.5 seconds.
      frequencies_per_run = 1
      num_channels = 2
  
      p = tf.compat.v1.placeholder(
          "float32",
          (frequencies_per_run, duration_frames, num_channels),
      )
      s = tf.compat.v1.summary.audio(tag, p, sample_rate)
  
      for _ in range(n_audio):
          # Generate a different frequency for each channel to show stereo works.
          frequencies = np.random.random_integers(
              min_frequency_hz,
              max_frequency_hz,
              size=(frequencies_per_run, num_channels),
          )
          tiled_frequencies = np.tile(frequencies, (1, duration_frames))
          tiled_increments = np.tile(
              np.arange(0, duration_frames), (num_channels, 1)
          ).T.reshape(1, duration_frames * num_channels)
          tones = np.sin(
              2.0
              * np.pi
              * tiled_frequencies
              * tiled_increments
              / sample_rate
          )
          tones = tones.reshape(
              frequencies_per_run, duration_frames, num_channels
          )
  
          summ = session.run(s, feed_dict={p: tones})
          writer.add_summary(summ, step)
          step += 20
      session.close()
  
file_path: tensorboard/tensorboard/scripts/generate_testdata.py
imports: import bisect
  import math
  import os
  import os.path
  import random
  import shutil
  from absl import app
  from absl import flags
  import numpy
  import tensorflow
label_desc: Use image node_id 6 for calling a global function with example usage: WriteAudioSeries(writer, tag, n_audio) without return types