mirror of
https://github.com/hykilpikonna/SpeechGenderAnalysis.git
synced 2026-04-26 01:02:56 -05:00
[-] Don't show plot on default
This commit is contained in:
parent
a7cbd2c7a7
commit
c9b3259e83
|
|
@ -5,10 +5,11 @@ import numpy
|
|||
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
|
||||
|
||||
:param show_plot: Show pyplot plot or not
|
||||
: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)
|
||||
"""
|
||||
|
|
@ -23,8 +24,9 @@ def calculate_freq_info(audio: parselmouth.Sound) -> numpy.ndarray:
|
|||
for f in range(1, 4):
|
||||
result[i][f] = formant_values.get_value_at_time(f, i / 100) if pitch else None
|
||||
|
||||
plt.plot(result)
|
||||
plt.show()
|
||||
if show_plot:
|
||||
plt.plot(result)
|
||||
plt.show()
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user