Skip to content

Commit

Permalink
🐛 fix apply_normalize missing sr
Browse files Browse the repository at this point in the history
  • Loading branch information
zhzLuke96 committed Jun 23, 2024
1 parent 26122d4 commit 2db6d65
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions modules/api/impl/handler/SSMLHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ def enqueue(self) -> tuple[np.ndarray, int]:

if adjust_config.normalize:
sample_rate, audio_data = audio.apply_normalize(
audio_data=audio_data,
headroom=adjust_config.headroom,
audio_data=audio_data, headroom=adjust_config.headroom, sr=sample_rate
)

return audio_data, sample_rate
1 change: 1 addition & 0 deletions modules/api/impl/handler/TTSHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def enqueue(self) -> tuple[np.ndarray, int]:
sample_rate, audio_data = apply_normalize(
audio_data=audio_data,
headroom=adjust_config.headroom,
sr=sample_rate,
)

return audio_data, sample_rate
Expand Down
3 changes: 2 additions & 1 deletion modules/utils/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ def apply_prosody_to_audio_data(
def apply_normalize(
audio_data: np.ndarray,
headroom: float = 1,
sr: int = 24000,
):
segment = ndarray_to_segment(audio_data, 24000)
segment = ndarray_to_segment(audio_data, sr)
segment = effects.normalize(seg=segment, headroom=headroom)

return pydub_to_np(segment)
Expand Down

0 comments on commit 2db6d65

Please sign in to comment.