[-] Remove formant manual calculation code
This commit is contained in:
@@ -32,48 +32,5 @@ def calculate_freq_info(audio: parselmouth.Sound, show_plot=False) -> numpy.ndar
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# sound = parselmouth.Sound.read('../test.wav')
|
||||
print(calculate_freq_info(parselmouth.Sound('D:/Downloads/Vowels-Extract-Z-44kHz.flac')))
|
||||
print(calculate_freq_info(parselmouth.Sound('D:/Downloads/Vowels-Azalea.flac')))
|
||||
# spf = wave.open('../test.wav', 'r')
|
||||
# x = spf.readframes(-1)
|
||||
# # Get file as numpy array.
|
||||
# x = numpy.fromstring(x, dtype=numpy.int16)
|
||||
# # Get Hamming window.
|
||||
# N = len(x)
|
||||
# w = numpy.hamming(N)
|
||||
# print(w)
|
||||
# # Apply window and high pass filter.
|
||||
# x1 = x * w
|
||||
# x1 = lfilter([1., -0.63], 1, x1)
|
||||
# Fs = spf.getframerate()
|
||||
# ncoeff = 2 + Fs // 1000
|
||||
# # Get LPC.
|
||||
# A = lpc(x1, ncoeff, -1)
|
||||
#
|
||||
# # Get roots.
|
||||
# rts = numpy.roots(A)
|
||||
# rts = [r for r in rts if numpy.imag(r) >= 0]
|
||||
#
|
||||
# # Get angles.
|
||||
# angz = numpy.arctan2(numpy.imag(rts), numpy.real(rts))
|
||||
#
|
||||
# # Get frequencies.
|
||||
# Fs = spf.getframerate()
|
||||
# frqs = sorted(angz * (Fs / (2 * math.pi)))
|
||||
# pitch_values = parselmouth.Sound('../test.wav').to_pitch(0.01).selected_array['frequency']
|
||||
# print(len(pitch_values))
|
||||
# print(N)
|
||||
# print(frqs)
|
||||
# formant_values = parselmouth.Sound('../test.wav').to_formant_burg(0.01)
|
||||
# #formant_values = parselmouth.Formant.get_value_at_time(formant_values,2,1.0)
|
||||
# formant=[]
|
||||
# for i in range (len(pitch_values)):
|
||||
# formant.append([parselmouth.Formant.get_value_at_time(formant_values,k, i/100) for k in range(1, 5)])
|
||||
# print(formant)
|
||||
# print(parselmouth.Formant.get_value_at_time(formant_values,1,4.1))
|
||||
# print(parselmouth.Formant.get_value_at_time(formant_values,2,4.1))
|
||||
# print(parselmouth.Formant.get_value_at_time(formant_values,3,4.1))
|
||||
# print(parselmouth.Formant.get_value_at_time(formant_values,4,4.1))
|
||||
# print(parselmouth.Formant.get_value_at_time(formant_values,5,4.1))
|
||||
# print(len(formant))
|
||||
|
||||
Reference in New Issue
Block a user