Ejemplo n.º 1
0
# plus a random walk to create gradual dynamic changes.
# Amplitudes are in the MIDI velocity range (0..127).
#------------------------------------------------------------------------
amplitude = iso.PSequence([50, 35, 25, 35]) + iso.PBrown(0, 1, -20, 20)

#------------------------------------------------------------------------
# Create a repeating sequence with scalar transposition:
# [ 36, 38, 43, 39, 36, 38, 43, 39, ... ]
#------------------------------------------------------------------------
bassline = iso.PSequence([0, 2, 7, 3]) + 36

#------------------------------------------------------------------------
# Repeat each note 3 times, and transpose each into a different octave
# [ 36, 48, 60, 38, 50, 62, ... ]
#------------------------------------------------------------------------
bassline = iso.PStutter(bassline, 3) + iso.PSequence([0, 12, 24])

#------------------------------------------------------------------------
# A Timeline schedules events at a specified tempo. By default, events
# are send to the system's default MIDI output.
#------------------------------------------------------------------------
output = iso.MidiOutputDevice()

timeline = iso.Timeline(120, output)

#------------------------------------------------------------------------
# Schedule events, with properties generated by the Pattern objects.
#------------------------------------------------------------------------
timeline.schedule({
    "note": arpeggio,
    "duration": 0.25,
Ejemplo n.º 2
0
#!/usr/bin/env python3

#------------------------------------------------------------------------
# isobar: ex-subsequence
#------------------------------------------------------------------------

import isobar as iso

import logging
logging.basicConfig(level=logging.DEBUG, format="[%(asctime)s] %(message)s")

scale = iso.Scale.pelog
sequence = iso.PDegree(iso.PBrown(0, 3, -12, 12), scale)

offset = iso.PStutter(iso.pattern.PWhite(0, 4), 2)
sequence = iso.PSubsequence(sequence, offset, 4)
sequence = iso.PPermut(sequence)
sequence = sequence + 64
sequence = iso.PReset(sequence, iso.PImpulse(24))

amp = iso.pattern.PSequence([45, 35, 25, 40]) + iso.PBrown(0, 1, -15, 10)

gate = iso.pattern.PBrown(1.5, 0.01, 0.6, 2.5)

timeline = iso.Timeline(120)
timeline.schedule({
    "note": sequence.copy(),
    "amplitude": amp.copy(),
    "duration": 0.25,
    "gate": gate.copy()
})
Ejemplo n.º 3
0
def test_pstutter():
    a = iso.PSequence([1, 2, 3], 1)
    b = iso.PStutter(a, 3)
    assert list(b) == [1, 1, 1, 2, 2, 2, 3, 3, 3]