Audio Dataset
This commit is contained in:
@ -8,6 +8,9 @@ class Normalize(object):
|
||||
def __init__(self, min_db_level: Union[int, float]):
|
||||
self.min_db_level = min_db_level
|
||||
|
||||
def __repr__(self):
|
||||
return f'{self.__class__.__name__}({self.__dict__})'
|
||||
|
||||
def __call__(self, s: np.ndarray) -> np.ndarray:
|
||||
return np.clip((s - self.min_db_level) / -self.min_db_level, 0, 1)
|
||||
|
||||
@ -17,5 +20,8 @@ class DeNormalize(object):
|
||||
def __init__(self, min_db_level: Union[int, float]):
|
||||
self.min_db_level = min_db_level
|
||||
|
||||
def __repr__(self):
|
||||
return f'{self.__class__.__name__}({self.__dict__})'
|
||||
|
||||
def __call__(self, s: np.ndarray) -> np.ndarray:
|
||||
return (np.clip(s, 0, 1) * -self.min_db_level) + self.min_db_level
|
||||
|
Reference in New Issue
Block a user