Ejemplo n.º 1
0
def test_load_lines():
    data_path = ("tests/resources/mir_datasets/dali/annotations/" +
                 "4b196e6c99574dd49ad00d56e132712b.gz")
    line_data = dali.load_annotations_granularity(data_path, "lines")

    assert type(line_data) == annotations.LyricData
    assert type(line_data.intervals) == np.ndarray
    assert type(line_data.lyrics) == list

    assert np.array_equal(line_data.intervals[:, 0], np.array([24.125, 24.42]))
    assert np.array_equal(line_data.intervals[:, 1], np.array([24.42, 24.568]))
    assert np.array_equal(line_data.lyrics, ["why do", "they"])
Ejemplo n.º 2
0
def test_load_paragraphs():
    data_path = ("tests/resources/mir_datasets/dali/annotations/" +
                 "4b196e6c99574dd49ad00d56e132712b.gz")
    par_data = dali.load_annotations_granularity(data_path, "paragraphs")

    assert type(par_data) == utils.LyricData
    assert type(par_data.start_times) == np.ndarray
    assert type(par_data.end_times) == np.ndarray
    assert type(par_data.lyrics) == np.ndarray

    assert np.array_equal(par_data.start_times, np.array([24.125, 24.420]))
    assert np.array_equal(par_data.end_times, np.array([24.420, 24.568]))
    assert np.array_equal(par_data.lyrics, np.array(["why do", "they"]))
Ejemplo n.º 3
0
def test_load_notes():
    notes_path = ("tests/resources/mir_datasets/dali/annotations/" +
                  "4b196e6c99574dd49ad00d56e132712b.gz")
    note_data = dali.load_annotations_granularity(notes_path, "notes")

    assert type(note_data) == annotations.NoteData
    assert type(note_data.intervals) == np.ndarray
    assert type(note_data.notes) == np.ndarray

    assert np.array_equal(note_data.intervals[:, 0],
                          np.array([24.125, 24.273, 24.420]))
    assert np.array_equal(note_data.intervals[:, 1],
                          np.array([24.273, 24.420, 24.568]))
    assert np.array_equal(note_data.notes,
                          np.array([1108.731, 1108.731, 1108.731]))