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)
Пример #2
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)
Пример #3
0
def main():
    input_string,output_filepath=validate_arguments()

    print2("1) Checking syntax... ")
    if not string_processing.validate_syntax(input_string):
        sys.exit('\n ERROR: Invalid input string syntax \"%s\". Input must be of the form (CV)+ where C is a consonant taken from {m,l,s,p,k} and V a vowel taken from {a,A}.' % input_string)
    print "done, syntax ok."

    diphones_path="diphones"
    print2("2) Loading diphones wav files from folder %s... " % diphones_path)
    diphones_wavs_db=diphone_db.read_diphones(diphones_path)
    print "done, %d diphones loaded." % len(diphones_wavs_db)

    print2("3) Parsing diphones from: \"%s\"... " % input_string)
    diphones=string_processing.tokenize(input_string)
    print "done, diphones to synthesize: %s." % str(diphones)

    print2("4) Synthesizing... ")
    output_wav=ttslib.synthesize(diphones_wavs_db,diphones)
    print "done."

    print2("5) Saving file %s..." % output_filepath)
    wavlib.write_wav(output_wav,output_filepath)
    print "done."