| @@ -56,9 +56,11 @@ confidences = array(confidences[skip:]) · 55 unmodified lines |
| 56 | times = [t * hop_s for t in range(len(pitches))] | 56 | times = [t * hop_s for t in range(len(pitches))] |
| 57 | | 57 | |
| 58 | fig = plt.figure() | 58 | fig = plt.figure() |
| | 59 | |
| 59 | ax1 = fig.add_subplot(311) | 60 | ax1 = fig.add_subplot(311) |
| 60 | ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1) | 61 | ax1 = get_waveform_plot(filename, samplerate = samplerate, block_size = hop_s, ax = ax1) |
| 61 | ax1.set_xticklabels([]) | 62 | plt.setp(ax1.get_xticklabels(), visible = False) |
| | 63 | ax1.set_xlabel('') |
| 62 | | 64 | |
| 63 | def array_from_text_file(filename, dtype = 'float'): | 65 | def array_from_text_file(filename, dtype = 'float'): |
| 64 | import os.path | 66 | import os.path |
| @@ -87,7 +89,8 @@ cleaned_pitches = ma.masked_where(confidences < tolerance, cleaned_pitches) · 22 unmodified lines |
| 87 | ax2.plot(times, cleaned_pitches, '.-') | 89 | ax2.plot(times, cleaned_pitches, '.-') |
| 88 | #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() ) | 90 | #ax2.axis( ymin = 0.9 * cleaned_pitches.min(), ymax = 1.1 * cleaned_pitches.max() ) |
| 89 | #ax2.axis( ymin = 55, ymax = 70 ) | 91 | #ax2.axis( ymin = 55, ymax = 70 ) |
| 90 | ax2.set_xticklabels([]) | 92 | plt.setp(ax2.get_xticklabels(), visible = False) |
| | 93 | ax2.set_ylabel('f0 (Hz)') |
| 91 | | 94 | |
| 92 | # plot confidence | 95 | # plot confidence |
| 93 | ax3 = fig.add_subplot(313, sharex = ax1) | 96 | ax3 = fig.add_subplot(313, sharex = ax1) |
| @@ -96,6 +99,7 @@ ax3.plot(times, confidences) · 2 unmodified lines |
| 96 | # draw a line at tolerance | 99 | # draw a line at tolerance |
| 97 | ax3.plot(times, [tolerance]*len(confidences)) | 100 | ax3.plot(times, [tolerance]*len(confidences)) |
| 98 | ax3.axis( xmin = times[0], xmax = times[-1]) | 101 | ax3.axis( xmin = times[0], xmax = times[-1]) |
| 99 | plt.show() | 102 | ax3.set_ylabel('condidence') |
| 100 | set_xlabels_sample2time(ax3, times[-1], samplerate) | 103 | set_xlabels_sample2time(ax3, times[-1], samplerate) |
| 101 | #plt.savefig(os.path.basename(filename) + '.png', dpi=200) | 104 | plt.show() |
| | 105 | #plt.savefig(os.path.basename(filename) + '.svg') |