def stChromaFeaturesInit(nfft, fs):
 freqs = numpy.array([(((f + 1) * fs) / (2 * nfft)) for f in range(nfft)])
 Cp = 27.5
 nChroma = numpy.round((12.0 * numpy.log2((freqs / Cp)))).astype(int)
 nFreqsPerChroma = numpy.zeros((nChroma.shape[0],))
 uChroma = numpy.unique(nChroma)
 for u in uChroma:
  idx = numpy.nonzero((nChroma == u))
  nFreqsPerChroma[idx] = idx[0].shape
 return (nChroma, nFreqsPerChroma)

def stChromaFeaturesInit ( nfft , fs ) : freqs = numpy . array ( [ ( ( ( f + 1 ) * fs ) / ( 2 * nfft ) ) for f in range ( nfft ) ] ) Cp = 27.5 nChroma = numpy . round ( ( 12.0 * numpy . log2 ( ( freqs / Cp ) ) ) ) . astype ( int ) nFreqsPerChroma = numpy . zeros ( ( nChroma . shape [ 0 ] , ) ) uChroma = numpy . unique ( nChroma ) for u in uChroma : idx = numpy . nonzero ( ( nChroma == u ) ) nFreqsPerChroma [ idx ] = idx [ 0 ] . shape return ( nChroma , nFreqsPerChroma )
this function initializes the chroma matrices used in the calculation of the chroma features .