Skip to content

Commit

Permalink
整理: .default_sampling_rate 移植 (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarepan authored Dec 5, 2023
1 parent 349bf58 commit 91259d8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/test_synthesis_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def decode_mock(


class MockCore:
default_sampling_rate = 24000
yukarin_s_forward = Mock(side_effect=yukarin_s_mock)
yukarin_sa_forward = Mock(side_effect=yukarin_sa_mock)
decode_forward = Mock(side_effect=decode_mock)
Expand Down
1 change: 1 addition & 0 deletions test/test_synthesis_engine_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def create_mock_query(accent_phrases):


class MockCore:
default_sampling_rate = 24000
yukarin_s_forward = Mock(side_effect=yukarin_s_mock)
yukarin_sa_forward = Mock(side_effect=yukarin_sa_mock)
decode_forward = Mock(side_effect=decode_mock)
Expand Down
5 changes: 4 additions & 1 deletion voicevox_engine/dev/synthesis_engine/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def __init__(

self._speakers = speakers
self._supported_devices = supported_devices
self.default_sampling_rate = 24000

@property
def default_sampling_rate(self) -> int:
return 24000

@property
def speakers(self) -> str:
Expand Down
2 changes: 2 additions & 0 deletions voicevox_engine/synthesis_engine/core_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ def __init__(
load_all_models: bool = False,
) -> None:

self.default_sampling_rate = 24000

self.core = load_core(core_dir, use_gpu)

self.core.initialize.restype = c_bool
Expand Down
5 changes: 4 additions & 1 deletion voicevox_engine/synthesis_engine/synthesis_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ def __init__(self, core: CoreWrapper):
super().__init__()
self.core = core
self.mutex = threading.Lock()
self.default_sampling_rate = 24000

@property
def default_sampling_rate(self) -> int:
return self.core.default_sampling_rate

@property
def speakers(self) -> str:
Expand Down
5 changes: 5 additions & 0 deletions voicevox_engine/synthesis_engine/synthesis_engine_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ def full_context_label_moras_to_moras(


class SynthesisEngineBase(metaclass=ABCMeta):
@property
@abstractmethod
def default_sampling_rate(self) -> int:
raise NotImplementedError

# FIXME: jsonではなくModelを返すようにする
@property
@abstractmethod
Expand Down

0 comments on commit 91259d8

Please sign in to comment.