Пример #1
0
def test_additive_process_repetitions_sequence(example_stream):
    result = minimalism.additive_process(example_stream, repetitions=[1, 2, 3])
    intended_result = converter.parse("""tinyNotation: 
        C
        C D 
        C D 
        C D E 
        C D E 
        C D E 
        C D E F 
        C D E F G 
        C D E F G 
        C D E F G A 
        C D E F G A 
        C D E F G A 
        C D E F G A B 
        C D E F G A B c
        C D E F G A B c
        C D E F G A B c d
        C D E F G A B c d
        C D E F G A B c d
        C D E F G A B c d e
        C D E F G A B c d e f
        C D E F G A B c d e f
        C D E F G A B c d e f g
        C D E F G A B c d e f g
        C D E F G A B c d e f g
    """)
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #2
0
def test_additive_process_step_value_int(example_stream):
    result = minimalism.additive_process(example_stream, step_value=2)
    intended_result = converter.parse("""tinyNotation: 
        C D 
        C D E F 
        C D E F G A 
        C D E F G A B c
        C D E F G A B c d e
        C D E F G A B c d e f g
    """)
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #3
0
def test_additive_process_step_value_sequence_absolute_infinite_loop(
        example_stream):
    result = minimalism.additive_process(
        example_stream,
        step_value=[1, 2, 3],
        step_mode=minimalism.StepMode.ABSOLUTE)
    intended_result = converter.parse("""tinyNotation: 
        C
        C D 
        C D E 
        """)
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #4
0
def test_additive_process_iterations_end(example_stream):
    result = minimalism.additive_process(example_stream, iterations_end=8)
    intended_result = converter.parse("""tinyNotation: 
        C
        C D 
        C D E 
        C D E F 
        C D E F G 
        C D E F G A 
        C D E F G A B 
        C D E F G A B c
    """)
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #5
0
def test_additive_process_step_value_sequence_absolute(example_stream):
    result = minimalism.additive_process(
        example_stream,
        step_value=sequences.PRIMES,
        step_mode=minimalism.StepMode.ABSOLUTE,
    )
    intended_result = converter.parse("""tinyNotation: 
        C D 
        C D E 
        C D E F G 
        C D E F G A B 
        C D E F G A B c d e f
        C D E F G A B c d e f g
        """)
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #6
0
def test_additive_process_nonlinear(example_stream):
    result = minimalism.additive_process(
        example_stream,
        step_value=sequences.kolakoski(),
        step_mode=minimalism.StepMode.ABSOLUTE,
        iterations_end=8,
    )
    intended_result = converter.parse("""tinyNotation: 
        C
        C D     
        C D     
        C
        C
        C D     
        C
        C D     
        """)
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #7
0
def test_additive_process_direction(example_stream, direction,
                                    intended_result):
    result = minimalism.additive_process(example_stream, direction=direction)
    assert list(result.flat.notes) == list(intended_result.flat.notes)
Пример #8
0
# Define a list of quarter note offsets for adding left-hand pedal notes
bar_offsets = [0, 7, 16, 27, 34, 43, 54]

# Build core scale pattern
scale_pattern = isorhythm.create_isorhythm(
    reference_scale.getPitches("C#6", "G5") +
    reference_scale.getPitches("F6", "C#6"),
    [2, 1, 1, 1, 1, 1, 1, 3],
)

# --------------------------------------------------------------------------------------------------
# Build the core melody for one section
# --------------------------------------------------------------------------------------------------
# Create additive process
core_melody = minimalism.additive_process(
    scale_pattern, direction=minimalism.Direction.INWARD, iterations_start=2)

# Add time signatures
core_melody.insert(0, meter.TimeSignature("7/4"))
core_melody.insert(7, meter.TimeSignature("9/4"))
core_melody.insert(16, meter.TimeSignature("11/4"))

# Append inverted version for the second half
tools.append_stream(
    core_melody,
    transformations.scalar_inversion(core_melody, "C#6", reference_scale))

# --------------------------------------------------------------------------------------------------
# Define function to add two bars interlude (this uses only normal music21 elements)
# --------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------------
# Set reference scale (G minor pentatonic) for inversion/transposition operations
# ----------------------------------------------------------------------------------------------------------------------
reference_scale = scales.PentatonicScale(tonic="G2", mode=5)

# ----------------------------------------------------------------------------------------------------------------------
# Build core scale pattern
# ----------------------------------------------------------------------------------------------------------------------
basic_scale = isorhythm.create_isorhythm(
    reference_scale.getPitches("G2", "B-3"), [0.25]
)

# ----------------------------------------------------------------------------------------------------------------------
# Build A section
# ----------------------------------------------------------------------------------------------------------------------
pattern_a = minimalism.additive_process(basic_scale)
section_a = minimalism.additive_process(pattern_a)
section_a.append(minimalism.subtractive_process(pattern_a, iterations_start=1))

# ----------------------------------------------------------------------------------------------------------------------
# Build B section
# ----------------------------------------------------------------------------------------------------------------------
pattern_b = minimalism.subtractive_process(
    basic_scale, direction=minimalism.Direction.BACKWARD
)
section_b = minimalism.additive_process(pattern_b)
section_b.append(minimalism.subtractive_process(pattern_b, iterations_start=1))

# ----------------------------------------------------------------------------------------------------------------------
# Build remaining sections
# ----------------------------------------------------------------------------------------------------------------------