def sineFreqScaling(sfreq, freqScaling):
 if ((freqScaling.size % 2) != 0):
  raise ValueError('Frequency scaling array does not have an even size')
 L = sfreq.shape[0]
 freqScalingEnv = np.interp(np.arange(L), ((L * freqScaling[::2]) / freqScaling[(-2)]), freqScaling[1::2])
 ysfreq = np.zeros_like(sfreq)
 for l in range(L):
  ind_valid = np.where((sfreq[l, :] != 0))[0]
  if (ind_valid.size == 0):
   continue
  ysfreq[(l, ind_valid)] = (sfreq[(l, ind_valid)] * freqScalingEnv[l])
 return ysfreq

def sineFreqScaling ( sfreq , freqScaling ) : if ( ( freqScaling . size % 2 ) != 0 ) : raise ValueError ( 'Frequency scaling array does not have an even size' ) L = sfreq . shape [ 0 ] freqScalingEnv = np . interp ( np . arange ( L ) , ( ( L * freqScaling [ : : 2 ] ) / freqScaling [ ( - 2 ) ] ) , freqScaling [ 1 : : 2 ] ) ysfreq = np . zeros_like ( sfreq ) for l in range ( L ) : ind_valid = np . where ( ( sfreq [ l , : ] != 0 ) ) [ 0 ] if ( ind_valid . size == 0 ) : continue ysfreq [ ( l , ind_valid ) ] = ( sfreq [ ( l , ind_valid ) ] * freqScalingEnv [ l ] ) return ysfreq
frequency scaling of sinusoidal tracks sfreq: frequencies of input sinusoidal tracks freqscaling: scaling factors .