def test_pitch_hz(): plt.figure() ref_times, ref_freqs = load_labeled_events("tests/data/melody/ref00.txt") est_times, est_freqs = load_labeled_events("tests/data/melody/est00.txt") # Plot pitches on a Hz scale mir_eval.display.pitch(ref_times, ref_freqs, unvoiced=True, label="Reference") mir_eval.display.pitch(est_times, est_freqs, unvoiced=True, label="Estimate") plt.legend()
def test_pitch_hz(): plt.figure() ref_times, ref_freqs = load_labeled_events('data/melody/ref00.txt') est_times, est_freqs = load_labeled_events('data/melody/est00.txt') # Plot pitches on a Hz scale mir_eval.display.pitch(ref_times, ref_freqs, unvoiced=True, label='Reference') mir_eval.display.pitch(est_times, est_freqs, unvoiced=True, label='Estimate') plt.legend()
def test_pitch_midi_hz(): plt.figure() times, freqs = load_labeled_events('data/melody/ref00.txt') # Plot pitches on a midi scale with note tickers mir_eval.display.pitch(times, freqs, midi=True) mir_eval.display.ticker_pitch()
def loadGT(self, GTPath): """load melody ground truth""" e_times, labels = load_labeled_events(GTPath, delimiter="\t") intervals = np.array([e_times[:-1], e_times[1:]]).T # iganore variations like <A, A'> labels = [lab.strip("'") for lab in labels[:-1]] # merge <silence> and <Silence> labels = ["Silence" if lab == "silence" else lab for lab in labels] # remove negative duration intervals positiveIntv = np.array([intv[1] - intv[0] > 0 for intv in intervals]) intervals = intervals[positiveIntv] labels = np.array(labels)[positiveIntv] return intervals, labels