def load_sounds_from_dir(dir_path):
    sounds = []
    for filename0 in os.listdir(dir_path):
        if os.path.splitext(filename0)[1] == '.wav':
            filename = os.path.join(dir_path,filename0)
            if os.path.isfile(filename):
                print "Loading '%s'..." % (filename,)
                sounds.append(wavlib.read_wav(filename))
    return sounds
Ejemplo n.º 2
0
def read_diphones(diphones_path):
    diphones_wavs_db={}

    for filename in os.listdir(diphones_path):
        if filename.endswith(".wav"):
            wav = wavlib.read_wav(os.path.join(diphones_path,filename))
            name=os.path.splitext(filename)[0]
            wav=preprocess_diphone(name,wav)
            diphones_wavs_db[name]=wav
    return diphones_wavs_db
Ejemplo n.º 3
0
def split_wav(input_filepath, diphones, output_folderpath):
    wav = wavlib.read_wav(input_filepath)
    tolerance = 0
    for (name, start_ms, end_ms) in diphones:
        start = start_ms * 16 - tolerance  # 16000
        #start=max(start,0)
        end = end_ms * 16 + tolerance
        #end=min(end,len(diphones))
        diphone = wav[start:end]
        output_filename = '%s.wav' % name
        output_filepath = os.path.join(output_folderpath, output_filename)
        wavlib.write_wav(diphone, output_filepath)
Ejemplo n.º 4
0
def split_wav(input_filepath,diphones,output_folderpath):
    wav=wavlib.read_wav(input_filepath)
    tolerance=0
    for (name,start_ms,end_ms) in diphones:
        start=start_ms*16 -tolerance # 16000
        #start=max(start,0)
        end=end_ms*16 +tolerance
        #end=min(end,len(diphones))
        diphone=wav[start:end]
        output_filename='%s.wav' % name
        output_filepath=os.path.join(output_folderpath,output_filename)
        wavlib.write_wav(diphone,output_filepath)