code: def _add_loudness(ex, frame_rate, n_fft, center):
      """Add loudness in dB."""
      beam.metrics.Metrics.counter(
          "prepare-tfrecord", "compute-loudness"
      ).inc()
      audio = ex["audio_16k"]
      padding = "center" if center else "same"
      loudness_db = spectral_ops.compute_loudness(
          audio, CREPE_SAMPLE_RATE, frame_rate, n_fft, padding=padding
      )
      ex = dict(ex)
      ex["loudness_db"] = loudness_db.numpy().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 5 for calling a global function with example usage: _add_loudness(ex, frame_rate, n_fft, center) and returns: ex