code: def _split_example(
      ex, sample_rate, frame_rate, example_secs, hop_secs, center
  ):
      """Splits example into windows, padding final window if needed."""
  
      def get_windows(sequence, rate, center):
          window_size = int(example_secs * rate)
          if center:
              window_size += 1
          hop_size = int(hop_secs * rate)
          # Don't pad the end.
          n_windows = (
              int(np.floor((len(sequence) - window_size) / hop_size))
              + 1
          )
          for i in range(n_windows):
              start = i * hop_size
              end = start + window_size
              yield sequence[start:end]
  
      for audio, audio_16k, loudness_db, f0_hz, f0_confidence in zip(
          get_windows(ex["audio"], sample_rate, center=False),
          get_windows(ex["audio_16k"], CREPE_SAMPLE_RATE, center=False),
          get_windows(ex["loudness_db"], frame_rate, center),
          get_windows(ex["f0_hz"], frame_rate, center),
          get_windows(ex["f0_confidence"], frame_rate, center),
      ):
          beam.metrics.Metrics.counter(
              "prepare-tfrecord", "split-example"
          ).inc()
          yield {
              "audio": audio,
              "audio_16k": audio_16k,
              "loudness_db": loudness_db,
              "f0_hz": f0_hz,
              "f0_confidence": f0_confidence,
          }
  
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 6 for calling a global function with example usage: _split_example(ex, sample_rate, frame_rate, example_secs, hop_secs, center) without return types