code: def compute_f0(audio, frame_rate, viterbi=True, padding="center"):
      """Fundamental frequency (f0) estimate using CREPE.
  
      This function is non-differentiable and takes input as a numpy array.
      Args:
        audio: Numpy ndarray of single audio (16kHz) example. Shape [audio_length,].
        frame_rate: Rate of f0 frames in Hz.
        viterbi: Use Viterbi decoding to estimate f0.
        padding: Apply zero-padding for centered frames.
          'same', 'valid', or 'center'.
  
      Returns:
        f0_hz: Fundamental frequency in Hz. Shape [n_frames,].
        f0_confidence: Confidence in Hz estimate (scaled [0, 1]). Shape [n_frames,].
      """
      sample_rate = CREPE_SAMPLE_RATE
      crepe_step_size = 1000 / frame_rate  # milliseconds
      hop_size = sample_rate // frame_rate
  
      audio = pad(audio, CREPE_FRAME_SIZE, hop_size, padding)
      audio = np.asarray(audio)
  
      # Compute f0 with crepe.
      _, f0_hz, f0_confidence, _ = crepe.predict(
          audio,
          sr=sample_rate,
          viterbi=viterbi,
          step_size=crepe_step_size,
          center=False,
          verbose=0,
      )
  
      # Postprocessing.
      f0_hz = f0_hz.astype(np.float32)
      f0_confidence = f0_confidence.astype(np.float32)
      f0_confidence = np.nan_to_num(
          f0_confidence
      )  # Set nans to 0 in confidence
  
      return f0_hz, f0_confidence
  
imports: import crepe
  from ddsp import core
  from ddsp.core import safe_log
  from ddsp.core import tf_float32
  import gin
  import librosa
  import numpy
  import tensorflow.compat.v2
  import tensorflow_probability
label_desc: Use image node_id 13 for calling a global function with example usage: compute_f0(audio, frame_rate, viterbi, padding) and returns: f0_hz,  f0_confidence