Пример #1
0
def test_scalar_transposition_in_place(major_scale):
    transformations.scalar_transposition(major_scale, 1, in_place=True)
    intended_result = converter.parse("tinyNotation: C# E- F F# A- B- c c#")
    assert list(major_scale.flat.notes) == list(intended_result.flat.notes)
Пример #2
0
def test_scalar_transposition_different_scales(major_scale):
    result = transformations.scalar_transposition(
        major_scale, 1, reference_scale=scales.PentatonicScale("C"))
    intended_result = converter.parse("tinyNotation: D E G G A c c d")
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #3
0
def test_scalar_transposition(major_scale):
    result = transformations.scalar_transposition(major_scale, 1)
    intended_result = converter.parse("tinyNotation: C# E- F F# A- B- c c#")
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #4
0
def test_scalar_transposition_reference_scale(pentatonic_scale):
    result = transformations.scalar_transposition(
        pentatonic_scale, 2, reference_scale=scales.PentatonicScale("C"))
    intended_result = converter.parse("tinyNotation: E G A c d e")
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #5
0
# --------------------------------------------------------------------------------------------------
# Build the piece
# --------------------------------------------------------------------------------------------------
# Create streams
right_hand = stream.Part()
left_hand = stream.Part()

left_hand.clef = clef.TrebleClef()

# Main Loop to build the nine sections
for section_index in range(8):
    # Right hand
    # -----------------------------------------------------------------------------------------
    # Create the m-voice
    m_voice = transformations.scalar_transposition(core_melody,
                                                   section_index * -2,
                                                   reference_scale)

    # Create the t-voice
    t_voice = tintinnabuli.create_t_voice(
        m_voice, t_chord, position=2, direction=tintinnabuli.Direction.DOWN)

    # Merge and append right hand streams
    tools.append_stream(right_hand,
                        tools.merge_streams(m_voice, t_voice).chordify())

    # Append right hand interlude
    tools.append_stream(right_hand, _right_hand_interlude())
    if section_index < 6:
        right_hand.append(
            clef.TrebleClef())  # Add treble clef except for last section