Skip to content

Commit

Permalink
Mulaw preprocessing in collate method
Browse files Browse the repository at this point in the history
Signed-off-by: begeekmyfriend <[email protected]>
  • Loading branch information
begeekmyfriend committed Feb 19, 2020
1 parent 0d408eb commit bbdd596
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ def collate_vocoder(batch):
sig_offsets = [(offset + hp.voc_pad) * hp.hop_length for offset in mel_offsets]

mels = [x[0][:, mel_offsets[i]:mel_offsets[i] + mel_win] for i, x in enumerate(batch)]

labels = [x[1][sig_offsets[i]:sig_offsets[i] + hp.voc_seq_len + 1] for i, x in enumerate(batch)]

bits = 16 if hp.voc_mode == 'MOL' else hp.bits
if hp.mu_law :
labels = encode_mu_law(labels, 2 ** bits)

mels = np.stack(mels).astype(np.float32)
labels = np.stack(labels).astype(np.int64)

Expand All @@ -79,8 +82,6 @@ def collate_vocoder(batch):
x = labels[:, :hp.voc_seq_len]
y = labels[:, 1:]

bits = 16 if hp.voc_mode == 'MOL' else hp.bits

x = label_2_float(x.float(), bits)

if hp.voc_mode == 'MOL' :
Expand Down

0 comments on commit bbdd596

Please sign in to comment.