File: scripting_reference.txt

package info (click to toggle)
bespokesynth 1.3.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 44,592 kB
  • sloc: cpp: 117,136; ansic: 18,752; python: 593; xml: 74; makefile: 4
file content (218 lines) | stat: -rw-r--r-- 6,870 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
the script module takes python code as input. any python code and imports should work fine.
this document describes the specific calls you get from bespoke and can make into bespoke.

if you have jedi installed, python autocomplete is supported.
the typical way to install jedi on your system is to enter 'pip install jedi' into your system's terminal.

script module inputs:
   on_pulse(): called by pulse input
   on_note(pitch, velocity): called by note input
   on_grid_button(col, row, velocity): called by grid input
   on_osc(message): called by external osc source, after registering with me.connect_osc_input(port)
   on_midi(messageType, control, value, channel): called by midicontroller, after registering with add_script_listener(me.me())


globals:
   bespoke.get_measure_time()
   bespoke.get_measure()
   bespoke.reset_transport()
   bespoke.get_step(subdivision)
   bespoke.count_per_measure(subdivision)
   bespoke.time_until_subdivision(subdivision)
      example: me.schedule_call(bespoke.time_until_subdivision(1), "on_downbeat()")
   bespoke.get_time_sig_ratio()
   bespoke.get_root()
   bespoke.get_scale()
   bespoke.get_scale_range(octave, count)
   bespoke.tone_to_pitch(index)
   bespoke.name_to_pitch(noteName)
   bespoke.pitch_to_name(pitch)
   bespoke.pitch_to_freq(pitch)
   bespoke.get_tempo()
   bespoke.set_background_text(str, size, xPos, yPos, red, green, blue)
      optional: size=50, xPos = 150, yPos = 250, red = 1, green = 1, blue = 1
   bespoke.random(seed, index)
   bespoke.get_modules()


script-relative:
   me.play_note(pitch, velocity, length, pan, output_index)
      optional: length=1.0/16.0, pan = 0, output_index = 0
      example: me.play_note(60, 127, 1.0/8)
   me.schedule_note(delay, pitch, velocity, length, pan, output_index)
      optional: length=1.0/16.0, pan = 0, output_index = 0
      example: me.schedule_note(1.0/4, 60, 127, 1.0/8)
   me.schedule_note_msg(delay, pitch, velocity, pan, output_index)
      optional: pan = 0, output_index = 0
   me.schedule_call(delay, method)
      example: me.schedule_call(1.0/4, "dotask()")
   me.note_msg(pitch, velocity, pan, output_index)
      optional: pan = 0, output_index = 0
   me.set(path, value)
      example: me.set("oscillator~pw", .2)
   me.schedule_set(delay, path, value)
   me.get(path)
      example: pulsewidth = me.get("oscillator~pulsewidth")
   me.adjust(path, amount)
   me.highlight_line(lineNum, scriptModuleIndex)
   me.output(obj)
      example: me.output("hello world!")
   me.me()
   me.stop()
   me.get_caller()
      example: me.get_caller().play_note(60,127)
   me.set_num_note_outputs(num)
   me.connect_osc_input(port)
   me.send_cc(control, value, output_index)
      optional: output_index = 0


import notesequencer
   static:
      notesequencer.get(path)
   instance:
      n.set_step(step, row, velocity, length)
         optional: velocity = 127, length = 1.0
      n.set_pitch(step, pitch, velocity, length)
         optional: velocity = 127, length = 1.0


import drumsequencer
   static:
      drumsequencer.get(path)
   instance:
      d.set(step, pitch, velocity)
      d.get(step, pitch)


import grid
   static:
      grid.get(path)
         example: g = grid.get("grid")  #assuming there's a grid called "grid" somewhere in the layout
   instance:
      g.set(col, row, value)
      g.get(col, row)
      g.set_grid(cols, rows)
      g.set_label(row, label)
      g.set_color(colorIndex, r, g, b)
      g.highlight_cell(col, row, delay, duration, colorIndex)
         optional: colorIndex=1
      g.set_division(division)
      g.set_momentary(momentary)
      g.set_cell_color(col, row, colorIndex)
      g.get_cell_color(col, row)
      g.add_listener(script)
      g.clear()


import notecanvas
   static:
      notecanvas.get(path)
   instance:
      n.add_note(measurePos, pitch, velocity, length)
      n.clear()
      n.fit()


import sampleplayer
   static:
      sampleplayer.get(path)
   instance:
      s.set_cue_point(pitch, startSeconds, lengthSeconds, speed)
      s.fill(data)
      s.play_cue(cue, speedMult, startOffsetSeconds)
         optional: speedMult = 1, startOffsetSeconds = 0
      s.get_length_seconds()


import midicontroller
   static:
      midicontroller.get(path)
   instance:
      m.set_connection(messageType, control, controlPath, controlType, value, channel, page, midi_off, midi_on, scale, blink, increment, twoway, feedbackControl, isPageless)
         optional: controlType = Default, value = 0, channel = -1, page=0, midi_off=0, midi_on = 127, scale = false, blink = false, increment = 0, twoway = true, feedbackControl = -1, isPageless = false
         example: m.set_connection(m.Control, 32, "oscillator~pw"), or m.set_connection(m.Note, 10, "oscillator~osc", m.SetValue, 2)
      m.send_note(pitch, velocity, forceNoteOn, channel, page)
         optional: forceNoteOn = false, channel = -1, page = 0
      m.send_cc(ctl, value, channel, page)
         optional: channel = -1, page = 0
      m.send_program_change(program, channel, page)
         optional: channel = -1, page = 0
      m.send_pitchbend(bend, channel, page)
         optional: channel = -1, page = 0
      m.send_data(a, b, c, page)
         optional: page = 0
      m.send_sysex(data, page)
         optional: page = 0
         description: Sends a system exclusive message. The given data will be wrapped with header and tail bytes of 0xf0 and 0xf7. The example enables Programmer-Mode on a Launchpad X. 
         example: m.send_sysex(bytes([0, 32, 41, 2, 12, 14, 1]) 
      m.add_script_listener(script)
      m.resync_controller_state()


import linnstrument
   static:
      linnstrument.get(path)
   instance:
      l.set_color(x, y, color)


import osccontroller
   static:
      osccontroller.get(path)
   instance:
      o.add_control(address, isFloat)


import oscoutput
   static:
      oscoutput.get(path)
   instance:
      o.send_float(address, val)
      o.send_int(address, val)
      o.send_string(address, val)


import envelope
   static:
      envelope.get(path)
   instance:
      e.start(stages)
      e.schedule(delay, stages)


import drumplayer
   static:
      drumplayer.get(path)
   instance:
      d.import_sampleplayer_cue(samplePlayer, srcCueIndex, destHitIndex)


import vstplugin
   static:
      vstplugin.get(path)
   instance:
      v.send_cc(ctl, value, channel)
      v.send_program_change(program, channel)
      v.send_data(a, b, c)


import module
   static:
      module.get(path)
      module.create(moduleType, x, y)
   instance:
      m.set_position(x, y)
      m.get_position_x()
      m.get_position_y()
      m.get_width()
      m.get_height()
      m.set_target(target)
      m.set_target(targetPath)
      m.get_target()
      m.get_targets()
      m.set_name(name)
      m.delete()
      m.set(path, value)
      m.get(path)
      m.adjust(path, amount)