code: def strided_freq_change(
      controls, frame_widths=(2, 4, 8, 16, 32), pad_mode="front"
  ):
      """Finds changes in f0 of >= 1 semitone across multiple strides."""
      f0 = np.squeeze(controls["f0_hz"].numpy())
      f0_midi = ddsp.core.hz_to_midi(f0)
      transitions = np.ones(len(f0), dtype=bool)
      for frame_width in frame_widths:
          padded_f0 = pad_for_frame(
              f0_midi, mode=pad_mode, frame_width=frame_width, axis=0
          )
          frames = tf.signal.frame(padded_f0, frame_width, 1)
          semitone_changes = (
              np.abs(frames[..., 0] - frames[..., -1]) > 0.75
          )
  
          # only flip if other strides didn't find this transition
          padded_transitions = pad_for_frame(
              transitions,
              mode=pad_mode,
              frame_width=frame_width,
              axis=0,
          )
          prev_transitions = tf.signal.frame(
              padded_transitions, frame_width, 1, axis=-1
          )
          boundary_indexer = np.argwhere(
              np.all(prev_transitions, axis=-1) & semitone_changes
          )
          transitions[boundary_indexer] = False
  
      return transitions & (f0 > 0)
  
file_path: ddsp/ddsp/training/heuristics.py
imports: import ddsp
  import gin
  import note_seq
  import numpy
  import tensorflow.compat.v2
label_desc: Use image node_id 12 for calling a global function with example usage: strided_freq_change(controls, frame_widths, pad_mode) and returns: unknown