7 sys
.path
= ["./py"] + sys
.path
13 Document
= cbox
.Document
14 Transport
= cbox
.Transport
16 song
= Document
.get_song()
18 # Delete all the tracks and patterns
21 # Create a binary blob that contains the MIDI events
23 for noteindex
in range(20):
25 pblob
+= cbox
.Pattern
.serialize_event(noteindex
* 12, 0x90, 36+noteindex
*3, 127)
27 pblob
+= cbox
.Pattern
.serialize_event(noteindex
* 12 + 11, 0x90, 36+noteindex
*3, 0)
29 # This will be the length of the pattern (in pulses). It should be large enough
30 # to fit all the events
31 pattern_len
= 10 * 24 * 2
33 # Create a new pattern object using events from the blob
34 pattern
= song
.pattern_from_blob(pblob
, pattern_len
)
40 print ("Triggering adhoc pattern with ID 1")
41 Document
.get_scene().play_pattern(pattern
, 240, 1)
43 # Query JACK ports, new USB devices etc.