[-] Don't show plot on default
This commit is contained in:
+5
-3
@@ -5,10 +5,11 @@ import numpy
|
|||||||
import parselmouth
|
import parselmouth
|
||||||
|
|
||||||
|
|
||||||
def calculate_freq_info(audio: parselmouth.Sound) -> numpy.ndarray:
|
def calculate_freq_info(audio: parselmouth.Sound, show_plot=False) -> numpy.ndarray:
|
||||||
"""
|
"""
|
||||||
Calculate pitch and frequency
|
Calculate pitch and frequency
|
||||||
|
|
||||||
|
:param show_plot: Show pyplot plot or not
|
||||||
:param audio: Sound input
|
:param audio: Sound input
|
||||||
:return: 2D Array (Each row is 1/100 of a second, row[0] is pitch (fundamental frequency), row[1:4] is formant)
|
:return: 2D Array (Each row is 1/100 of a second, row[0] is pitch (fundamental frequency), row[1:4] is formant)
|
||||||
"""
|
"""
|
||||||
@@ -23,8 +24,9 @@ def calculate_freq_info(audio: parselmouth.Sound) -> numpy.ndarray:
|
|||||||
for f in range(1, 4):
|
for f in range(1, 4):
|
||||||
result[i][f] = formant_values.get_value_at_time(f, i / 100) if pitch else None
|
result[i][f] = formant_values.get_value_at_time(f, i / 100) if pitch else None
|
||||||
|
|
||||||
plt.plot(result)
|
if show_plot:
|
||||||
plt.show()
|
plt.plot(result)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user