Skip to content

Commit

Permalink
Use 0-1 normalization
Browse files Browse the repository at this point in the history
Signed-off-by: begeekmyfriend <[email protected]>
  • Loading branch information
begeekmyfriend committed Aug 19, 2018
1 parent f8de0d7 commit a614f95
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ def _db_to_amp_tensorflow(x):
return tf.pow(tf.ones(tf.shape(x)) * 10.0, x * 0.05)

def _normalize(S):
return np.clip((S - hparams.min_level_db) / -hparams.min_level_db, 0, 4)
return np.clip((S - hparams.min_level_db) / -hparams.min_level_db, 0, 1)

def _denormalize(S):
return (np.clip(S, 0, 4) * -hparams.min_level_db) + hparams.min_level_db
return (np.clip(S, 0, 1) * -hparams.min_level_db) + hparams.min_level_db

def _denormalize_tensorflow(S):
return (tf.clip_by_value(S, 0, 4) * -hparams.min_level_db) + hparams.min_level_db
return (tf.clip_by_value(S, 0, 1) * -hparams.min_level_db) + hparams.min_level_db

2 comments on commit a614f95

@candlewill
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You said normalization to range [-4, 4] is bettor than [0, 1] in another issue report. So, why do you still change to range [0, 1], and can you share your latest settings for normalization?

@begeekmyfriend
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For T2 [0,1] does not get alignment. But for T1 [0, 1] or [-4, 4] does not matter for the results.

Please sign in to comment.