1 from calfbox
import cbox
3 def cmd_dumper(cmd
, fb
, args
):
4 print ("%s(%s)" % (cmd
, ",".join(list(map(repr,args
)))))
8 cbox
.Config
.add_section("drumpattern:pat1", """
19 bd_trigger=9... .... 9.6. ....
20 sd_trigger=.... 9..5 .2.. 9...
21 hh_trigger=9353 7353 7353 73.3
22 ho_trigger=.... .... .... ..3.
25 cbox
.Config
.set("io", "use_usb", 1)
26 cbox
.start_audio(cmd_dumper
)
29 Document
= cbox
.Document
31 status
= cbox
.JackIO
.status()
32 client_name
= status
.client_name
33 print ("Client type: %s" % status
.client_type
)
34 print ("Client name: %s" % client_name
)
35 print ("Audio inputs: %d, outputs: %d" % (status
.audio_inputs
, status
.audio_outputs
))
36 print ("Period: %d frames" % (status
.buffer_size
))
37 print ("Sample rate: %d frames/sec" % (status
.sample_rate
))
38 print ("Output resolution: %d bits/sample" % (status
.output_resolution
))
39 print ("MIDI input devices: %s" % (status
.midi_input
))
40 #cbox.JackIO.create_midi_output('drums', 'system:midi_playback_1')
42 scene
= Document
.get_scene()
44 instrument
= scene
.add_new_instrument_layer("test_sampler", "sampler").get_instrument()
45 pgm_no
= instrument
.engine
.get_unused_program()
46 pgm
= instrument
.engine
.load_patch_from_file(pgm_no
, 'synthbass.sfz', 'SynthBass')
47 instrument
.engine
.set_patch(1, pgm_no
)
48 instrument
.engine
.set_patch(10, pgm_no
)
50 song
= Document
.get_song()
51 track
= song
.add_track()
52 pattern
= song
.load_drum_pattern("pat1")
53 track
.add_clip(0, 0, pattern
.status().loop_end
, pattern
)
54 song
.set_loop(0, pattern
.status().loop_end
)
55 song
.update_playback()
61 cbox
.call_on_idle(cmd_dumper
)