[+] Configurable time_step
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import sgs.api
|
import sgs.api
|
||||||
import sgs.calculations
|
import sgs.calculations
|
||||||
|
|
||||||
__version__ = '1.0.4'
|
__version__ = '1.0.5'
|
||||||
|
|||||||
+4
-2
@@ -7,6 +7,8 @@ import numpy
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import parselmouth
|
import parselmouth
|
||||||
|
|
||||||
|
from sgs.config import sgs_config
|
||||||
|
|
||||||
|
|
||||||
def calculate_tilt(sound: parselmouth.Sound) -> float | None:
|
def calculate_tilt(sound: parselmouth.Sound) -> float | None:
|
||||||
"""
|
"""
|
||||||
@@ -79,8 +81,8 @@ def calculate_freq_info(audio: parselmouth.Sound, show_plot=False) -> numpy.ndar
|
|||||||
: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)
|
||||||
"""
|
"""
|
||||||
pitch_values = audio.to_pitch(0.01).selected_array['frequency']
|
pitch_values = audio.to_pitch(sgs_config.time_step).selected_array['frequency']
|
||||||
formant_values = audio.to_formant_burg(0.01)
|
formant_values = audio.to_formant_burg(sgs_config.time_step)
|
||||||
result = numpy.ndarray([len(pitch_values), 4], 'float32')
|
result = numpy.ndarray([len(pitch_values), 4], 'float32')
|
||||||
|
|
||||||
for i in range(len(pitch_values)):
|
for i in range(len(pitch_values)):
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class Config:
|
||||||
|
time_step: float = 0.01
|
||||||
|
|
||||||
|
|
||||||
|
sgs_config = Config()
|
||||||
Reference in New Issue
Block a user