code: def harmonic(frame, sampling_rate):
      """
      Computes harmonic ratio and pitch
      """
      m = np.round(0.016 * sampling_rate) - 1
      r = np.correlate(frame, frame, mode="full")
  
      g = r[len(frame) - 1]
      r = r[len(frame) : -1]
  
      # estimate m0 (as the first zero crossing of R)
      [
          a,
      ] = np.nonzero(np.diff(np.sign(r)))
  
      if len(a) == 0:
          m0 = len(r) - 1
      else:
          m0 = a[0]
      if m > len(r):
          m = len(r) - 1
  
      gamma = np.zeros((m), dtype=np.float64)
      cumulative_sum = np.cumsum(frame**2)
      gamma[m0:m] = r[m0:m] / (
          np.sqrt((g * cumulative_sum[m:m0:-1])) + eps
      )
  
      zcr = zero_crossing_rate(gamma)
  
      if zcr > 0.15:
          hr = 0.0
          f0 = 0.0
      else:
          if len(gamma) == 0:
              hr = 1.0
              blag = 0.0
              gamma = np.zeros((m), dtype=np.float64)
          else:
              hr = np.max(gamma)
              blag = np.argmax(gamma)
  
          # Get fundamental frequency:
          f0 = sampling_rate / (blag + eps)
          if f0 > 5000:
              f0 = 0.0
          if hr < 0.1:
              f0 = 0.0
  
      return hr, f0
  
imports: from __future__ import print_function
  import math
  import numpy
  import sys
  from scipy.fftpack import fft
  import matplotlib.pyplot
  from scipy.signal import lfilter
  from scipy.fftpack.realtransforms import dct
  from tqdm import tqdm
label_desc: Use image node_id 9 for calling a global function with example usage: harmonic(frame, sampling_rate) and returns: hr,  f0