|
10 | 10 | from isobar.io import MidiFileOut |
11 | 11 |
|
12 | 12 | import logging |
| 13 | +logging.basicConfig(level=logging.INFO, format="[%(asctime)s] %(message)s") |
13 | 14 |
|
14 | | -logging.basicConfig(level=logging.DEBUG, format="[%(asctime)s] %(message)s") |
15 | | - |
16 | | -chords = iso.PSequence([ [0, 2, 4], [1, 3, 5], [2, 4, 6], [3, 5, 7], [4, 6, 8] ], 1) |
17 | | -chords = iso.PSequence([0, 1, 2, 3], 1) |
| 15 | +key = iso.Key("C", "major") |
18 | 16 |
|
19 | 17 | filename = "output.mid" |
20 | 18 | output = MidiFileOut(filename) |
21 | 19 |
|
22 | | -timeline = iso.Timeline(120, output) |
| 20 | +timeline = iso.Timeline(iso.MAX_CLOCK_RATE, output_device=output) |
23 | 21 | timeline.sched({ |
24 | | - iso.EVENT_NOTE: chords, |
25 | | - iso.EVENT_DURATION: 0.25, |
26 | | - iso.EVENT_GATE: 1.0 |
| 22 | + iso.EVENT_NOTE: iso.PDegree(iso.PSequence([ 0, 1, 2, 4 ], 4), key), |
| 23 | + iso.EVENT_OCTAVE: 5, |
| 24 | + iso.EVENT_GATE: iso.PSequence([ 0.5, 1, 2, 1 ]), |
| 25 | + iso.EVENT_AMPLITUDE: iso.PSequence([ 100, 80, 60, 40], 4), |
| 26 | + iso.EVENT_DURATION: 1.0 |
27 | 27 | }) |
| 28 | +timeline.sched({ |
| 29 | + iso.EVENT_NOTE: iso.PDegree(iso.PSequence([ 7, 6, 4, 2 ], 4), key), |
| 30 | + iso.EVENT_OCTAVE: 6, |
| 31 | + iso.EVENT_GATE: 1, |
| 32 | + iso.EVENT_AMPLITUDE: iso.PSequence([ 80, 70, 60, 50], 4), |
| 33 | + iso.EVENT_DURATION: 1.0 |
| 34 | +}, delay=0.5) |
28 | 35 | timeline.run() |
29 | 36 | output.write() |
30 | 37 |
|
|
0 commit comments