diff --git a/sgs/__init__.py b/sgs/__init__.py index 5f67083..450ff8d 100644 --- a/sgs/__init__.py +++ b/sgs/__init__.py @@ -1,4 +1,4 @@ import sgs.api import sgs.calculations -__version__ = '1.0.4' +__version__ = '1.0.5' diff --git a/sgs/calculations.py b/sgs/calculations.py index 9310048..a641da0 100644 --- a/sgs/calculations.py +++ b/sgs/calculations.py @@ -7,6 +7,8 @@ import numpy import numpy as np import parselmouth +from sgs.config import sgs_config + 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 :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'] - formant_values = audio.to_formant_burg(0.01) + pitch_values = audio.to_pitch(sgs_config.time_step).selected_array['frequency'] + formant_values = audio.to_formant_burg(sgs_config.time_step) result = numpy.ndarray([len(pitch_values), 4], 'float32') for i in range(len(pitch_values)): diff --git a/sgs/config.py b/sgs/config.py new file mode 100644 index 0000000..4af7e02 --- /dev/null +++ b/sgs/config.py @@ -0,0 +1,5 @@ +class Config: + time_step: float = 0.01 + + +sgs_config = Config()