Exemple #1
0
#!/usr/bin/env python


import sys
import imp
import speechprocessing


def usage():
  print "USAGE: process.py <input file path> <control file path>"
  sys.exit(0)

if __name__ == '__main__':
  
  if len(sys.argv) < 2:
    usage()
  input_wav_path = sys.argv[1]
  control_wav_path = sys.argv[2]

  speechprocessing.chop(input_wav_path, input_wav_path)
  speechprocessing.trim(input_wav_path, input_wav_path)
  speechprocessing.match_length(input_wav_path, input_wav_path, control_wav_path, force=True)
  speechprocessing.filter(input_wav_path, input_wav_path)
  distance = speechprocessing.compare(control_wav_path, input_wav_path)

  print distance



Exemple #2
0
if __name__ == '__main__':

    if not os.path.exists('./averaged'):
        os.makedirs('./averaged')
    for dir in os.listdir('./output'):
        standard_path = './output/' + dir + '/standard'

        if os.path.exists(standard_path):
            files = []
            for file in os.listdir(standard_path):
                files.append('./output/' + dir + '/standard/' + file)
            output = './averaged/' + dir + '.wav'
            files.insert(0, output)
            print files
            speechprocessing.average(*files)


            text_list = './averaged/' + dir + '.txt'
            control = output
            
            text_scores = []
            for file in os.listdir(standard_path):
                exp_file = './output/' + dir + '/standard/' + file
                # text_scores.append()
                with open(text_list, "a") as myfile:
                    myfile.write(str(speechprocessing.compare(control, exp_file)))
                    myfile.write('\n')


    # for root, dirs, files in os.walk("./output"):
        # print dirs