code: def detect_notes(
      loudness_db,
      f0_confidence,
      note_threshold=1.0,
      exponent=2.0,
      smoothing=40,
      f0_confidence_threshold=0.7,
      min_db=-spectral_ops.DB_RANGE,
  ):
      """Detect note on-off using loudness and smoothed f0_confidence."""
      mean_db = np.mean(loudness_db)
      db = smooth(f0_confidence**exponent, smoothing) * (
          loudness_db - min_db
      )
      db_threshold = (
          mean_db - min_db
      ) * f0_confidence_threshold**exponent
      note_on_ratio = db / db_threshold
      mask_on = note_on_ratio >= note_threshold
      return mask_on, note_on_ratio
  
file_path: ddsp/ddsp/training/postprocessing.py
imports: from ddsp import spectral_ops
  from ddsp.core import hz_to_midi
  import numpy
  from scipy import stats
  import tensorflow.compat.v2
label_desc: Use image node_id 1 for calling a global function with example usage: detect_notes(loudness_db, f0_confidence, note_threshold, exponent, smoothing, f0_confidence_threshold, min_db) and returns: mask_on,  note_on_ratio