Skip to content

Commit

Permalink
Symmetric mels helps quick alignment
Browse files Browse the repository at this point in the history
Signed-off-by: begeekmyfriend <[email protected]>
  • Loading branch information
begeekmyfriend committed Dec 1, 2018
1 parent 3765d6c commit bd2d80e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions hparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cleaners='basic_cleaners',

# Audio:
num_mels=80,
num_mels=160,
num_freq=1025,
sample_rate=16000,
frame_length_ms=50,
Expand All @@ -17,6 +17,7 @@
min_level_db=-100,
ref_level_db=20,
max_frame_num=1000,
max_abs_value = 4,

# Model:
outputs_per_step=5,
Expand All @@ -38,7 +39,7 @@
# Eval:
max_iters=300,
griffin_lim_iters=60,
power=1.5, # Power to raise magnitudes to prior to Griffin-Lim
power=1.2, # Power to raise magnitudes to prior to Griffin-Lim
)


Expand Down
9 changes: 6 additions & 3 deletions util/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,13 @@ def _db_to_amp_tensorflow(x):
return tf.pow(tf.ones(tf.shape(x)) * 10.0, x * 0.05)

def _normalize(S):
return (S - hparams.min_level_db) / -hparams.min_level_db
# symmetric mels
return 2 * hparams.max_abs_value * ((S - hparams.min_level_db) / -hparams.min_level_db) - hparams.max_abs_value

def _denormalize(S):
return (S * -hparams.min_level_db) + hparams.min_level_db
# symmetric mels
return ((S + hparams.max_abs_value) * -hparams.min_level_db) / (2 * hparams.max_abs_value) + hparams.min_level_db

def _denormalize_tensorflow(S):
return (S * -hparams.min_level_db) + hparams.min_level_db
# symmetric mels
return ((S + hparams.max_abs_value) * -hparams.min_level_db) / (2 * hparams.max_abs_value) + hparams.min_level_db

0 comments on commit bd2d80e

Please sign in to comment.