Example #1
0
def test_cases():
    return [
        (
            Notes(0),
            MelodicInterval(Interval.PerfectFifth, Order.Ascending, 0),
            Notes(7),
        ),
        (Notes(13), MelodicInterval(Interval.Tritone, Order.Descending, 0), Notes(7)),
        (Notes(0), MelodicInterval(Interval.Semitone, Order.Descending, 0), Notes(11)),
        (Notes(13), MelodicInterval(Interval.Octave, Order.Static, 0), Notes(13)),
        (
            Notes(10),
            MelodicInterval(Interval.MinorSixth, Order.Ascending, 2),
            Notes(42),
        ),
    ]
Example #2
0
def test_eval(note_ints):
    progression = []
    for note_int in note_ints:
        progression.append(Notes(note_int))
    note_progression = NoteProgression(progression)

    assert ToneRow(note_progression).tone_row == note_progression
Example #3
0
def test_cases():
    return [
        ([Notes(60), Notes(72)], [Interval.Octave]),
        ([Notes(60), Notes(65)], [Interval.PerfectFourth]),
        (
            [Notes(50), Notes(52), Notes(44), Notes(70)],
            [Interval.Tone, Interval.MinorSixth, Interval.Tone],
        ),
    ]
Example #4
0
def test_exceptions(note_ints, exception):
    progression = []
    for note_int in note_ints:
        progression.append(Notes(note_int))
    note_progression = NoteProgression(progression)

    with exception:
        assert ToneRow(note_progression) is not None
Example #5
0
def test_eval(note_int, expected):
    assert Notes.create_base_note(note_int) == expected
Example #6
0
def test_cases():
    return [(0, Notes(0)), (13, Notes(1)), (29, Notes(5)), (60, Notes(0))]
Example #7
0
def test_exception(note_int, exception):
    with exception:
        assert Notes.create_base_note(note_int) is not None
def test_exception(note, exception):
    with exception:
        assert Notes.get_note_index(note) is not None
def test_eval(note, expected):
    assert Notes.get_note_index(note) == expected
Example #10
0
from fourparts import Notes, NoteProgression, ToneRow

TONEROW = ToneRow(
    NoteProgression([
        Notes(9),
        Notes(2),
        Notes(11),
        Notes(4),
        Notes(5),
        Notes(7),
        Notes(6),
        Notes(8),
        Notes(1),
        Notes(10),
        Notes(3),
        Notes(0),
    ]))

TONEROW_RETROGRADE = ToneRow(
    NoteProgression([
        Notes(0),
        Notes(3),
        Notes(10),
        Notes(1),
        Notes(8),
        Notes(6),
        Notes(7),
        Notes(5),
        Notes(4),
        Notes(11),
        Notes(2),
Example #11
0
def test_cases():
    return [
        (
            pd.read_csv(PERFECT_CADENCE_CSV),
            [Notes(65), Notes(65), Notes(64)],
        ),
        (
            pd.read_csv(TYPEA_PERFECT_CADENCE_CSV),
            [Notes(64), Notes(64), Notes(62)],
        ),
        (
            pd.read_csv(CHORALE_F_CSV),
            [
                Notes(65),
                Notes(65),
                Notes(67),
                Notes(69),
                Notes(67),
                Notes(65),
                Notes(64),
                Notes(61),  # MelodyExtractor cannot differentiate between voices
                Notes(62),
            ],
        ),
        (
            pd.read_csv(UNISON_CSV),
            [Notes(67), Notes(69)],
        ),
    ]