Initial attempt at timestretching implementation.
[calfbox.git] / sampler_api_example.py
blobbd099593f53181d87dd4bbdf60e2a6a657d05186
1 import os
2 import sys
3 import struct
4 import time
5 import unittest
7 sys.path = ["./py"] + sys.path
9 import cbox
11 global Document
12 Document = cbox.Document
14 scene = Document.get_scene()
15 scene.clear()
16 instrument = scene.add_new_instrument_layer("test_sampler", "sampler").get_instrument()
18 npfs = instrument.engine.load_patch_from_string(0, '.', '', 'new_patch')
19 instrument.engine.set_patch(1, 0)
21 g1 = npfs.new_group()
22 g1.set_param("cutoff", "100")
23 g1.set_param("resonance", "6")
24 g1.set_param("fil_type", "lpf_4p")
25 g1.set_param("fileg_decay", "0.2")
26 g1.set_param("fileg_sustain", "10")
27 g1.set_param("fileg_depth", "5400")
28 g1.set_param("fileg_release", "10")
29 g1.set_param("ampeg_release", "0.1")
30 g1.set_param("amp_veltrack", "0")
31 g1.set_param("volume", "-12")
32 g1.set_param("fileg_depthcc14", "-5400")
34 r1 = g1.new_region()
35 r1.set_param("sample", "*saw")
36 r1.set_param("transpose", "0")
37 r1.set_param("tune", "5")
38 r1.set_param("gain_cc17", "12")
40 r2 = g1.new_region()
41 r2.set_param("sample", "*sqr")
42 r2.set_param("transpose", "12")
43 r2.set_param("gain_cc17", "-12")
45 print(instrument.engine.status())
47 print("Ready!")
49 while True:
50 cbox.call_on_idle()