def do_IS_speakers(): output = [] Productions = ['2','3'] for w in Words: mod_path = os.path.join(MODEL_DIR,'modeltalker_%s.wav' %w) mod_env = calc_envelope(mod_path,**opt_dict) print(w) for s in Speakers: if 'IS' not in s: continue if s == 'modeltalker': continue sp = s.split('_')[0] s_dir = os.path.join(JAM_DIR,s) for p in Productions: base_path = os.path.join(s_dir,'%s_%s1is.wav' % (sp,w)) shad_path = os.path.join(s_dir,'%s_%s%sis.wav' % (sp,w,p)) if not os.path.isfile(base_path): continue if not os.path.isfile(shad_path): continue base_env = calc_envelope(base_path,**opt_dict) shad_env = calc_envelope(shad_path,**opt_dict) b_to_m_sim = envelope_match(mod_env,base_env) s_to_m_sim = envelope_match(mod_env,shad_env) output.append([sp,p,w,b_to_m_sim,s_to_m_sim]) with open(os.path.join(BASE_DIR,'jam_output8IS.txt'),'w') as f: csvw = csv.writer(f,delimiter='\t') csvw.writerow(['Shadower_number','Block', 'Word','base_to_mod_env_sim','shad_to_mod_env_sim', #'mfcc_shad_to_mod','mfcc_mod_to_shad', #'spec_shad_to_mod','spec_mod_to_shad', #'mfcc_base_to_mod','mfcc_mod_to_base', #'spec_base_to_mod','spec_mod_to_base' ]) for l in output: csvw.writerow(l)
def token_to_env(wt): path = fetch_temp_resource('buckeye-wt-%d.wav' % wt.pk) if not os.path.isfile(path): extract_vowel(wt.get_dialog_path(),wt.Begin,wt.End,path) env = calc_envelope(path) return env