from tool_box.util.utility import Utility

import numpy as np
import matplotlib.pyplot as plt

if __name__ == '__main__':

    ref_path = '/work/w16/decha/decha_w16/spec_com_work_space/Speech_synthesis/05_GPR_abcdefghijklmnopqrst/testrun/out/tsc/a-t/speech_param/a-t/demo/seed-00/M-1024/B-1024/num_iters-5/dur_old/param_mean/'

    pog_path = '/work/w25/decha/decha_w25/ICASSP_2017_workspace/Result/alpha_1.0/a-i/tscsdj01_mean.npy'
    pog = np.load(pog_path).shape

    out_path = '/work/w25/decha/decha_w25/ICASSP_2017_workspace/Using_result/450_dur/'

    pog_path = '/work/w25/decha/decha_w25/ICASSP_2017_workspace/Result/alpha_1.0/a-i/'

    for f in Utility.list_file(pog_path):
        if f.startswith('.'): continue
        if 'mean' not in f: continue

        basename = Utility.get_basefilename(f)
        base = basename[0:len(basename) - 5]

        pog = np.load('{}/{}'.format(pog_path, f)).shape
        ref = np.load('{}/{}.npy'.format(ref_path, base)).shape

        Utility.copyFile('{}/{}'.format(pog_path, f),
                         '{}/{}.npy'.format(out_path, base))

    pass
sys.path.append('/home/h1/decha/Dropbox/python_workspace/Utility/')

from tool_box.util.utility import Utility

if __name__ == '__main__':

    outpath = '/work/w2/decha/Data/GPR_data/GP_LVM_Data/Manual_labeling_stress_unstress/raw/wav/'

    source = '/home/h1/decha/data/TrainingData/wav/16k/test/'

    for ch in Utility.char_range('a', 'h'):
        Utility.make_directory('{}/{}'.format(outpath, ch))

    list = '/work/w2/decha/Data/GPR_data/GP_LVM_Data/Manual_labeling_stress_unstress/raw/stress_unstressed_label_file_index.test.txt'

    for line in Utility.read_file_line_by_line(list):
        label = line.split(' ')

        ori = label[0].split('.')[0]
        dest = label[1].split('.')[0]

        set = dest.split('_')[2][0]

        print ori, dest, set

        src = '{}/{}.wav'.format(source, ori)
        dst = '{}/{}/{}.wav'.format(outpath, set, dest)

        Utility.copyFile(src, dst)

    pass
示例#3
0
        setout = '{}/{}/'.format(outpath, sett)
        Utility.make_directory(setout)

        for f in Utility.list_file(set_path):
            if f.startswith('.'): continue

            basename = f.split('.')[0]
            print basename

            wav_file = '{}/{}/{}'.format(wav_path, sett, f)
            label_file = '{}/{}/{}.lab'.format(label_path, sett, basename)

            out = []
            count = 0
            for line in Utility.read_file_line_by_line(label_file):
                spl = line.split(' ')

                if ('-sil+' in line) | ('-pau+' in line):
                    out.append('{} {} {}'.format(spl[0], spl[1], 'sil'))
                else:
                    count += 1
                    out.append('{} {} {}'.format(spl[0], spl[1], count))

            dest_wav = '{}/{}/{}'.format(outpath, sett, f)
            dest_label = '{}/{}/{}.lab'.format(outpath, sett, basename)

            Utility.copyFile(wav_file, dest_wav)
            Utility.write_to_file_line_by_line(dest_label, out)

    pass