import feature_extractor as fe from sys import argv import os """ Put all samples (mfcc, deltas and delta deltas) of speaker n to file samples_n.txt. Repeat for all speakers. By uncommenting the lines with i, number skipping will be avoided in resulting files, but the file names will not match the correct speaker. """ if __name__ == '__main__': i = 1 for x in range(155): print "Speaker {} in progress.".format(x + 225) pathname = str(x + 225) #outfile = "samples_{}".format(pathname) outfile = "samples_{}".format(i) if os.path.exists("VCTK-Corpus\wav48\p"+pathname): for y in range(510): if y < 10: z = "00" elif y < 100: z = "0" else: z = "" name = pathname + "_" + str(y) filename = "VCTK-Corpus\wav48\p"+pathname+"\p"+pathname+"_"+z+str(y)+".wav" if os.path.exists(filename): fe.extract_and_save(filename, name, outfile, "mfcc", 2) i += 1
ystart = 50 yend = 52 for x in range(xstart,xend): pathname = str(x + 225) if (outfile == "train" and x > ubm_x): name = ".ubm" else: name = pathname for y in range(ystart, yend): if y < 10: z = "00" elif y < 100: z = "0" else: z = "" if (outfile == "test"): name = pathname + "_" + str(y) filename = "VCTK-Corpus\wav48\p"+pathname+"\p"+pathname+"_"+z+str(y)+".wav" if os.path.exists(filename): if (remove_silence != 0): sr.remove_silence(filename) filename = filename + ".sr" fe.extract_and_save(filename, name, outfile, type, delta_amount) print filename os.remove(filename) else: print filename fe.extract_and_save(filename, name, outfile, type, delta_amount)