-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLaunchduino_Pro
More file actions
1064 lines (776 loc) · 22.5 KB
/
Launchduino_Pro
File metadata and controls
1064 lines (776 loc) · 22.5 KB
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* vim: set filetype=c++:
*******************************************************************************
* Launchduino Pro
* Use Arduino Uno (or Mega) and the USB Host Shield to transform your Novation Launchpad S into a stand-alone instrument (no need for a computer).
* Copyright 2015 Mauricio Maisterrena, Project at https://github.com/mmaisterrena/Launchdino_Pro
*
* Requirements:
* -Hardware:
* Arduino Uno or Mega
* Arduino USB Host Shields from Circuitsathome.com (or replica)
*
* -SoftWare:
* Arduino MIDI library
* http://playground.arduino.cc/Main/MIDILibrary
*
* for use with USB Host Shield 2.0 from Circuitsathome.com
* https://github.com/felis/USB_Host_Shield_2.0
*
* Yuuichi Akagawa's USB MIDI library
* https://github.com/YuuichiAkagawa/USBH_MIDI
*
---------Cheat Sheat--------------------
(1) (2) (3) (4) (5) (6) (7) (8) _
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] ( 9) |
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] (10) |
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] (11) | Scale Selection
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] (12) |
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] (13)_|
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] (14)<- Drum Pads
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] (15)
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] (16)
*Horizontal of circle pads
1. Octave Up.
2. Octave Down.
3. Root Note Previous Note (of the chromatic scale).
4. Root Note Next Note(of the chromatic scale).
5. Midi Channel 10
6. Midi Channel 11
7. Midi Channel 12
8. Midi Panic (Turn off all sounding notes)
*Horizontal of circle pads
*Scale Selection
9. Mayor
10. Minor
11. Flamenco
12. Blues
13. Chromatic
14 Drum Pads (Midi Channel 16)
*******************************************************************************
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*******************************************************************************
*/
//////////////////////////
// MIDI Pin assign
// 2 : GND
// 4 : +5V(Vcc) with 220ohm
// 5 : TX
//////////////////////////
#include <MIDI.h>
#include <usbh_midi.h>
#include <usbhub.h>
// ----------------------------------------------------------------------------------------------
/*
Effects:
1. Volca Sample Channel Redirect
2. Octaver
3. Power Chord
*/
int vVolcaChan=16;
//Lauchpad variables (Defaults)
int vRoot = 0; // C by default
int nScale = 2; //Natural Minor by default
int vOctave = 0;
int vOctaveN = 0;
int vDinChan = 12; //Sends MIDI on channel 12 by default
int uScale = nScale;
int OldScale = nScale;
//Selectable Channels
int vDinChan1 = 10;
int vDinChan2 = 11;
int vDinChan3 = 12;
//Note that will change the effect and which midi channel to listen
int vNoteConfig1=36;
int vNoteConfig2=37;
int vNoteConfig3=38;
int vChannelConfig=13;
//This represent the notes (Keys) that will be triggering each sample, you can chenge this to whatever note you want to use to trigger each sample.
int sNote1=60;
int sNote2=61;
int sNote3=62;
int sNote4=63;
int sNote5=64;
int sNote6=65;
int sNote7=66;
int sNote8=67;
int sNote9=68;
int sNote10=69;
//------------------------------------------------------------------------------------------------------------------------------------------
// Satisfy the IDE, which needs to see the include statment in the ino too.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#include <SPI.h>
#endif
#ifdef MIDI_CREATE_DEFAULT_INSTANCE
MIDI_CREATE_DEFAULT_INSTANCE();
#endif
#ifdef USBCON
#define _MIDI_SERIAL_PORT Serial1
#else
#define _MIDI_SERIAL_PORT Serial
#endif
//--------------------------------------------------------------------------------------------------------------------------------------------
USB Usb;
USBH_MIDI Midi(&Usb);
void MIDI_poll();
void doDelay(unsigned long t1, unsigned long t2, unsigned long delayTime);
void setup()
{
pinMode(13, OUTPUT);
MIDI.turnThruOff();
// Initiate MIDI communications, listen to all channels
MIDI.begin(MIDI_CHANNEL_OMNI);
//Workaround for non UHS2.0 Shield
pinMode(7,OUTPUT);
digitalWrite(7,HIGH);
if (Usb.Init() == -1) {
while(1); //halt
}//if (Usb.Init() == -1...
delay( 200 );
}
void loop()
{
MIDI.turnThruOff();
unsigned long t1;
uint8_t msg[4];
Usb.Task();
t1 = micros();
if( Usb.getUsbTaskState() == USB_STATE_RUNNING )
{
MIDI_poll();/////////////////////////////////////////////////////////////////////////////<<<<------------
MIDI.read();
}
doDelay(t1, micros(), 1000);
}
//Scales
const int vMayor[] = {
96 , 98 , 100 , 101 , 103 , 105 , 107 , 108 ,
91 , 93 , 95 , 96 , 98 , 100 , 101 , 103 ,
86 , 88 , 89 , 91 , 93 , 95 , 96 , 98 ,
81 , 83 , 84 , 86 , 88 , 89 , 91 , 93 ,
76 , 77 , 79 , 81 , 83 , 84 , 86 , 88 ,
71 , 72 , 74 , 76 , 77 , 79 , 81 , 83 ,
65 , 67 , 69 , 71 , 72 , 74 , 76 , 77 ,
60 , 62 , 64 , 65 , 67 , 69 , 71 , 72
};
const int vAeolian[] = { //Natural minor
96 , 98 , 99 , 101 , 103 , 104 , 106 , 108 ,
91 , 92 , 94 , 96 , 98 , 99 , 101 , 103 ,
86 , 87 , 89 , 91 , 92 , 94 , 96 , 98 ,
80 , 82 , 84 , 86 , 87 , 89 , 91 , 92 ,
75 , 77 , 79 , 80 , 82 , 84 , 86 , 87 ,
70 , 72 , 74 , 75 , 77 , 79 , 80 , 82 ,
65 , 67 , 68 , 70 , 72 , 74 , 75 , 77 ,
60 , 62 , 63 , 65 , 67 , 68 , 70 , 72
};
const int vFlamenca[] = {
96 , 97 , 100 , 101 , 103 , 104 , 106 , 108 ,
91 , 92 , 94 , 96 , 97 , 100 , 101 , 103 ,
85 , 88 , 89 , 91 , 92 , 94 , 96 , 97 ,
80 , 82 , 84 , 85 , 88 , 89 , 91 , 92 ,
76 , 77 , 79 , 80 , 82 , 84 , 85 , 88 ,
70 , 72 , 73 , 76 , 77 , 79 , 80 , 82 ,
65 , 67 , 68 , 70 , 72 , 73 , 76 , 77 ,
60 , 61 , 64 , 65 , 67 , 68 , 70 , 72
};
const int vBlues[] = {
96 , 99 , 101 , 102 , 103 , 106 , 107 , 108 ,
91 , 94 , 95 , 96 , 99 , 101 , 102 , 103 ,
87 , 89 , 90 , 91 , 94 , 95 , 96 , 99 ,
82 , 83 , 84 , 87 , 89 , 90 , 91 , 94 ,
77 , 78 , 79 , 82 , 83 , 84 , 87 , 89 ,
71 , 72 , 75 , 77 , 78 , 79 , 82 , 83 ,
66 , 67 , 70 , 71 , 72 , 75 , 77 , 78 ,
60 , 63 , 65 , 66 , 67 , 70 , 71 , 72
};
const int vVertical[] = {8,24,40,56,72,88,104,120};
//-------------------------------------------------------
void LedsOff(){
uint8_t msg[4];
msg[0]=176;
msg[1]=0;
msg[2]=0;
Midi.SendData(msg, 0);
delay(1);
};
int vFirst=1;
void LPLeds(int nScale){
uint8_t msg[4];
if (nScale == 5){ //Chromatic Scale
LedsOff();
delay(1);
//-------------------Turn On-----------------------------
//Root Lights Chromatic
msg[0] = midi::NoteOn;
msg[2] = 127;
msg[1] = 112;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 103;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 82;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 52;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 22;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 1;
Midi.SendData(msg, 0);
delay(1);
//5ths Lights Chromatic
msg[2] = 100;
msg[1] = 98;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 68;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 38;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 119;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 17;
Midi.SendData(msg, 0);
delay(1);
//-------------------
//Stop all current note ons
}
else if (nScale == 6)
{
//Drum Pads (Volca Sample)
LedsOff();
msg[0] = midi::NoteOn;
msg[2] = 100;
msg[1] = 113;
Midi.SendData(msg, 0);
delay(1);
int i = 112;
while (i <116)
{
msg[1] = i;
Midi.SendData(msg, 0);
delay(1);
i++;
}
i = 96;
while (i <100)
{
msg[1] = i;
Midi.SendData(msg, 0);
delay(1);
i++;
}
msg[1] = 80;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 81;
Midi.SendData(msg, 0);
delay(1);
msg[2] = 127;
msg[1] = 82;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 83;
Midi.SendData(msg, 0);
delay(1);
}
else {
// 7 Tone Scale Lights
LedsOff();
//-------------------------Turn On------------------
msg[0] = midi::NoteOn;
msg[2] = 127;
msg[1] = 112;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 81;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 50;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 19;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 7;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 19;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 0;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 100;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 69;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 38;
Midi.SendData(msg, 0);
delay(1);
//5th Lights 7 Tone Scales
msg[2] = 100;
msg[1] = 97;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 66;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 35;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 4;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 16;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 85;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 54;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 116;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 23;
Midi.SendData(msg, 0);
delay(1);
}
// ---Config Buttons -------
//Scale Selection
msg[2] = 28;
msg[1] = 8;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 24;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 40;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 56;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 72;
Midi.SendData(msg, 0);
delay(1);
msg[2] = 127;
msg[1] = 88;
Midi.SendData(msg, 0);
delay(1);
//effects Button
msg[2] = 60;
msg[1] = 120;
Midi.SendData(msg, 0);
delay(1);
// Top Row of Circles
msg[0] = midi::ControlChange;
msg[2] = 127;
//Panic Button
msg[2] = 15;
msg[1] = 111;
Midi.SendData(msg, 0);
delay(1);
LedRoot(vRoot);
LedChan(vDinChan);
LedOctave(vOctaveN);
}
//-------------------------------------------------------
void LedRoot(int vRoot) {
//Effect Selection
uint8_t msg[4];
msg[0] = midi::ControlChange;
msg[2] = 13 + (vRoot * 10);
msg[1] = 106;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 107;
Midi.SendData(msg, 0);
delay(1);
}
//-------------------------------------------------------
const int vScaleButtons[] {8,24,40,56,72}; // Midi notes corresponding to right column of circle buttons.
void LedScale(int uScale,int OldScale){
uint8_t msg[4];
msg[0] = midi::NoteOn;
msg[2] = 28; //Green Color Led (Unselect Old Scale)
msg[1] = vScaleButtons[OldScale-1];
Midi.SendData(msg, 0);
delay(1);
msg[2] = 60; //Orange Color Led (Selected Scale)
msg[1] = vScaleButtons[uScale-1];
Midi.SendData(msg, 0);
delay(1);
}
void LedOctave(int vOctaveN){
uint8_t msg[4];
msg[0] = midi::ControlChange;
msg[2] = 60; //Green Color Led
msg[1] = 104;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 105;
Midi.SendData(msg, 0);
delay(1);
if (vOctaveN == 1){
msg[2] = 127;
msg[1] = 104;
Midi.SendData(msg, 0);
delay(1);
}
else if (vOctaveN == 2){
msg[2] = 15;
msg[1] = 104;
Midi.SendData(msg, 0);
delay(1);
}
else if (vOctaveN == -1){
msg[2] = 127;
msg[1] = 105;
Midi.SendData(msg, 0);
delay(1);
}
else if (vOctaveN == -2){
msg[2] = 15;
msg[1] = 105;
Midi.SendData(msg, 0);
delay(1);
}
}
void LedChan(int vDinChan) {
// Channel Selection
uint8_t msg[4];
msg[0] = midi::ControlChange;
msg[2] = 25; //Led Off
msg[1] = 108;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 109;
Midi.SendData(msg, 0);
delay(1);
msg[1] = 110;
Midi.SendData(msg, 0);
delay(1);
msg[2] = 63; //Orange Color Led
if (vDinChan == 10){
msg[1] = 108;
Midi.SendData(msg, 0);
delay(1);
}
else if (vDinChan == 11){
msg[1] = 109;
Midi.SendData(msg, 0);
delay(1);
}
else if (vDinChan == 12){
msg[1] = 110;
Midi.SendData(msg, 0);
delay(1);
}
}
//-------------------------------------------------------
void Panic(){
int i = 0;
while (i < 128){
MIDI.send(midi::NoteOff,i,0,vDinChan);
i++;
}
}
int vPad;
// ==========Poll USB MIDI Controler and send to serial MIDI==================
void MIDI_poll()
{
byte outBuf[ 3 ];
uint8_t size;
if( (size=Midi.RecvData(outBuf)) > 0 ){
uint8_t msg[4];
//Octave Selection
if (outBuf[ 1 ]==105 & vOctaveN > -2 & outBuf[ 2 ]==127)
{
vOctaveN = vOctaveN - 1;
LedOctave(vOctaveN);
}
if (outBuf[ 1 ]==104 & vOctaveN < 2 & outBuf[ 2 ]==127)
{
vOctaveN = vOctaveN + 1;
LedOctave(vOctaveN);
}
vOctave = vOctaveN * 12;
//Root Note Selection
if (outBuf[ 1 ]==106 & vRoot > 0 & outBuf[ 2 ]==127)
{
vRoot = vRoot - 1;
LPLeds(nScale);
LedRoot(vRoot);
}
if (outBuf[ 1 ]==107 & vRoot < 12 & outBuf[ 2 ]==127)
{
vRoot = vRoot + 1;
LPLeds(nScale);
LedRoot(vRoot);
}
if (nScale != 6){
OldScale = nScale;
}
//Select Scale
if (outBuf[ 1 ]==8 & outBuf[ 2 ]==127) {
nScale=1;
LPLeds(nScale);
LedScale(nScale,OldScale);
};
if (outBuf[ 1 ]==24 & outBuf[ 2 ]==127) {
nScale=2;
LPLeds(nScale);
LedScale(nScale,OldScale);
};
if (outBuf[ 1 ]==40 & outBuf[ 2 ]==127) {
nScale=3;
LPLeds(nScale);
LedScale(nScale,OldScale);
};
if (outBuf[ 1 ]==56 & outBuf[ 2 ]==127) {
nScale=4;
LPLeds(nScale);
LedScale(nScale,OldScale);
};
if (outBuf[ 1 ]==72 & outBuf[ 2 ]==127 ) {
nScale=5;
LPLeds(nScale);
LedScale(nScale,OldScale);
};
if (outBuf[ 1 ]==88 & outBuf[ 2 ]==127 ) { //Drums
nScale=6;
LPLeds(nScale);
LedScale(OldScale,OldScale);
};
if (nScale != 6){
uScale = nScale;
}
//Select Midi Channel
if (outBuf[ 1 ]==108 & outBuf[ 2 ]==127)
{
vDinChan = vDinChan1;
LedChan(vDinChan);
nScale = uScale;
LPLeds(nScale);
LedScale(nScale,OldScale);
};
if (outBuf[ 1 ]==109 & outBuf[ 2 ]==127)
{
vDinChan = vDinChan2;
LedChan(vDinChan);
nScale = uScale;
LPLeds(nScale);
LedScale(nScale,OldScale);
};
if (outBuf[ 1 ]==110 & outBuf[ 2 ]==127)
{
vDinChan = vDinChan3;
LedChan(vDinChan);
nScale = uScale;
LPLeds(nScale);
LedScale(nScale,OldScale);
};
//Panic
if (outBuf[ 1 ]==111 & outBuf[ 2 ]==127)
{
Panic();
};
int vNoteAdjust = vRoot + vOctave - 24;
if (nScale == 1){ //Mayor
if (outBuf[ 1 ]>111 & outBuf[ 1 ]<120 ){
vPad = outBuf[ 1 ] - 56;
MIDI.send(midi::NoteOn, vMayor[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>95 & outBuf[ 1 ]<104){
vPad = outBuf[ 1 ] - 48;
MIDI.send(midi::NoteOn, vMayor[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>79 & outBuf[ 1 ]<88){
vPad = outBuf[ 1 ] - 40;
MIDI.send(midi::NoteOn, vMayor[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>63 & outBuf[ 1 ]<72){
vPad = outBuf[ 1 ] - 32;
MIDI.send(midi::NoteOn, vMayor[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>47 & outBuf[ 1 ]<56){
vPad = outBuf[ 1 ] - 24;
MIDI.send(midi::NoteOn, vMayor[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>31 & outBuf[ 1 ]<40){
vPad = outBuf[ 1 ] - 16;
MIDI.send(midi::NoteOn, vMayor[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>15 & outBuf[ 1 ]<24){
vPad = outBuf[ 1 ] - 8;
MIDI.send(midi::NoteOn, vMayor[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>=0 & outBuf[ 1 ]<8){
vPad = outBuf[ 1 ] - 0;
MIDI.send(midi::NoteOn, vMayor[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
}
else if (nScale == 2){ //Natural Minor
if (outBuf[ 1 ]>111 & outBuf[ 1 ]<120){
vPad = outBuf[ 1 ] - 56;
MIDI.send(midi::NoteOn, vAeolian[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>95 & outBuf[ 1 ]<104){
vPad = outBuf[ 1 ] - 48;
MIDI.send(midi::NoteOn, vAeolian[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>79 & outBuf[ 1 ]<88){
vPad = outBuf[ 1 ] - 40;
MIDI.send(midi::NoteOn,vAeolian[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>63 & outBuf[ 1 ]<72){
vPad = outBuf[ 1 ] - 32;
MIDI.send(midi::NoteOn, vAeolian[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>47 & outBuf[ 1 ]<56){
vPad = outBuf[ 1 ] - 24;
MIDI.send(midi::NoteOn,vAeolian[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>31 & outBuf[ 1 ]<40){
vPad = outBuf[ 1 ] - 16;
MIDI.send(midi::NoteOn, vAeolian[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>15 & outBuf[ 1 ]<24){
vPad = outBuf[ 1 ] - 8;
MIDI.send(midi::NoteOn,vAeolian[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>=0 & outBuf[ 1 ]<8){
vPad = outBuf[ 1 ] - 0;
MIDI.send(midi::NoteOn, vAeolian[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
}
else if (nScale == 3){ //Flamenca
if (outBuf[ 1 ]>111 & outBuf[ 1 ]<120){
vPad = outBuf[ 1 ] - 56;
MIDI.send(midi::NoteOn, vFlamenca[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>95 & outBuf[ 1 ]<104){
vPad = outBuf[ 1 ] - 48;
MIDI.send(midi::NoteOn, vFlamenca[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>79 & outBuf[ 1 ]<88){
vPad = outBuf[ 1 ] - 40;
MIDI.send(midi::NoteOn,vFlamenca[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>63 & outBuf[ 1 ]<72){
vPad = outBuf[ 1 ] - 32;
MIDI.send(midi::NoteOn, vFlamenca[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>47 & outBuf[ 1 ]<56){
vPad = outBuf[ 1 ] - 24;
MIDI.send(midi::NoteOn,vFlamenca[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>31 & outBuf[ 1 ]<40){
vPad = outBuf[ 1 ] - 16;
MIDI.send(midi::NoteOn, vFlamenca[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>15 & outBuf[ 1 ]<24){
vPad = outBuf[ 1 ] - 8;
MIDI.send(midi::NoteOn,vFlamenca[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>=0 & outBuf[ 1 ]<8){
vPad = outBuf[ 1 ] - 0;
MIDI.send(midi::NoteOn, vFlamenca[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
}
else if (nScale == 4){ //Blues
if (outBuf[ 1 ]>111 & outBuf[ 1 ]<120){
vPad = outBuf[ 1 ] - 56;
MIDI.send(midi::NoteOn, vBlues[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>95 & outBuf[ 1 ]<104){
vPad = outBuf[ 1 ] - 48;
MIDI.send(midi::NoteOn, vBlues[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>79 & outBuf[ 1 ]<88){
vPad = outBuf[ 1 ] - 40;
MIDI.send(midi::NoteOn,vBlues[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>63 & outBuf[ 1 ]<72){
vPad = outBuf[ 1 ] - 32;
MIDI.send(midi::NoteOn, vBlues[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>47 & outBuf[ 1 ]<56){
vPad = outBuf[ 1 ] - 24;
MIDI.send(midi::NoteOn,vBlues[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>31 & outBuf[ 1 ]<40){
vPad = outBuf[ 1 ] - 16;
MIDI.send(midi::NoteOn, vBlues[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>15 & outBuf[ 1 ]<24){
vPad = outBuf[ 1 ] - 8;
MIDI.send(midi::NoteOn,vBlues[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
else if (outBuf[ 1 ]>=0 & outBuf[ 1 ]<8){
vPad = outBuf[ 1 ] - 0;
MIDI.send(midi::NoteOn, vBlues[vPad] + vNoteAdjust, outBuf[ 2 ], vDinChan);}
}
//Chromatic Scale......
else if (nScale == 5){
if (outBuf[ 1 ]>111 & outBuf[ 1 ]<120)
{
MIDI.send(midi::NoteOn,outBuf[ 1 ]-76 + vRoot + vOctave,outBuf[ 2 ],vDinChan);
}
else if (outBuf[ 1 ]>95 & outBuf[ 1 ]<104)
{
MIDI.send(midi::NoteOn,outBuf[ 1 ]-55 + vRoot + vOctave,outBuf[ 2 ],vDinChan);
}
else if (outBuf[ 1 ]>79 & outBuf[ 1 ]<88)
{
MIDI.send(midi::NoteOn,outBuf[ 1 ]-34 + vRoot + vOctave,outBuf[ 2 ],vDinChan);
}
else if (outBuf[ 1 ]>63 & outBuf[ 1 ]<72)
{
MIDI.send(midi::NoteOn,outBuf[ 1 ]-13 + vRoot + vOctave,outBuf[ 2 ],vDinChan);
}
else if (outBuf[ 1 ]>47 & outBuf[ 1 ]<56)
{
MIDI.send(midi::NoteOn,outBuf[ 1 ]+8 + vRoot + vOctave,outBuf[ 2 ],vDinChan);
}
else if (outBuf[ 1 ]>31 & outBuf[ 1 ]<40)
{
MIDI.send(midi::NoteOn,outBuf[ 1 ]+29 + vRoot + vOctave,outBuf[ 2 ],vDinChan);