#sig_viterbi = Signal(sig_out_viterbi, 22050, normalize=True) rec_sig = Signal(sig_out, 22050, normalize=True) rec_sig.crop(0, test_segs[max_synth_idx]*rec_sig.fs) save_fig_audio(rec_sig, '%s_plain_cross_%s'%(test_file,learntype)) rec_sig_normalized = Signal(sig_out_normalized, 22050, normalize=True) rec_sig_normalized.crop(0, test_segs[max_synth_idx]*rec_sig.fs) save_fig_audio(rec_sig_normalized, '%s_normalized_cross_%s'%(test_file,learntype)) # load original audio orig_data, fs = get_audio(audio_file_path, 0, rec_sig.get_duration(), targetfs=None, verbose=True) orig_sig = Signal(orig_data, fs, normalize=True) save_fig_audio(orig_sig, '%s_original_%dsegments'%(test_file,max_synth_idx)) Lmax = min(orig_sig.length,rec_sig.length) t_vec = np.arange(float(Lmax))/float(fs) plt.figure(figsize=(8,8)) ax1 = plt.subplot(311) plt.plot(t_vec,orig_sig.data[:Lmax]) plt.stem(test_segs[:max_synth_idx], 0.8*np.ones((max_synth_idx,)), linefmt='k-', markerfmt='s') plt.subplot(312, sharex=ax1, sharey=ax1) #plt.xticks([])