-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtest.py
executable file
·370 lines (308 loc) · 10.2 KB
/
test.py
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
#!/usr/bin/python
# hirsch@z87:~$ aconnect -o
# client 14: 'Midi Through' [type=kernel]
# 0 'Midi Through Port-0'
# client 128: 'RtMidi Input Client' [type=user]
# 0 'TestPort '
#
# Given the above, open RtMidi as: 'RtMidi Input Client 128:0'
from time import sleep
import sys
import itertools as it
import mido
mido.set_backend('mido.backends.rtmidi')
pc = mido.Message('program_change')
cc = mido.Message('control_change')
# 1 == v1, 2 == v2
type = 0
def analog_send( outport, sleeptime=0.25 ):
for value in [ 0, 32, 64, 96, 127, 0 ]:
cc.value = value
outport.send( cc )
sleep( sleeptime )
def discrete_send( outport, max ):
for value in it.chain( range(0,max+1), range(0,1) ):
cc.value = value
outport.send( cc )
sleep( 0.25 )
# Screen 1 is the same for all models
def amp_screen1( outport ):
for i in range( 69, 74 ):
cc.control = i
analog_send( outport )
# Some variation in screen 2 across models
def amp_screen2( outport, template ):
limit = len(template)
i = 74
j = 5
while j < limit:
cc.control = i
i += 1
if template[j] == "A":
analog_send( outport )
elif template[j] == "D":
j += 1
count = int( template[j:j+2] )
j += 1
discrete_send( outport, count )
elif template[j] == "-":
pass
j += 1
# Step through all amp models
def amp_select( outport ):
if type == 2:
max = 18
else:
max = 13
cc.control = 68
for i in range( 0, max ):
cc.value = i
outport.send( cc )
sleep( 0.5 )
def run_amp_test( struct, outport ):
raw_input( "Hit ENTER to run amp model select test...\n" )
amp_select( outport )
for i in range( 0, len(struct) ):
control_rec = struct[i]
if control_rec[3] and type != 2:
continue
raw_input( "Hit ENTER to run parm edit check for %s\n" % control_rec[0] )
cc.control = 68
cc.value = control_rec[1]
outport.send( cc )
raw_input( "Enter amp edit mode on Mustang and hit ENTER to proceed...\n" )
amp_screen1( outport )
raw_input( "Step to amp edit screen 2 and hit ENTER...\n" )
amp_screen2( outport, control_rec[2] )
# Step through all reverb models
def reverb_select( outport ):
cc.control = 58
for i in range( 0, 11 ):
cc.value = i
outport.send( cc )
sleep( 0.5 )
def run_reverb_test( outport ):
raw_input( "Hit ENTER to run reverb model select test...\n" )
reverb_select( outport )
raw_input( "Enter Reverb edit mode and hit ENTER...\n" )
for i in range ( 59, 64 ):
cc.control = i
analog_send( outport )
sleep( 0.25 )
# Step through all delay models
def delay_select( outport ):
cc.control = 48
for i in range( 0, 10 ):
cc.value = i
outport.send( cc )
sleep( 0.5 )
def run_delay_test( struct, outport ):
raw_input( "Hit ENTER to run delay model select test...\n" )
delay_select( outport )
for i in range( 0, len(struct) ):
control_rec = struct[i]
# Skip if not a V2 amp
if control_rec[3] and type != 2:
continue
raw_input( "Hit ENTER to run parm edit check for %s\n" % control_rec[0] )
cc.control = 48
cc.value = control_rec[1]
outport.send( cc )
raw_input( "Enter delay edit mode on Mustang and hit ENTER to proceed...\n" )
limit = len(control_rec[2])
template = control_rec[2]
i = 49
j = 0
while j < limit:
cc.control = i
i += 1
if template[j] == "A":
analog_send( outport )
elif template[j] == "D":
j += 1
count = int( template[j:j+2] )
j += 1
discrete_send( outport, count )
j += 1
# Step through all mod models
def mod_select( outport ):
if type == 2:
max = 15
else:
max = 12
cc.control = 38
for i in range( 0, max ):
cc.value = i
outport.send( cc )
sleep( 0.5 )
def run_mod_test( struct, outport ):
raw_input( "Hit ENTER to run mod model select test...\n" )
mod_select( outport )
for i in range( 0, len(struct) ):
control_rec = struct[i]
if control_rec[3] and type != 2:
continue
raw_input( "Hit ENTER to run parm edit check for %s\n" % control_rec[0] )
cc.control = 38
cc.value = control_rec[1]
outport.send( cc )
raw_input( "Enter mod edit mode on Mustang and hit ENTER to proceed...\n" )
limit = len(control_rec[2])
template = control_rec[2]
i = 39
j = 0
while j < limit:
cc.control = i
i += 1
if template[j] == "A":
analog_send( outport )
elif template[j] == "D":
j += 1
count = int( template[j:j+2] )
j += 1
discrete_send( outport, count )
j += 1
# Step through all stomp models
def stomp_select( outport ):
if type == 2:
max = 13
else:
max = 8
cc.control = 28
for i in range( 0, max ):
cc.value = i
outport.send( cc )
sleep( 0.5 )
def run_stomp_test( struct, outport ):
raw_input( "Hit ENTER to run stomp model select test...\n" )
stomp_select( outport )
for i in range( 0, len(struct) ):
control_rec = struct[i]
if control_rec[3] and type != 2:
continue
raw_input( "Hit ENTER to run parm edit check for %s\n" % control_rec[0] )
cc.control = 28
cc.value = control_rec[1]
outport.send( cc )
raw_input( "Enter stomp edit mode on Mustang and hit ENTER to proceed...\n" )
limit = len(control_rec[2])
template = control_rec[2]
i = 29
j = 0
while j < limit:
cc.control = i
i += 1
if template[j] == "A":
analog_send( outport )
elif template[j] == "D":
j += 1
count = int( template[j:j+2] )
j += 1
discrete_send( outport, count )
j += 1
# Step through program changes
def program_change_test( outport ):
raw_input( "Hit ENTER to run program change test...\n" )
for i in ( 0, 25, 75, 99, 60, 40, 20, 0 ):
pc.program = i
outport.send( pc )
sleep( 0.5 )
def tuner_test( outport ):
raw_input( "Hit ENTER to select tuner...\n" )
cc.control = 20
cc.value = 127
outport.send( cc )
raw_input( "Hit ENTER to deselect tuner...\n" )
cc.value = 0
outport.send( cc )
def bypass_test( outport ):
raw_input( "Hit ENTER to select all effects...\n" )
cc.control = 22
cc.value = 127
outport.send( cc )
raw_input( "Hit ENTER to bypass all effects...\n" )
cc.value = 0
outport.send( cc )
###################### main ########################
args = sys.argv
if len(args) < 4:
print "Usage: test.py <controller_port> <midi_channel> <v1|v2> [test_name]\n"
print " Pass test name in {pc, tuner, efxbypass, stomp, mod, reverb, delay, amp} for single test\n"
print " Default is to run all of them if no arg 4 passed\n"
sys.exit( 1 )
try:
pc.channel = cc.channel = int( args[2] ) - 1
except ValueError:
print "Arg2 must be numeric!\n"
sys.exit( 1 )
if args[3] == "v1":
type = 1
elif args[3] == "v2":
type = 2
else:
print "Arg 3 must be 'v1' or 'v2'"
sys.exit( 1 )
single = "all"
if len(args) == 5:
single = args[4]
outport = mido.open_output( args[1] )
if single == "all" or single == "pc":
program_change_test( outport )
if single == "all" or single == "tuner":
tuner_test( outport )
if single == "all" or single == "efxbypass":
bypass_test( outport )
if single == "all" or single == "stomp":
# Model Ctrl v2only
stomp_test = (
( "Ranger Boost", 8, "AAAA", True ),
( "Green Box", 9, "AAAA", True ),
( "Orange Box", 10, "AAA", True ),
( "Black Box", 11, "AAA", True ),
( "Big Fuzz", 12, "AAA", True ),
( "Overdrive", 1, "AAAAA", False ),
( "Wah", 2, "AAAAD01", False ),
( "Simple Comp", 6, "D03", False ),
( "Comp", 7, "AAAAA", False )
)
run_stomp_test( stomp_test, outport )
if single == "all" or single == "mod":
# Model Ctrl v2only
mod_test = (
( "Wah", 12, "AAAAD01", True ),
( "Touch Wah", 13, "AAAAD01", True ),
( "Dia Shift", 14, "AD21D11D08A", True ),
( "Sine Chorus", 1, "AAAAA", False ),
( "Vibratone", 5, "AAAAA", False ),
( "Vintage Trem", 6, "AAAAA", False ),
( "Ring Mod", 8, "AAAD01A", False ),
( "Phaser", 10, "AAAAD01", False ),
( "Pitch Shift", 11, "AAAAA", False )
)
run_mod_test( mod_test, outport )
if single == "all" or single == "reverb":
run_reverb_test( outport )
if single == "all" or single == "delay":
# Model Ctrl v2only
delay_test = (
( "Mono Delay", 1, "AAAAA", False ),
( "Mono Echo Filter", 2, "AAAAAA", False ),
( "Stereo Echo Filter", 3, "AAAAAA", False ),
( "Multitap", 4, "AAAAD03", False ),
( "Tape Delay", 8, "AAAAAA", False ),
( "Stereo Tape Delay", 9, "AAAAAA", False )
)
run_delay_test( delay_test, outport )
if single == "all" or single == "amp":
# Model, Ctrl v2only
amp_test = (
( "Studio Preamp", 13, "AAAAA--D04D12", True ),
# Test custom noise gate and bright switch
( "Fender 65 Twin", 6, "AAAAAD02AD04D12--D09AD01", False ),
( "Fender SuperSonic", 7, "AAAAAD02AD04D12AA", False ),
( "British 60s", 8, "AAAAAD02AD04D12AA", False ),
( "British 70s", 9, "AAAAAD02AD04D12AA", False ),
( "British 80s", 10, "AAAAAD02AD04D12AA", False )
)
run_amp_test( amp_test, outport )
print "All tests complete\n"