-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathprepo.py
26 lines (21 loc) · 811 Bytes
/
prepo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
#/usr/bin/python2
'''
By kyubyong park. [email protected].
https://www.github.com/kyubyong/multi-speech-corpora/dc_tts
'''
from __future__ import print_function
from utils import load_spectrograms
import os
from data_load import load_data
import numpy as np
import tqdm
from hyperparams import Hyperparams as hp
# Load data
fpaths, _, _ = load_data() # list
for fpath in tqdm.tqdm(fpaths):
fname, mel, mag = load_spectrograms(fpath)
if not os.path.exists("{}/mels".format(hp.lang)): os.makedirs("{}/mels".format(hp.lang))
if not os.path.exists("{}/mags".format(hp.lang)): os.makedirs("{}/mags".format(hp.lang))
np.save("{}/mels/{}".format(hp.lang, fname.replace("wav", "npy")), mel)
np.save("{}/mags/{}".format(hp.lang, fname.replace("wav", "npy")), mag)