code: def _add_f0_estimate(ex, frame_rate, center, viterbi):
      """Add fundamental frequency (f0) estimate using CREPE."""
      beam.metrics.Metrics.counter(
          "prepare-tfrecord", "estimate-f0"
      ).inc()
      audio = ex["audio_16k"]
      padding = "center" if center else "same"
      f0_hz, f0_confidence = spectral_ops.compute_f0(
          audio, frame_rate, viterbi=viterbi, padding=padding
      )
      ex = dict(ex)
      ex.update(
          {
              "f0_hz": f0_hz.astype(np.float32),
              "f0_confidence": f0_confidence.astype(np.float32),
          }
      )
      return ex
  
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 4 for calling a global function with example usage: _add_f0_estimate(ex, frame_rate, center, viterbi) and returns: ex