code: def _chunk_audio(ex, sample_rate, chunk_secs):
      """Pad audio and split into chunks."""
      beam.metrics.Metrics.counter(
          "prepare-tfrecord", "load-audio"
      ).inc()
  
      def get_chunks(audio, sample_rate):
          chunk_size = int(chunk_secs * sample_rate)
          return tf.signal.frame(
              audio, chunk_size, chunk_size, pad_end=True
          ).numpy()
  
      chunks = get_chunks(ex["audio"], sample_rate)
      chunks_16k = get_chunks(ex["audio_16k"], CREPE_SAMPLE_RATE)
      assert chunks.shape[0] == chunks_16k.shape[0]
      n_chunks = chunks.shape[0]
      for i in range(n_chunks):
          yield {"audio": chunks[i], "audio_16k": chunks_16k[i]}
  
file_path: ddsp/ddsp/training/data_preparation/prepare_tfrecord_lib.py
imports: from absl import logging
  import apache_beam
  from ddsp import spectral_ops
  import numpy
  import pydub
  import tensorflow.compat.v2
label_desc: Use image node_id 3 for calling a global function with example usage: _chunk_audio(ex, sample_rate, chunk_secs) and returns: tf