code: def test_prepare_tfrecord(self, chunk_secs, example_secs):
      sample_rate = 16000
      frame_rate = 250
      hop_secs = 0.1
  
      # Calculate expected batch size.
      if example_secs:
          length = chunk_secs if chunk_secs else self.wav_secs
          n_per_chunk = self.get_n_per_chunk(
              length, example_secs, hop_secs
          )
      else:
          n_per_chunk = 1
  
      n_chunks = (
          int(np.ceil(self.wav_secs / chunk_secs)) if chunk_secs else 1
      )
      expected_n_batch = n_per_chunk * n_chunks
      print(
          "n_chunks, n_per_chunk, chunk_secs, example_secs",
          n_chunks,
          n_per_chunk,
          chunk_secs,
          example_secs,
      )
  
      # Calculate expected lengths.
      if example_secs:
          length = example_secs
      elif chunk_secs:
          length = chunk_secs
      else:
          length = self.wav_secs
  
      expected_n_t = int(length * sample_rate)
      expected_n_frames = self.get_expected_length(
          expected_n_t, frame_rate
      )
  
      # Make the actual records.
      prepare_tfrecord_lib.prepare_tfrecord(
          [self.wav_path],
          os.path.join(self.test_dir, "output.tfrecord"),
          num_shards=2,
          sample_rate=sample_rate,
          frame_rate=frame_rate,
          example_secs=example_secs,
          hop_secs=hop_secs,
          chunk_secs=chunk_secs,
          center=False,
      )
  
      self.validate_outputs(
          expected_n_batch,
          {
              "audio": expected_n_t,
              "audio_16k": expected_n_t,
              "f0_hz": expected_n_frames,
              "f0_confidence": expected_n_frames,
              "loudness_db": expected_n_frames,
          },
      )
  
imports: import os
  import sys
  from absl import flags
  from absl.testing import absltest
  from absl.testing import parameterized
  from ddsp import spectral_ops
  from ddsp.training.data_preparation import prepare_tfrecord_lib
  import numpy
  import scipy.io.wavfile
  import tensorflow.compat.v2
label_desc: Use image node_id 7 for calling the PrepareTFRecordBeamTest obj's underlying member method code with example usage: obj.test_prepare_tfrecord(chunk_secs, example_secs) without return types