Skip to content

Commit

Permalink
refactor(audio): remove duplicate rms_volume_norm function
Browse files Browse the repository at this point in the history
  • Loading branch information
eginhard committed Nov 17, 2024
1 parent 51d1098 commit fba0c07
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions TTS/utils/audio/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,19 +556,6 @@ def sound_norm(x: np.ndarray) -> np.ndarray:
"""
return volume_norm(x=x)

def rms_volume_norm(self, x: np.ndarray, db_level: float = None) -> np.ndarray:
"""Normalize the volume based on RMS of the signal.
Args:
x (np.ndarray): Raw waveform.
Returns:
np.ndarray: RMS normalized waveform.
"""
if db_level is None:
db_level = self.db_level
return rms_volume_norm(x=x, db_level=db_level)

### save and load ###
def load_wav(self, filename: str, sr: int = None) -> np.ndarray:
"""Read a wav file using Librosa and optionally resample, silence trim, volume normalize.
Expand All @@ -594,7 +581,7 @@ def load_wav(self, filename: str, sr: int = None) -> np.ndarray:
if self.do_sound_norm:
x = self.sound_norm(x)
if self.do_rms_norm:
x = self.rms_volume_norm(x, self.db_level)
x = rms_volume_norm(x=x, db_level=self.db_level)
return x

def save_wav(self, wav: np.ndarray, path: str, sr: Optional[int] = None, pipe_out=None) -> None:
Expand Down

0 comments on commit fba0c07

Please sign in to comment.