Home > other >  Python cross-border problems consult
Python cross-border problems consult

Time:10-01

I wrote a code, reference online for py not familiar with, want to ask here at feats/m - 1, k=(k - bin] [m - 1)/(bin [m] - bin] [m - 1), how should solve? Thank you,

Def fbank (spectrum, num_filter=num_filter) :
Feats=np. Zeros ((int (fft_len/2 + 1), num_filter))
Low_freq_mel=0

High_freq_mel=(2595 * np. Log10 (1 + (fs/2)/700))
Mel_points=np. Linspace (low_freq_mel high_freq_mel, num_filter + 2)
Hz_points=700 * * * (mel_points/2595) - (10 1)
Bin=np. Floor ((512 + 1) * hz_points/fs)

Print (num_filter)
Print ("==========Begin Loop===========")
The for m in range (1, num_filter) :
Print (m)
F_m_minus=int (bin] [m - 1) # left
F_m=int (bin) [m] # center
F_m_plus=int (bin [m] + 1) # right
Print ("===========Begin first internal loop===========")
For k in range (f_m_minus f_m) :
Print (k)
Feats [m - 1, k)=(k - bin] [m - 1)/(bin [m] - bin] [m - 1)

Print ("===========the Begin the second internal loop===========")
For k in range (f_m, f_m_plus) :
Print (k)
Feats [m - 1, k)=(bin [m + 1] - k)/(bin - bin [m + 1] [m])

Filter_banks=np. Dot (spectrum, feats. T)
Filter_banks=np. The where (filter_banks==0, np. Finfo (float). Eps, filter_banks)
Filter_banks=20 * np. Log10 (filter_banks)

Return feats

CodePudding user response:

Please attach the complete code, as well as the error problem,
  • Related