Devices & Components
Arduino Mega 2560 Rev3
Male Header 40 Position 1 Row (0.1")
Resistor 220 ohm
USB-A to B Cable
AWM Cable
Male/Male Jumper Wires
DIN Midi Plug
IDC Socket
Potentiometer, Slide
Hardware & Tools
Solder Wire, Lead Free
Wire Stripper, Serrated Plier Nose
Plier, Side Cutting
Soldering iron (generic)
Solder Flux, Soldering
Plier, Flat Nose
Software & Tools
Arduino IDE
Project description
Code
Bussed Keyboard Code
arduino
Code to upload to the Arduino if you are following the Bussed Keyboard Schematic.
1// Name: Arduino Mega Midi Controller 61x4 plus 3 potentiometers. 2// Version 1.0 3// Created: April 12, 2021 4// Author: Larason2 5// Acknowledgements: Bald Engineer, Amanda Ghassaei, jeffb42, GrumpyMike 6 7//Note Data 8 9byte keysA[11][6]; 10byte keysB[11][6]; 11byte keysC[11][6]; 12byte keysD[11][6]; 13 14//Last Key State 15 16byte lastA[11][6]; 17byte lastB[11][6]; 18byte lastC[11][6]; 19byte lastD[11][6]; 20 21//Midi Messages Sent 22 23int noteOn1 = 144; 24int noteOff1 = 128; 25int noteOn2 = 145; 26int noteOff2 = 129; 27int noteOn3 = 146; 28int noteOff3 = 130; 29int noteOn4 = 147; 30int noteOff4 = 131; 31int velocity = 100; 32int chan6 = 181; 33int chan7 = 182; 34int chan8 = 183; 35int Exp = 11; 36 37//Last Potentiometer State 38 39int LastPot6 = 1; 40int LastPot7 = 1; 41int LastPot8 = 1; 42 43void setup() { 44 // Start Serial at Midi rate 45 Serial.begin(31250); 46 47 //Initialize Pins 1-10 48 pinMode(2, INPUT); 49 pinMode(3, INPUT); 50 pinMode(4, INPUT); 51 pinMode(5, INPUT); 52 pinMode(6, INPUT); 53 pinMode(7, INPUT); 54 pinMode(8, INPUT); 55 pinMode(9, INPUT); 56 pinMode(10, INPUT); 57 pinMode(11, INPUT); 58 59 //Pins 11-20 60 61 pinMode(12, INPUT); 62 pinMode(13, INPUT); 63 pinMode(14, INPUT); 64 pinMode(15, INPUT); 65 pinMode(16, INPUT); 66 pinMode(17, INPUT); 67 pinMode(18, INPUT); 68 pinMode(19, INPUT); 69 pinMode(20, INPUT); 70 pinMode(21, INPUT); 71 72 //Pins 21-30 73 74 pinMode(22, INPUT); 75 pinMode(23, INPUT); 76 pinMode(24, INPUT); 77 pinMode(25, INPUT); 78 pinMode(26, INPUT); 79 pinMode(27, INPUT); 80 pinMode(28, INPUT); 81 pinMode(29, INPUT); 82 pinMode(30, INPUT); 83 pinMode(31, INPUT); 84 85 //Pins 31-40 86 87 pinMode(32, INPUT); 88 pinMode(33, INPUT); 89 pinMode(34, INPUT); 90 pinMode(35, INPUT); 91 pinMode(36, INPUT); 92 pinMode(37, INPUT); 93 pinMode(38, INPUT); 94 pinMode(39, INPUT); 95 pinMode(40, INPUT); 96 pinMode(41, INPUT); 97 98 //Pins 41-50 99 100 pinMode(42, INPUT); 101 pinMode(43, INPUT); 102 pinMode(44, INPUT); 103 pinMode(45, INPUT); 104 pinMode(46, INPUT); 105 pinMode(47, INPUT); 106 pinMode(48, INPUT); 107 pinMode(49, INPUT); 108 pinMode(50, INPUT); 109 pinMode(51, INPUT); 110 111 //Pins 51-61 112 113 pinMode(52, INPUT); 114 pinMode(53, INPUT); 115 pinMode(A0, INPUT); 116 pinMode(A1, INPUT); 117 pinMode(A2, INPUT); 118 pinMode(A3, INPUT); 119 pinMode(A4, INPUT); 120 pinMode(A5, INPUT); 121 pinMode(A6, INPUT); 122 pinMode(A7, INPUT); 123 pinMode(A8, INPUT); 124 125 //Column Pins 126 127 pinMode(A9, INPUT); 128 pinMode(A10, INPUT); 129 pinMode(A11, INPUT); 130 pinMode(A12, INPUT); 131 132 //Pot Pins 133 134 pinMode(A13, INPUT); 135 pinMode(A14, INPUT); 136 pinMode(A15, INPUT); 137} 138 139void loop() { 140 141 // Setup pins for keyboards 142 143 //Pins 1-10 144 pinMode(2, INPUT_PULLUP); 145 pinMode(3, INPUT_PULLUP); 146 pinMode(4, INPUT_PULLUP); 147 pinMode(5, INPUT_PULLUP); 148 pinMode(6, INPUT_PULLUP); 149 pinMode(7, INPUT_PULLUP); 150 pinMode(8, INPUT_PULLUP); 151 pinMode(9, INPUT_PULLUP); 152 pinMode(10, INPUT_PULLUP); 153 pinMode(11, INPUT_PULLUP); 154 155 //Pins 11-20 156 157 pinMode(12, INPUT_PULLUP); 158 pinMode(13, INPUT_PULLUP); 159 pinMode(14, INPUT_PULLUP); 160 pinMode(15, INPUT_PULLUP); 161 pinMode(16, INPUT_PULLUP); 162 pinMode(17, INPUT_PULLUP); 163 pinMode(18, INPUT_PULLUP); 164 pinMode(19, INPUT_PULLUP); 165 pinMode(20, INPUT_PULLUP); 166 pinMode(21, INPUT_PULLUP); 167 168 //Pins 21-30 169 170 pinMode(22, INPUT_PULLUP); 171 pinMode(23, INPUT_PULLUP); 172 pinMode(24, INPUT_PULLUP); 173 pinMode(25, INPUT_PULLUP); 174 pinMode(26, INPUT_PULLUP); 175 pinMode(27, INPUT_PULLUP); 176 pinMode(28, INPUT_PULLUP); 177 pinMode(29, INPUT_PULLUP); 178 pinMode(30, INPUT_PULLUP); 179 pinMode(31, INPUT_PULLUP); 180 181 //Pins 31-40 182 183 pinMode(32, INPUT_PULLUP); 184 pinMode(33, INPUT_PULLUP); 185 pinMode(34, INPUT_PULLUP); 186 pinMode(35, INPUT_PULLUP); 187 pinMode(36, INPUT_PULLUP); 188 pinMode(37, INPUT_PULLUP); 189 pinMode(38, INPUT_PULLUP); 190 pinMode(39, INPUT_PULLUP); 191 pinMode(40, INPUT_PULLUP); 192 pinMode(41, INPUT_PULLUP); 193 194 //Pins 41-50 195 196 pinMode(42, INPUT_PULLUP); 197 pinMode(43, INPUT_PULLUP); 198 pinMode(44, INPUT_PULLUP); 199 pinMode(45, INPUT_PULLUP); 200 pinMode(46, INPUT_PULLUP); 201 pinMode(47, INPUT_PULLUP); 202 pinMode(48, INPUT_PULLUP); 203 pinMode(49, INPUT_PULLUP); 204 pinMode(50, INPUT_PULLUP); 205 pinMode(51, INPUT_PULLUP); 206 207 //Pins 51-61 208 209 pinMode(52, INPUT_PULLUP); 210 pinMode(53, INPUT_PULLUP); 211 pinMode(A0, INPUT_PULLUP); 212 pinMode(A1, INPUT_PULLUP); 213 pinMode(A2, INPUT_PULLUP); 214 pinMode(A3, INPUT_PULLUP); 215 pinMode(A4, INPUT_PULLUP); 216 pinMode(A5, INPUT_PULLUP); 217 pinMode(A6, INPUT_PULLUP); 218 pinMode(A7, INPUT_PULLUP); 219 pinMode(A8, INPUT_PULLUP); 220 221 //Read Keyboard A 222 223 pinMode(A9, OUTPUT); 224 digitalWrite(A9, LOW); 225 226 //Keys 1-10 227 228 keysA[0][0] = digitalRead(2); 229 keysA[1][0] = digitalRead(3); 230 keysA[1][1] = digitalRead(4); 231 keysA[1][2] = digitalRead(5); 232 keysA[1][3] = digitalRead(6); 233 keysA[1][4] = digitalRead(7); 234 keysA[1][5] = digitalRead(8); 235 keysA[2][0] = digitalRead(9); 236 keysA[2][1] = digitalRead(10); 237 keysA[2][2] = digitalRead(11); 238 239 //Keys 11-20 240 241 keysA[2][3] = digitalRead(12); 242 keysA[2][4] = digitalRead(13); 243 keysA[2][5] = digitalRead(14); 244 keysA[3][0] = digitalRead(15); 245 keysA[3][1] = digitalRead(16); 246 keysA[3][2] = digitalRead(17); 247 keysA[3][3] = digitalRead(18); 248 keysA[3][4] = digitalRead(19); 249 keysA[3][5] = digitalRead(20); 250 keysA[4][0] = digitalRead(21); 251 252 253 //Keys 21-30 254 255 keysA[4][1] = digitalRead(22); 256 keysA[4][2] = digitalRead(23); 257 keysA[4][3] = digitalRead(24); 258 keysA[4][4] = digitalRead(25); 259 keysA[4][5] = digitalRead(26); 260 keysA[5][0] = digitalRead(27); 261 keysA[5][1] = digitalRead(28); 262 keysA[5][2] = digitalRead(29); 263 keysA[5][3] = digitalRead(30); 264 keysA[5][4] = digitalRead(31); 265 266 //Keys 31-40 267 268 keysA[5][5] = digitalRead(32); 269 keysA[6][0] = digitalRead(33); 270 keysA[6][1] = digitalRead(34); 271 keysA[6][2] = digitalRead(35); 272 keysA[6][3] = digitalRead(36); 273 keysA[6][4] = digitalRead(37); 274 keysA[6][5] = digitalRead(38); 275 keysA[7][0] = digitalRead(39); 276 keysA[7][1] = digitalRead(40); 277 keysA[7][2] = digitalRead(41); 278 279 //Keys 41-50 280 281 keysA[7][3] = digitalRead(42); 282 keysA[7][4] = digitalRead(43); 283 keysA[7][5] = digitalRead(44); 284 keysA[8][0] = digitalRead(45); 285 keysA[8][1] = digitalRead(46); 286 keysA[8][2] = digitalRead(47); 287 keysA[8][3] = digitalRead(48); 288 keysA[8][4] = digitalRead(49); 289 keysA[8][5] = digitalRead(50); 290 keysA[9][0] = digitalRead(51); 291 292 //Keys 51-61 293 294 keysA[9][1] = digitalRead(52); 295 keysA[9][2] = digitalRead(53); 296 keysA[9][3] = digitalRead(A0); 297 keysA[9][4] = digitalRead(A1); 298 keysA[9][5] = digitalRead(A2); 299 keysA[10][0] = digitalRead(A3); 300 keysA[10][1] = digitalRead(A4); 301 keysA[10][2] = digitalRead(A5); 302 keysA[10][3] = digitalRead(A6); 303 keysA[10][4] = digitalRead(A7); 304 keysA[10][5] = digitalRead(A8); 305 306 pinMode(A9, INPUT); 307 308 // Read Keyboard B 309 310 pinMode(A10, OUTPUT); 311 digitalWrite(A10, LOW); 312 313 //Keys 1-10 314 315 keysB[0][0] = digitalRead(2); 316 keysB[1][0] = digitalRead(3); 317 keysB[1][1] = digitalRead(4); 318 keysB[1][2] = digitalRead(5); 319 keysB[1][3] = digitalRead(6); 320 keysB[1][4] = digitalRead(7); 321 keysB[1][5] = digitalRead(8); 322 keysB[2][0] = digitalRead(9); 323 keysB[2][1] = digitalRead(10); 324 keysB[2][2] = digitalRead(11); 325 326 //Keys 11-20 327 328 keysB[2][3] = digitalRead(12); 329 keysB[2][4] = digitalRead(13); 330 keysB[2][5] = digitalRead(14); 331 keysB[3][0] = digitalRead(15); 332 keysB[3][1] = digitalRead(16); 333 keysB[3][2] = digitalRead(17); 334 keysB[3][3] = digitalRead(18); 335 keysB[3][4] = digitalRead(19); 336 keysB[3][5] = digitalRead(20); 337 keysB[4][0] = digitalRead(21); 338 339 340 //Keys 21-30 341 342 keysB[4][1] = digitalRead(22); 343 keysB[4][2] = digitalRead(23); 344 keysB[4][3] = digitalRead(24); 345 keysB[4][4] = digitalRead(25); 346 keysB[4][5] = digitalRead(26); 347 keysB[5][0] = digitalRead(27); 348 keysB[5][1] = digitalRead(28); 349 keysB[5][2] = digitalRead(29); 350 keysB[5][3] = digitalRead(30); 351 keysB[5][4] = digitalRead(31); 352 353 //Keys 31-40 354 355 keysB[5][5] = digitalRead(32); 356 keysB[6][0] = digitalRead(33); 357 keysB[6][1] = digitalRead(34); 358 keysB[6][2] = digitalRead(35); 359 keysB[6][3] = digitalRead(36); 360 keysB[6][4] = digitalRead(37); 361 keysB[6][5] = digitalRead(38); 362 keysB[7][0] = digitalRead(39); 363 keysB[7][1] = digitalRead(40); 364 keysB[7][2] = digitalRead(41); 365 366 //Keys 41-50 367 368 keysB[7][3] = digitalRead(42); 369 keysB[7][4] = digitalRead(43); 370 keysB[7][5] = digitalRead(44); 371 keysB[8][0] = digitalRead(45); 372 keysB[8][1] = digitalRead(46); 373 keysB[8][2] = digitalRead(47); 374 keysB[8][3] = digitalRead(48); 375 keysB[8][4] = digitalRead(49); 376 keysB[8][5] = digitalRead(50); 377 keysB[9][0] = digitalRead(51); 378 379 //Keys 51-61 380 381 keysB[9][1] = digitalRead(52); 382 keysB[9][2] = digitalRead(53); 383 keysB[9][3] = digitalRead(A0); 384 keysB[9][4] = digitalRead(A1); 385 keysB[9][5] = digitalRead(A2); 386 keysB[10][0] = digitalRead(A3); 387 keysB[10][1] = digitalRead(A4); 388 keysB[10][2] = digitalRead(A5); 389 keysB[10][3] = digitalRead(A6); 390 keysB[10][4] = digitalRead(A7); 391 keysB[10][5] = digitalRead(A8); 392 393 pinMode(A10, INPUT); 394 395 // Read Keyboard C 396 397 pinMode(A11, OUTPUT); 398 digitalWrite(A11, LOW); 399 400 //Keys 1-10 401 402 keysC[0][0] = digitalRead(2); 403 keysC[1][0] = digitalRead(3); 404 keysC[1][1] = digitalRead(4); 405 keysC[1][2] = digitalRead(5); 406 keysC[1][3] = digitalRead(6); 407 keysC[1][4] = digitalRead(7); 408 keysC[1][5] = digitalRead(8); 409 keysC[2][0] = digitalRead(9); 410 keysC[2][1] = digitalRead(10); 411 keysC[2][2] = digitalRead(11); 412 413 //Keys 11-20 414 415 keysC[2][3] = digitalRead(12); 416 keysC[2][4] = digitalRead(13); 417 keysC[2][5] = digitalRead(14); 418 keysC[3][0] = digitalRead(15); 419 keysC[3][1] = digitalRead(16); 420 keysC[3][2] = digitalRead(17); 421 keysC[3][3] = digitalRead(18); 422 keysC[3][4] = digitalRead(19); 423 keysC[3][5] = digitalRead(20); 424 keysC[4][0] = digitalRead(21); 425 426 //Keys 21-30 427 428 keysC[4][1] = digitalRead(22); 429 keysC[4][2] = digitalRead(23); 430 keysC[4][3] = digitalRead(24); 431 keysC[4][4] = digitalRead(25); 432 keysC[4][5] = digitalRead(26); 433 keysC[5][0] = digitalRead(27); 434 keysC[5][1] = digitalRead(28); 435 keysC[5][2] = digitalRead(29); 436 keysC[5][3] = digitalRead(30); 437 keysC[5][4] = digitalRead(31); 438 439 //Keys 31-40 440 441 keysC[5][5] = digitalRead(32); 442 keysC[6][0] = digitalRead(33); 443 keysC[6][1] = digitalRead(34); 444 keysC[6][2] = digitalRead(35); 445 keysC[6][3] = digitalRead(36); 446 keysC[6][4] = digitalRead(37); 447 keysC[6][5] = digitalRead(38); 448 keysC[7][0] = digitalRead(39); 449 keysC[7][1] = digitalRead(40); 450 keysC[7][2] = digitalRead(41); 451 452 //Keys 41-50 453 454 keysC[7][3] = digitalRead(42); 455 keysC[7][4] = digitalRead(43); 456 keysC[7][5] = digitalRead(44); 457 keysC[8][0] = digitalRead(45); 458 keysC[8][1] = digitalRead(46); 459 keysC[8][2] = digitalRead(47); 460 keysC[8][3] = digitalRead(48); 461 keysC[8][4] = digitalRead(49); 462 keysC[8][5] = digitalRead(50); 463 keysC[9][0] = digitalRead(51); 464 465 //Keys 51-61 466 467 keysC[9][1] = digitalRead(52); 468 keysC[9][2] = digitalRead(53); 469 keysC[9][3] = digitalRead(A0); 470 keysC[9][4] = digitalRead(A1); 471 keysC[9][5] = digitalRead(A2); 472 keysC[10][0] = digitalRead(A3); 473 keysC[10][1] = digitalRead(A4); 474 keysC[10][2] = digitalRead(A5); 475 keysC[10][3] = digitalRead(A6); 476 keysC[10][4] = digitalRead(A7); 477 keysC[10][5] = digitalRead(A8); 478 479 pinMode(A11, INPUT); 480 481 // Read Keyboard D 482 483 pinMode(A12, OUTPUT); 484 digitalWrite(A12, LOW); 485 486 //Keys 1-10 487 488 keysD[0][0] = digitalRead(2); 489 keysD[1][0] = digitalRead(3); 490 keysD[1][1] = digitalRead(4); 491 keysD[1][2] = digitalRead(5); 492 keysD[1][3] = digitalRead(6); 493 keysD[1][4] = digitalRead(7); 494 keysD[1][5] = digitalRead(8); 495 keysD[2][0] = digitalRead(9); 496 keysD[2][1] = digitalRead(10); 497 keysD[2][2] = digitalRead(11); 498 499 //Keys 11-20 500 501 keysD[2][3] = digitalRead(12); 502 keysD[2][4] = digitalRead(13); 503 keysD[2][5] = digitalRead(14); 504 keysD[3][0] = digitalRead(15); 505 keysD[3][1] = digitalRead(16); 506 keysD[3][2] = digitalRead(17); 507 keysD[3][3] = digitalRead(18); 508 keysD[3][4] = digitalRead(19); 509 keysD[3][5] = digitalRead(20); 510 keysD[4][0] = digitalRead(21); 511 512 513 //Keys 21-30 514 515 keysD[4][1] = digitalRead(22); 516 keysD[4][2] = digitalRead(23); 517 keysD[4][3] = digitalRead(24); 518 keysD[4][4] = digitalRead(25); 519 keysD[4][5] = digitalRead(26); 520 keysD[5][0] = digitalRead(27); 521 keysD[5][1] = digitalRead(28); 522 keysD[5][2] = digitalRead(29); 523 keysD[5][3] = digitalRead(30); 524 keysD[5][4] = digitalRead(31); 525 526 //Keys 31-40 527 528 keysD[5][5] = digitalRead(32); 529 keysD[6][0] = digitalRead(33); 530 keysD[6][1] = digitalRead(34); 531 keysD[6][2] = digitalRead(35); 532 keysD[6][3] = digitalRead(36); 533 keysD[6][4] = digitalRead(37); 534 keysD[6][5] = digitalRead(38); 535 keysD[7][0] = digitalRead(39); 536 keysD[7][1] = digitalRead(40); 537 keysD[7][2] = digitalRead(41); 538 539 //Keys 41-50 540 541 keysD[7][3] = digitalRead(42); 542 keysD[7][4] = digitalRead(43); 543 keysD[7][5] = digitalRead(44); 544 keysD[8][0] = digitalRead(45); 545 keysD[8][1] = digitalRead(46); 546 keysD[8][2] = digitalRead(47); 547 keysD[8][3] = digitalRead(48); 548 keysD[8][4] = digitalRead(49); 549 keysD[8][5] = digitalRead(50); 550 keysD[9][0] = digitalRead(51); 551 552 //Keys 51-61 553 554 keysD[9][1] = digitalRead(52); 555 keysD[9][2] = digitalRead(53); 556 keysD[9][3] = digitalRead(A0); 557 keysD[9][4] = digitalRead(A1); 558 keysD[9][5] = digitalRead(A2); 559 keysD[10][0] = digitalRead(A3); 560 keysD[10][1] = digitalRead(A4); 561 keysD[10][2] = digitalRead(A5); 562 keysD[10][3] = digitalRead(A6); 563 keysD[10][4] = digitalRead(A7); 564 keysD[10][5] = digitalRead(A8); 565 566 pinMode(A12, INPUT); 567 568 //Return pins to Initialized state 569 570 //Pins 1-10 571 572 pinMode(2, INPUT); 573 pinMode(3, INPUT); 574 pinMode(4, INPUT); 575 pinMode(5, INPUT); 576 pinMode(6, INPUT); 577 pinMode(7, INPUT); 578 pinMode(8, INPUT); 579 pinMode(9, INPUT); 580 pinMode(10, INPUT); 581 pinMode(11, INPUT); 582 583 //Pins 11-20 584 585 pinMode(12, INPUT); 586 pinMode(13, INPUT); 587 pinMode(14, INPUT); 588 pinMode(15, INPUT); 589 pinMode(16, INPUT); 590 pinMode(17, INPUT); 591 pinMode(18, INPUT); 592 pinMode(19, INPUT); 593 pinMode(20, INPUT); 594 pinMode(21, INPUT); 595 596 //Pins 21-30 597 598 pinMode(22, INPUT); 599 pinMode(23, INPUT); 600 pinMode(24, INPUT); 601 pinMode(25, INPUT); 602 pinMode(26, INPUT); 603 pinMode(27, INPUT); 604 pinMode(28, INPUT); 605 pinMode(29, INPUT); 606 pinMode(30, INPUT); 607 pinMode(31, INPUT); 608 609 //Pins 31-40 610 611 pinMode(32, INPUT); 612 pinMode(33, INPUT); 613 pinMode(34, INPUT); 614 pinMode(35, INPUT); 615 pinMode(36, INPUT); 616 pinMode(37, INPUT); 617 pinMode(38, INPUT); 618 pinMode(39, INPUT); 619 pinMode(40, INPUT); 620 pinMode(41, INPUT); 621 622 //Pins 41-50 623 624 pinMode(42, INPUT); 625 pinMode(43, INPUT); 626 pinMode(44, INPUT); 627 pinMode(45, INPUT); 628 pinMode(46, INPUT); 629 pinMode(47, INPUT); 630 pinMode(48, INPUT); 631 pinMode(49, INPUT); 632 pinMode(50, INPUT); 633 pinMode(51, INPUT); 634 635 //Pins 51-61 636 637 pinMode(52, INPUT); 638 pinMode(53, INPUT); 639 pinMode(A0, INPUT); 640 pinMode(A1, INPUT); 641 pinMode(A2, INPUT); 642 pinMode(A3, INPUT); 643 pinMode(A4, INPUT); 644 pinMode(A5, INPUT); 645 pinMode(A6, INPUT); 646 pinMode(A7, INPUT); 647 pinMode(A8, INPUT); 648 649 //Column Pins 650 651 pinMode(A9, INPUT); 652 pinMode(A10, INPUT); 653 pinMode(A11, INPUT); 654 pinMode(A12, INPUT); 655 656 //Pot Pins 657 658 pinMode(A13, INPUT); 659 pinMode(A14, INPUT); 660 pinMode(A15, INPUT); 661 662 /* 663 //Invert Keyboard data only if needed. 664 //Example only for 32 pedals of a pedalboard, first 32 keys of keyboard C. 665 666 //Column 1 667 668 if (keysC[0][0] == 0) { 669 keysC[0][0] = 1; 670 } 671 else 672 if (keysC[0][0] == 1) { 673 keysC[0][0] = 0; 674 } 675 676 //Column 2 677 678 if (keysC[1][0] == 0) { 679 keysC[1][0] = 1; 680 } 681 else 682 if (keysC[1][0] == 1) { 683 keysC[1][0] = 0; 684 } 685 if (keysC[1][1] == 0) { 686 keysC[1][1] = 1; 687 } 688 else 689 if (keysC[1][1] == 1) { 690 keysC[1][1] = 0; 691 } 692 if (keysC[1][2] == 0) { 693 keysC[1][2] = 1; 694 } 695 else 696 if (keysC[1][2] == 1) { 697 keysC[1][2] = 0; 698 } 699 if (keysC[1][3] == 0) { 700 keysC[1][3] = 1; 701 } 702 else 703 if (keysC[1][3] == 1) { 704 keysC[1][3] = 0; 705 } 706 if (keysC[1][4] == 0) { 707 keysC[1][4] = 1; 708 } 709 else 710 if (keysC[1][4] == 1) { 711 keysC[1][4] = 0; 712 } 713 if (keysC[1][5] == 0) { 714 keysC[1][5] = 1; 715 } 716 else 717 if (keysC[1][5] == 1) { 718 keysC[1][5] = 0; 719 } 720 721 //Column 3 722 723 if (keysC[2][0] == 0) { 724 keysC[2][0] = 1; 725 } 726 else 727 if (keysC[2][0] == 1) { 728 keysC[2][0] = 0; 729 } 730 if (keysC[2][1] == 0) { 731 keysC[2][1] = 1; 732 } 733 else 734 if (keysC[2][1] == 1) { 735 keysC[2][1] = 0; 736 } 737 if (keysC[2][2] == 0) { 738 keysC[2][2] = 1; 739 } 740 else 741 if (keysC[2][2] == 1) { 742 keysC[2][2] = 0; 743 } 744 if (keysC[2][3] == 0) { 745 keysC[2][3] = 1; 746 } 747 else 748 if (keysC[2][3] == 1) { 749 keysC[2][3] = 0; 750 } 751 if (keysC[2][4] == 0) { 752 keysC[2][4] = 1; 753 } 754 else 755 if (keysC[2][4] == 1) { 756 keysC[2][4] = 0; 757 } 758 if (keysC[2][5] == 0) { 759 keysC[2][5] = 1; 760 } 761 else 762 if (keysC[2][5] == 1) { 763 keysC[2][5] = 0; 764 } 765 766 //Column 4 767 768 if (keysC[3][0] == 0) { 769 keysC[3][0] = 1; 770 } 771 else 772 if (keysC[3][0] == 1) { 773 keysC[3][0] = 0; 774 } 775 if (keysC[3][1] == 0) { 776 keysC[3][1] = 1; 777 } 778 else 779 if (keysC[3][1] == 1) { 780 keysC[3][1] = 0; 781 } 782 if (keysC[3][2] == 0) { 783 keysC[3][2] = 1; 784 } 785 else 786 if (keysC[3][2] == 1) { 787 keysC[3][2] = 0; 788 } 789 if (keysC[3][3] == 0) { 790 keysC[3][3] = 1; 791 } 792 else 793 if (keysC[3][3] == 1) { 794 keysC[3][3] = 0; 795 } 796 if (keysC[3][4] == 0) { 797 keysC[3][4] = 1; 798 } 799 else 800 if (keysC[3][4] == 1) { 801 keysC[3][4] = 0; 802 } 803 if (keysC[3][5] == 0) { 804 keysC[3][5] = 1; 805 } 806 else 807 if (keysC[3][5] == 1) { 808 keysC[3][5] = 0; 809 } 810 811 //Column 5 812 813 if (keysC[4][0] == 0) { 814 keysC[4][0] = 1; 815 } 816 else 817 if (keysC[4][0] == 1) { 818 keysC[4][0] = 0; 819 } 820 if (keysC[4][1] == 0) { 821 keysC[4][1] = 1; 822 } 823 else 824 if (keysC[4][1] == 1) { 825 keysC[4][1] = 0; 826 } 827 if (keysC[4][2] == 0) { 828 keysC[4][2] = 1; 829 } 830 else 831 if (keysC[4][2] == 1) { 832 keysC[4][2] = 0; 833 } 834 if (keysC[4][3] == 0) { 835 keysC[4][3] = 1; 836 } 837 else 838 if (keysC[4][3] == 1) { 839 keysC[4][3] = 0; 840 } 841 if (keysC[4][4] == 0) { 842 keysC[4][4] = 1; 843 } 844 else 845 if (keysC[4][4] == 1) { 846 keysC[4][4] = 0; 847 } 848 if (keysC[4][5] == 0) { 849 keysC[4][5] = 1; 850 } 851 else 852 if (keysC[4][5] == 1) { 853 keysC[4][5] = 0; 854 } 855 856 //Column 6 857 858 if (keysC[5][0] == 0) { 859 keysC[5][0] = 1; 860 } 861 else 862 if (keysC[5][0] == 1) { 863 keysC[5][0] = 0; 864 } 865 if (keysC[5][1] == 0) { 866 keysC[5][1] = 1; 867 } 868 else 869 if (keysC[5][1] == 1) { 870 keysC[5][1] = 0; 871 } 872 if (keysC[5][2] == 0) { 873 keysC[5][2] = 1; 874 } 875 else 876 if (keysC[5][2] == 1) { 877 keysC[5][2] = 0; 878 } 879 if (keysC[5][3] == 0) { 880 keysC[5][3] = 1; 881 } 882 else 883 if (keysC[5][3] == 1) { 884 keysC[5][3] = 0; 885 } 886 if (keysC[5][4] == 0) { 887 keysC[5][4] = 1; 888 } 889 else 890 if (keysC[5][4] == 1) { 891 keysC[5][4] = 0; 892 } 893 if (keysC[5][5] == 0) { 894 keysC[5][5] = 1; 895 } 896 else 897 if (keysC[5][5] == 1) { 898 keysC[5][5] = 0; 899 } 900 901 //Column 7 902 903 if (keysC[6][0] == 0) { 904 keysC[6][0] = 1; 905 } 906 else 907 if (keysC[6][0] == 1) { 908 keysC[6][0] = 0; 909 } 910 */ 911 912 //Write Keyboard A 913 914 //A36 915 if ((keysA[0][0] == 0) and (lastA[0][0] == 0)) { 916 MidiSend(noteOn1, 36, velocity); 917 lastA[0][0] = 7; 918 } 919 if ((keysA[0][0] == 1) and (lastA[0][0] == 7)) { 920 MidiSend(noteOff1, 36, velocity); 921 lastA[0][0] = 0; 922 } 923 924 //A37 925 if ((keysA[1][0] == 0) and (lastA[1][0] == 0)) { 926 MidiSend(noteOn1, 37, velocity); 927 lastA[1][0] = 7; 928 } 929 if ((keysA[1][0] == 1) and (lastA[1][0] == 7)) { 930 MidiSend(noteOff1, 37, velocity); 931 lastA[1][0] = 0; 932 } 933 934 //A38 935 if ((keysA[1][1] == 0) and (lastA[1][1] == 0)) { 936 MidiSend(noteOn1, 38, velocity); 937 lastA[1][1] = 7; 938 } 939 //Write Midi Note Off 940 if ((keysA[1][1] == 1) and (lastA[1][1] == 7)) { 941 MidiSend(noteOff1, 38, velocity); 942 lastA[1][1] = 0; 943 } 944 945 //A39 946 if ((keysA[1][2] == 0) and (lastA[1][2] == 0)) { 947 MidiSend(noteOn1, 39, velocity); 948 lastA[1][2] = 7; 949 } 950 //Write Midi Note Off 951 if ((keysA[1][2] == 1) and (lastA[1][2] == 7)) { 952 MidiSend(noteOff1, 39, velocity); 953 lastA[1][2] = 0; 954 } 955 956 //A40 957 if ((keysA[1][3] == 0) and (lastA[1][3] == 0)) { 958 MidiSend(noteOn1, 40, velocity); 959 lastA[1][3] = 7; 960 } 961 //Write Midi Note Off 962 if ((keysA[1][3] == 1) and (lastA[1][3] == 7)) { 963 MidiSend(noteOff1, 40, velocity); 964 lastA[1][3] = 0; 965 } 966 967 //A41 968 if ((keysA[1][4] == 0) and (lastA[1][4] == 0)) { 969 MidiSend(noteOn1, 41, velocity); 970 lastA[1][4] = 7; 971 } 972 //Write Midi Note Off 973 if ((keysA[1][4] == 1) and (lastA[1][4] == 7)) { 974 MidiSend(noteOff1, 41, velocity); 975 lastA[1][4] = 0; 976 } 977 978 //A42 979 if ((keysA[1][5] == 0) and (lastA[1][5] == 0)) { 980 MidiSend(noteOn1, 42, velocity); 981 lastA[1][5] = 7; 982 } 983 //Write Midi Note Off 984 if ((keysA[1][5] == 1) and (lastA[1][5] == 7)) { 985 MidiSend(noteOff1, 42, velocity); 986 lastA[1][5] = 0; 987 } 988 989 //A43 990 if ((keysA[2][0] == 0) and (lastA[2][0] == 0)) { 991 MidiSend(noteOn1, 43, velocity); 992 lastA[2][0] = 7; 993 } 994 //Write Midi Note Off 995 if ((keysA[2][0] == 1) and (lastA[2][0] == 7)) { 996 MidiSend(noteOff1, 43, velocity); 997 lastA[2][0] = 0; 998 } 999 1000 //A44 1001 if ((keysA[2][1] == 0) and (lastA[2][1] == 0)) { 1002 MidiSend(noteOn1, 44, velocity); 1003 lastA[2][1] = 7; 1004 } 1005 //Write Midi Note Off 1006 if ((keysA[2][1] == 1) and (lastA[2][1] == 7)) { 1007 MidiSend(noteOff1, 44, velocity); 1008 lastA[2][1] = 0; 1009 } 1010 1011 //A45 1012 if ((keysA[2][2] == 0) and (lastA[2][2] == 0)) { 1013 MidiSend(noteOn1, 45, velocity); 1014 lastA[2][2] = 7; 1015 } 1016 //Write Midi Note Off 1017 if ((keysA[2][2] == 1) and (lastA[2][2] == 7)) { 1018 MidiSend(noteOff1, 45, velocity); 1019 lastA[2][2] = 0; 1020 } 1021 1022 //A46 1023 if ((keysA[2][3] == 0) and (lastA[2][3] == 0)) { 1024 MidiSend(noteOn1, 46, velocity); 1025 lastA[2][3] = 7; 1026 } 1027 //Write Midi Note Off 1028 if ((keysA[2][3] == 1) and (lastA[2][3] == 7)) { 1029 MidiSend(noteOff1, 46, velocity); 1030 lastA[2][3] = 0; 1031 } 1032 1033 //A47 1034 if ((keysA[2][4] == 0) and (lastA[2][4] == 0)) { 1035 MidiSend(noteOn1, 47, velocity); 1036 lastA[2][4] = 7; 1037 } 1038 //Write Midi Note Off 1039 if ((keysA[2][4] == 1) and (lastA[2][4] == 7)) { 1040 MidiSend(noteOff1, 47, velocity); 1041 lastA[2][4] = 0; 1042 } 1043 1044 //A48 1045 if ((keysA[2][5] == 0) and (lastA[2][5] == 0)) { 1046 MidiSend(noteOn1, 48, velocity); 1047 lastA[2][5] = 7; 1048 } 1049 //Write Midi Note Off 1050 if ((keysA[2][5] == 1) and (lastA[2][5] == 7)) { 1051 MidiSend(noteOff1, 48, velocity); 1052 lastA[2][5] = 0; 1053 } 1054 1055 //A49 1056 if ((keysA[3][0] == 0) and (lastA[3][0] == 0)) { 1057 MidiSend(noteOn1, 49, velocity); 1058 lastA[3][0] = 7; 1059 } 1060 //Write Midi Note Off 1061 if ((keysA[3][0] == 1) and (lastA[3][0] == 7)) { 1062 MidiSend(noteOff1, 49, velocity); 1063 lastA[3][0] = 0; 1064 } 1065 1066 //A50 1067 if ((keysA[3][1] == 0) and (lastA[3][1] == 0)) { 1068 MidiSend(noteOn1, 50, velocity); 1069 lastA[3][1] = 7; 1070 } 1071 //Write Midi Note Off 1072 if ((keysA[3][1] == 1) and (lastA[3][1] == 7)) { 1073 MidiSend(noteOff1, 50, velocity); 1074 lastA[3][1] = 0; 1075 } 1076 1077 //A51 1078 if ((keysA[3][2] == 0) and (lastA[3][2] == 0)) { 1079 MidiSend(noteOn1, 51, velocity); 1080 lastA[3][2] = 7; 1081 } 1082 //Write Midi Note Off 1083 if ((keysA[3][2] == 1) and (lastA[3][2] == 7)) { 1084 MidiSend(noteOff1, 51, velocity); 1085 lastA[3][2] = 0; 1086 } 1087 1088 //A52 1089 if ((keysA[3][3] == 0) and (lastA[3][3] == 0)) { 1090 MidiSend(noteOn1, 52, velocity); 1091 lastA[3][3] = 7; 1092 } 1093 //Write Midi Note Off 1094 if ((keysA[3][3] == 1) and (lastA[3][3] == 7)) { 1095 MidiSend(noteOff1, 52, velocity); 1096 lastA[3][3] = 0; 1097 } 1098 1099 //A53 1100 if ((keysA[3][4] == 0) and (lastA[3][4] == 0)) { 1101 MidiSend(noteOn1, 53, velocity); 1102 lastA[3][4] = 7; 1103 } 1104 //Write Midi Note Off 1105 if ((keysA[3][4] == 1) and (lastA[3][4] == 7)) { 1106 MidiSend(noteOff1, 53, velocity); 1107 lastA[3][4] = 0; 1108 } 1109 1110 //A54 1111 if ((keysA[3][5] == 0) and (lastA[3][5] == 0)) { 1112 MidiSend(noteOn1, 54, velocity); 1113 lastA[3][5] = 7; 1114 } 1115 //Write Midi Note Off 1116 if ((keysA[3][5] == 1) and (lastA[3][5] == 7)) { 1117 MidiSend(noteOff1, 54, velocity); 1118 lastA[3][5] = 0; 1119 } 1120 1121 //A55 1122 if ((keysA[4][0] == 0) and (lastA[4][0] == 0)) { 1123 MidiSend(noteOn1, 55, velocity); 1124 lastA[4][0] = 7; 1125 } 1126 //Write Midi Note Off 1127 if ((keysA[4][0] == 1) and (lastA[4][0] == 7)) { 1128 MidiSend(noteOff1, 55, velocity); 1129 lastA[4][0] = 0; 1130 } 1131 1132 //A56 1133 if ((keysA[4][1] == 0) and (lastA[4][1] == 0)) { 1134 MidiSend(noteOn1, 56, velocity); 1135 lastA[4][1] = 7; 1136 } 1137 //Write Midi Note Off 1138 if ((keysA[4][1] == 1) and (lastA[4][1] == 7)) { 1139 MidiSend(noteOff1, 56, velocity); 1140 lastA[4][1] = 0; 1141 } 1142 1143 //A57 1144 if ((keysA[4][2] == 0) and (lastA[4][2] == 0)) { 1145 MidiSend(noteOn1, 57, velocity); 1146 lastA[4][2] = 7; 1147 } 1148 //Write Midi Note Off 1149 if ((keysA[4][2] == 1) and (lastA[4][2] == 7)) { 1150 MidiSend(noteOff1, 57, velocity); 1151 lastA[4][2] = 0; 1152 } 1153 1154 //A58 1155 if ((keysA[4][3] == 0) and (lastA[4][3] == 0)) { 1156 MidiSend(noteOn1, 58, velocity); 1157 lastA[4][3] = 7; 1158 } 1159 //Write Midi Note Off 1160 if ((keysA[4][3] == 1) and (lastA[4][3] == 7)) { 1161 MidiSend(noteOff1, 58, velocity); 1162 lastA[4][3] = 0; 1163 } 1164 1165 //59 1166 if ((keysA[4][4] == 0) and (lastA[4][4] == 0)) { 1167 MidiSend(noteOn1, 59, velocity); 1168 lastA[4][4] = 7; 1169 } 1170 //Write Midi Note Off 1171 if ((keysA[4][4] == 1) and (lastA[4][4] == 7)) { 1172 MidiSend(noteOff1, 59, velocity); 1173 lastA[4][4] = 0; 1174 } 1175 1176 //A60 1177 if ((keysA[4][5] == 0) and (lastA[4][5] == 0)) { 1178 MidiSend(noteOn1, 60, velocity); 1179 lastA[4][5] = 7; 1180 } 1181 //Write Midi Note Off 1182 if ((keysA[4][5] == 1) and (lastA[4][5] == 7)) { 1183 MidiSend(noteOff1, 60, velocity); 1184 lastA[4][5] = 0; 1185 } 1186 1187 //A61 1188 if ((keysA[5][0] == 0) and (lastA[5][0] == 0)) { 1189 MidiSend(noteOn1, 61, velocity); 1190 lastA[5][0] = 7; 1191 } 1192 //Write Midi Note Off 1193 if ((keysA[5][0] == 1) and (lastA[5][0] == 7)) { 1194 MidiSend(noteOff1, 61, velocity); 1195 lastA[5][0] = 0; 1196 } 1197 1198 //A62 1199 if ((keysA[5][1] == 0) and (lastA[5][1] == 0)) { 1200 MidiSend(noteOn1, 62, velocity); 1201 lastA[5][1] = 7; 1202 } 1203 //Write Midi Note Off 1204 if ((keysA[5][1] == 1) and (lastA[5][1] == 7)) { 1205 MidiSend(noteOff1, 62, velocity); 1206 lastA[5][1] = 0; 1207 } 1208 1209 //A63 1210 if ((keysA[5][2] == 0) and (lastA[5][2] == 0)) { 1211 MidiSend(noteOn1, 63, velocity); 1212 lastA[5][2] = 7; 1213 } 1214 //Write Midi Note Off 1215 if ((keysA[5][2] == 1) and (lastA[5][2] == 7)) { 1216 MidiSend(noteOff1, 63, velocity); 1217 lastA[5][2] = 0; 1218 } 1219 1220 //A64 1221 if ((keysA[5][3] == 0) and (lastA[5][3] == 0)) { 1222 MidiSend(noteOn1, 64, velocity); 1223 lastA[5][3] = 7; 1224 } 1225 //Write Midi Note Off 1226 if ((keysA[5][3] == 1) and (lastA[5][3] == 7)) { 1227 MidiSend(noteOff1, 64, velocity); 1228 lastA[5][3] = 0; 1229 } 1230 1231 //A65 1232 if ((keysA[5][4] == 0) and (lastA[5][4] == 0)) { 1233 MidiSend(noteOn1, 65, velocity); 1234 lastA[5][4] = 7; 1235 } 1236 //Write Midi Note Off 1237 if ((keysA[5][4] == 1) and (lastA[5][4] == 7)) { 1238 MidiSend(noteOff1, 65, velocity); 1239 lastA[5][4] = 0; 1240 } 1241 1242 //A66 1243 if ((keysA[5][5] == 0) and (lastA[5][5] == 0)) { 1244 MidiSend(noteOn1, 66, velocity); 1245 lastA[5][5] = 7; 1246 } 1247 //Write Midi Note Off 1248 if ((keysA[5][5] == 1) and (lastA[5][5] == 7)) { 1249 MidiSend(noteOff1, 66, velocity); 1250 lastA[5][5] = 0; 1251 } 1252 1253 //A67 1254 if ((keysA[6][0] == 0) and (lastA[6][0] == 0)) { 1255 MidiSend(noteOn1, 67, velocity); 1256 lastA[6][0] = 7; 1257 } 1258 //Write Midi Note Off 1259 if ((keysA[6][0] == 1) and (lastA[6][0] == 7)) { 1260 MidiSend(noteOff1, 67, velocity); 1261 lastA[6][0] = 0; 1262 } 1263 1264 //A68 1265 if ((keysA[6][1] == 0) and (lastA[6][1] == 0)) { 1266 MidiSend(noteOn1, 68, velocity); 1267 lastA[6][1] = 7; 1268 } 1269 //Write Midi Note Off 1270 if ((keysA[6][1] == 1) and (lastA[6][1] == 7)) { 1271 MidiSend(noteOff1, 68, velocity); 1272 lastA[6][1] = 0; 1273 } 1274 1275 //A69 1276 if ((keysA[6][2] == 0) and (lastA[6][2] == 0)) { 1277 MidiSend(noteOn1, 69, velocity); 1278 lastA[6][2] = 7; 1279 } 1280 //Write Midi Note Off 1281 if ((keysA[6][2] == 1) and (lastA[6][2] == 7)) { 1282 MidiSend(noteOff1, 69, velocity); 1283 lastA[6][2] = 0; 1284 } 1285 1286 //A70 1287 if ((keysA[6][3] == 0) and (lastA[6][3] == 0)) { 1288 MidiSend(noteOn1, 70, velocity); 1289 lastA[6][3] = 7; 1290 } 1291 //Write Midi Note Off 1292 if ((keysA[6][3] == 1) and (lastA[6][3] == 7)) { 1293 MidiSend(noteOff1, 70, velocity); 1294 lastA[6][3] = 0; 1295 } 1296 1297 //A71 1298 if ((keysA[6][4] == 0) and (lastA[6][4] == 0)) { 1299 MidiSend(noteOn1, 71, velocity); 1300 lastA[6][4] = 7; 1301 } 1302 //Write Midi Note Off 1303 if ((keysA[6][4] == 1) and (lastA[6][4] == 7)) { 1304 MidiSend(noteOff1, 71, velocity); 1305 lastA[6][4] = 0; 1306 } 1307 1308 //A72 1309 if ((keysA[6][5] == 0) and (lastA[6][5] == 0)) { 1310 MidiSend(noteOn1, 72, velocity); 1311 lastA[6][5] = 7; 1312 } 1313 //Write Midi Note Off 1314 if ((keysA[6][5] == 1) and (lastA[6][5] == 7)) { 1315 MidiSend(noteOff1, 72, velocity); 1316 lastA[6][5] = 0; 1317 } 1318 1319 //A73 1320 if ((keysA[7][0] == 0) and (lastA[7][0] == 0)) { 1321 MidiSend(noteOn1, 73, velocity); 1322 lastA[7][0] = 7; 1323 } 1324 //Write Midi Note Off 1325 if ((keysA[7][0] == 1) and (lastA[7][0] == 7)) { 1326 MidiSend(noteOff1, 73, velocity); 1327 lastA[7][0] = 0; 1328 } 1329 1330 //A74 1331 if ((keysA[7][1] == 0) and (lastA[7][1] == 0)) { 1332 MidiSend(noteOn1, 74, velocity); 1333 lastA[7][1] = 7; 1334 } 1335 //Write Midi Note Off 1336 if ((keysA[7][1] == 1) and (lastA[7][1] == 7)) { 1337 MidiSend(noteOff1, 74, velocity); 1338 lastA[7][1] = 0; 1339 } 1340 1341 //A75 1342 if ((keysA[7][2] == 0) and (lastA[7][2] == 0)) { 1343 MidiSend(noteOn1, 75, velocity); 1344 lastA[7][2] = 7; 1345 } 1346 //Write Midi Note Off 1347 if ((keysA[7][2] == 1) and (lastA[7][2] == 7)) { 1348 MidiSend(noteOff1, 75, velocity); 1349 lastA[7][2] = 0; 1350 } 1351 1352 //A76 1353 if ((keysA[7][3] == 0) and (lastA[7][3] == 0)) { 1354 MidiSend(noteOn1, 76, velocity); 1355 lastA[7][3] = 7; 1356 } 1357 //Write Midi Note Off 1358 if ((keysA[7][3] == 1) and (lastA[7][3] == 7)) { 1359 MidiSend(noteOff1, 76, velocity); 1360 lastA[7][3] = 0; 1361 } 1362 1363 //A77 1364 if ((keysA[7][4] == 0) and (lastA[7][4] == 0)) { 1365 MidiSend(noteOn1, 77, velocity); 1366 lastA[7][4] = 7; 1367 } 1368 //Write Midi Note Off 1369 if ((keysA[7][4] == 1) and (lastA[7][4] == 7)) { 1370 MidiSend(noteOff1, 77, velocity); 1371 lastA[7][4] = 0; 1372 } 1373 1374 //A78 1375 if ((keysA[7][5] == 0) and (lastA[7][5] == 0)) { 1376 MidiSend(noteOn1, 78, velocity); 1377 lastA[7][5] = 7; 1378 } 1379 //Write Midi Note Off 1380 if ((keysA[7][5] == 1) and (lastA[7][5] == 7)) { 1381 MidiSend(noteOff1, 78, velocity); 1382 lastA[7][5] = 0; 1383 } 1384 1385 //A79 1386 if ((keysA[8][0] == 0) and (lastA[8][0] == 0)) { 1387 MidiSend(noteOn1, 79, velocity); 1388 lastA[8][0] = 7; 1389 } 1390 //Write Midi Note Off 1391 if ((keysA[8][0] == 1) and (lastA[8][0] == 7)) { 1392 MidiSend(noteOff1, 79, velocity); 1393 lastA[8][0] = 0; 1394 } 1395 1396 //A80 1397 if ((keysA[8][1] == 0) and (lastA[8][1] == 0)) { 1398 MidiSend(noteOn1, 80, velocity); 1399 lastA[8][1] = 7; 1400 } 1401 //Write Midi Note Off 1402 if ((keysA[8][1] == 1) and (lastA[8][1] == 7)) { 1403 MidiSend(noteOff1, 80, velocity); 1404 lastA[8][1] = 0; 1405 } 1406 1407 //A81 1408 if ((keysA[8][2] == 0) and (lastA[8][2] == 0)) { 1409 MidiSend(noteOn1, 81, velocity); 1410 lastA[8][2] = 7; 1411 } 1412 //Write Midi Note Off 1413 if ((keysA[8][2] == 1) and (lastA[8][2] == 7)) { 1414 MidiSend(noteOff1, 81, velocity); 1415 lastA[8][2] = 0; 1416 } 1417 1418 //A82 1419 if ((keysA[8][3] == 0) and (lastA[8][3] == 0)) { 1420 MidiSend(noteOn1, 82, velocity); 1421 lastA[8][3] = 7; 1422 } 1423 //Write Midi Note Off 1424 if ((keysA[8][3] == 1) and (lastA[8][3] == 7)) { 1425 MidiSend(noteOff1, 82, velocity); 1426 lastA[8][3] = 0; 1427 } 1428 1429 //A83 1430 if ((keysA[8][4] == 0) and (lastA[8][4] == 0)) { 1431 MidiSend(noteOn1, 83, velocity); 1432 lastA[8][4] = 7; 1433 } 1434 //Write Midi Note Off 1435 if ((keysA[8][4] == 1) and (lastA[8][4] == 7)) { 1436 MidiSend(noteOff1, 83, velocity); 1437 lastA[8][4] = 0; 1438 } 1439 1440 //A84 1441 if ((keysA[8][5] == 0) and (lastA[8][5] == 0)) { 1442 MidiSend(noteOn1, 84, velocity); 1443 lastA[8][5] = 7; 1444 } 1445 //Write Midi Note Off 1446 if ((keysA[8][5] == 1) and (lastA[8][5] == 7)) { 1447 MidiSend(noteOff1, 84, velocity); 1448 lastA[8][5] = 0; 1449 } 1450 1451 //A85 1452 if ((keysA[9][0] == 0) and (lastA[9][0] == 0)) { 1453 MidiSend(noteOn1, 85, velocity); 1454 lastA[9][0] = 7; 1455 } 1456 //Write Midi Note Off 1457 if ((keysA[9][0] == 1) and (lastA[9][0] == 7)) { 1458 MidiSend(noteOff1, 85, velocity); 1459 lastA[9][0] = 0; 1460 } 1461 1462 //A86 1463 if ((keysA[9][1] == 0) and (lastA[9][1] == 0)) { 1464 MidiSend(noteOn1, 86, velocity); 1465 lastA[9][1] = 7; 1466 } 1467 //Write Midi Note Off 1468 if ((keysA[9][1] == 1) and (lastA[9][1] == 7)) { 1469 MidiSend(noteOff1, 86, velocity); 1470 lastA[9][1] = 0; 1471 } 1472 1473 //A87 1474 if ((keysA[9][2] == 0) and (lastA[9][2] == 0)) { 1475 MidiSend(noteOn1, 87, velocity); 1476 lastA[9][2] = 7; 1477 } 1478 //Write Midi Note Off 1479 if ((keysA[9][2] == 1) and (lastA[9][2] == 7)) { 1480 MidiSend(noteOff1, 87, velocity); 1481 lastA[9][2] = 0; 1482 } 1483 1484 //A88 1485 if ((keysA[9][3] == 0) and (lastA[9][3] == 0)) { 1486 MidiSend(noteOn1, 88, velocity); 1487 lastA[9][3] = 7; 1488 } 1489 //Write Midi Note Off 1490 if ((keysA[9][3] == 1) and (lastA[9][3] == 7)) { 1491 MidiSend(noteOff1, 88, velocity); 1492 lastA[9][3] = 0; 1493 } 1494 1495 //A89 1496 if ((keysA[9][4] == 0) and (lastA[9][4] == 0)) { 1497 MidiSend(noteOn1, 89, velocity); 1498 lastA[9][4] = 7; 1499 } 1500 //Write Midi Note Off 1501 if ((keysA[9][4] == 1) and (lastA[9][4] == 7)) { 1502 MidiSend(noteOff1, 89, velocity); 1503 lastA[9][4] = 0; 1504 } 1505 1506 //A90 1507 if ((keysA[9][5] == 0) and (lastA[9][5] == 0)) { 1508 MidiSend(noteOn1, 90, velocity); 1509 lastA[9][5] = 7; 1510 } 1511 //Write Midi Note Off 1512 if ((keysA[9][5] == 1) and (lastA[9][5] == 7)) { 1513 MidiSend(noteOff1, 90, velocity); 1514 lastA[9][5] = 0; 1515 } 1516 1517 //A91 1518 if ((keysA[10][0] == 0) and (lastA[10][0] == 0)) { 1519 MidiSend(noteOn1, 91, velocity); 1520 lastA[10][0] = 7; 1521 } 1522 //Write Midi Note Off 1523 if ((keysA[10][0] == 1) and (lastA[10][0] == 7)) { 1524 MidiSend(noteOff1, 91, velocity); 1525 lastA[10][0] = 0; 1526 } 1527 1528 //A92 1529 if ((keysA[10][1] == 0) and (lastA[10][1] == 0)) { 1530 MidiSend(noteOn1, 92, velocity); 1531 lastA[10][1] = 7; 1532 } 1533 //Write Midi Note Off 1534 if ((keysA[10][1] == 1) and (lastA[10][1] == 7)) { 1535 MidiSend(noteOff1, 92, velocity); 1536 lastA[10][1] = 0; 1537 } 1538 1539 //A93 1540 if ((keysA[10][2] == 0) and (lastA[10][2] == 0)) { 1541 MidiSend(noteOn1, 93, velocity); 1542 lastA[10][2] = 7; 1543 } 1544 //Write Midi Note Off 1545 if ((keysA[10][2] == 1) and (lastA[10][2] == 7)) { 1546 MidiSend(noteOff1, 93, velocity); 1547 lastA[10][2] = 0; 1548 } 1549 1550 //A94 1551 if ((keysA[10][3] == 0) and (lastA[10][3] == 0)) { 1552 MidiSend(noteOn1, 94, velocity); 1553 lastA[10][3] = 7; 1554 } 1555 //Write Midi Note Off 1556 if ((keysA[10][3] == 1) and (lastA[10][3] == 7)) { 1557 MidiSend(noteOff1, 94, velocity); 1558 lastA[10][3] = 0; 1559 } 1560 1561 //A95 1562 if ((keysA[10][4] == 0) and (lastA[10][4] == 0)) { 1563 MidiSend(noteOn1, 95, velocity); 1564 lastA[10][4] = 7; 1565 } 1566 //Write Midi Note Off 1567 if ((keysA[10][4] == 1) and (lastA[10][4] == 7)) { 1568 MidiSend(noteOff1, 95, velocity); 1569 lastA[10][4] = 0; 1570 } 1571 1572 //A96 1573 if ((keysA[10][5] == 0) and (lastA[10][5] == 0)) { 1574 MidiSend(noteOn1, 96, velocity); 1575 lastA[10][5] = 7; 1576 } 1577 //Write Midi Note Off 1578 if ((keysA[10][5] == 1) and (lastA[10][5] == 7)) { 1579 MidiSend(noteOff1, 96, velocity); 1580 lastA[10][5] = 0; 1581 } 1582 1583 //Write Keyboard B 1584 1585 //B36 1586 if ((keysB[0][0] == 0) and (lastB[0][0] == 0)) { 1587 MidiSend(noteOn2, 36, velocity); 1588 lastB[0][0] = 7; 1589 } 1590 if ((keysB[0][0] == 1) and (lastB[0][0] == 7)) { 1591 MidiSend(noteOff2, 36, velocity); 1592 lastB[0][0] = 0; 1593 } 1594 1595 //B37 1596 if ((keysB[1][0] == 0) and (lastB[1][0] == 0)) { 1597 MidiSend(noteOn2, 37, velocity); 1598 lastB[1][0] = 7; 1599 } 1600 if ((keysB[1][0] == 1) and (lastB[1][0] == 7)) { 1601 MidiSend(noteOff2, 37, velocity); 1602 lastB[1][0] = 0; 1603 } 1604 1605 //B38 1606 if ((keysB[1][1] == 0) and (lastB[1][1] == 0)) { 1607 MidiSend(noteOn2, 38, velocity); 1608 lastB[1][1] = 7; 1609 } 1610 //Write Midi Note Off 1611 if ((keysB[1][1] == 1) and (lastB[1][1] == 7)) { 1612 MidiSend(noteOff2, 38, velocity); 1613 lastB[1][1] = 0; 1614 } 1615 1616 //B39 1617 if ((keysB[1][2] == 0) and (lastB[1][2] == 0)) { 1618 MidiSend(noteOn2, 39, velocity); 1619 lastB[1][2] = 7; 1620 } 1621 //Write Midi Note Off 1622 if ((keysB[1][2] == 1) and (lastB[1][2] == 7)) { 1623 MidiSend(noteOff2, 39, velocity); 1624 lastB[1][2] = 0; 1625 } 1626 1627 //B40 1628 if ((keysB[1][3] == 0) and (lastB[1][3] == 0)) { 1629 MidiSend(noteOn2, 40, velocity); 1630 lastB[1][3] = 7; 1631 } 1632 //Write Midi Note Off 1633 if ((keysB[1][3] == 1) and (lastB[1][3] == 7)) { 1634 MidiSend(noteOff2, 40, velocity); 1635 lastB[1][3] = 0; 1636 } 1637 1638 //B41 1639 if ((keysB[1][4] == 0) and (lastB[1][4] == 0)) { 1640 MidiSend(noteOn2, 41, velocity); 1641 lastB[1][4] = 7; 1642 } 1643 //Write Midi Note Off 1644 if ((keysB[1][4] == 1) and (lastB[1][4] == 7)) { 1645 MidiSend(noteOff2, 41, velocity); 1646 lastB[1][4] = 0; 1647 } 1648 1649 //B42 1650 if ((keysB[1][5] == 0) and (lastB[1][5] == 0)) { 1651 MidiSend(noteOn2, 42, velocity); 1652 lastB[1][5] = 7; 1653 } 1654 //Write Midi Note Off 1655 if ((keysB[1][5] == 1) and (lastB[1][5] == 7)) { 1656 MidiSend(noteOff2, 42, velocity); 1657 lastB[1][5] = 0; 1658 } 1659 1660 //B43 1661 if ((keysB[2][0] == 0) and (lastB[2][0] == 0)) { 1662 MidiSend(noteOn2, 43, velocity); 1663 lastB[2][0] = 7; 1664 } 1665 //Write Midi Note Off 1666 if ((keysB[2][0] == 1) and (lastB[2][0] == 7)) { 1667 MidiSend(noteOff2, 43, velocity); 1668 lastB[2][0] = 0; 1669 } 1670 1671 //B44 1672 if ((keysB[2][1] == 0) and (lastB[2][1] == 0)) { 1673 MidiSend(noteOn2, 44, velocity); 1674 lastB[2][1] = 7; 1675 } 1676 //Write Midi Note Off 1677 if ((keysB[2][1] == 1) and (lastB[2][1] == 7)) { 1678 MidiSend(noteOff2, 44, velocity); 1679 lastB[2][1] = 0; 1680 } 1681 1682 //B45 1683 if ((keysB[2][2] == 0) and (lastB[2][2] == 0)) { 1684 MidiSend(noteOn2, 45, velocity); 1685 lastB[2][2] = 7; 1686 } 1687 //Write Midi Note Off 1688 if ((keysB[2][2] == 1) and (lastB[2][2] == 7)) { 1689 MidiSend(noteOff2, 45, velocity); 1690 lastB[2][2] = 0; 1691 } 1692 1693 //B46 1694 if ((keysB[2][3] == 0) and (lastB[2][3] == 0)) { 1695 MidiSend(noteOn2, 46, velocity); 1696 lastB[2][3] = 7; 1697 } 1698 //Write Midi Note Off 1699 if ((keysB[2][3] == 1) and (lastB[2][3] == 7)) { 1700 MidiSend(noteOff2, 46, velocity); 1701 lastB[2][3] = 0; 1702 } 1703 1704 //B47 1705 if ((keysB[2][4] == 0) and (lastB[2][4] == 0)) { 1706 MidiSend(noteOn2, 47, velocity); 1707 lastB[2][4] = 7; 1708 } 1709 //Write Midi Note Off 1710 if ((keysB[2][4] == 1) and (lastB[2][4] == 7)) { 1711 MidiSend(noteOff2, 47, velocity); 1712 lastB[2][4] = 0; 1713 } 1714 1715 //B48 1716 if ((keysB[2][5] == 0) and (lastB[2][5] == 0)) { 1717 MidiSend(noteOn2, 48, velocity); 1718 lastB[2][5] = 7; 1719 } 1720 //Write Midi Note Off 1721 if ((keysB[2][5] == 1) and (lastB[2][5] == 7)) { 1722 MidiSend(noteOff2, 48, velocity); 1723 lastB[2][5] = 0; 1724 } 1725 1726 //B49 1727 if ((keysB[3][0] == 0) and (lastB[3][0] == 0)) { 1728 MidiSend(noteOn2, 49, velocity); 1729 lastB[3][0] = 7; 1730 } 1731 //Write Midi Note Off 1732 if ((keysB[3][0] == 1) and (lastB[3][0] == 7)) { 1733 MidiSend(noteOff2, 49, velocity); 1734 lastB[3][0] = 0; 1735 } 1736 1737 //B50 1738 if ((keysB[3][1] == 0) and (lastB[3][1] == 0)) { 1739 MidiSend(noteOn2, 50, velocity); 1740 lastB[3][1] = 7; 1741 } 1742 //Write Midi Note Off 1743 if ((keysB[3][1] == 1) and (lastB[3][1] == 7)) { 1744 MidiSend(noteOff2, 50, velocity); 1745 lastB[3][1] = 0; 1746 } 1747 1748 //B51 1749 if ((keysB[3][2] == 0) and (lastB[3][2] == 0)) { 1750 MidiSend(noteOn2, 51, velocity); 1751 lastB[3][2] = 7; 1752 } 1753 //Write Midi Note Off 1754 if ((keysB[3][2] == 1) and (lastB[3][2] == 7)) { 1755 MidiSend(noteOff2, 51, velocity); 1756 lastB[3][2] = 0; 1757 } 1758 1759 //B52 1760 if ((keysB[3][3] == 0) and (lastB[3][3] == 0)) { 1761 MidiSend(noteOn2, 52, velocity); 1762 lastB[3][3] = 7; 1763 } 1764 //Write Midi Note Off 1765 if ((keysB[3][3] == 1) and (lastB[3][3] == 7)) { 1766 MidiSend(noteOff2, 52, velocity); 1767 lastB[3][3] = 0; 1768 } 1769 1770 //B53 1771 if ((keysB[3][4] == 0) and (lastB[3][4] == 0)) { 1772 MidiSend(noteOn2, 53, velocity); 1773 lastB[3][4] = 7; 1774 } 1775 //Write Midi Note Off 1776 if ((keysB[3][4] == 1) and (lastB[3][4] == 7)) { 1777 MidiSend(noteOff2, 53, velocity); 1778 lastB[3][4] = 0; 1779 } 1780 1781 //B54 1782 if ((keysB[3][5] == 0) and (lastB[3][5] == 0)) { 1783 MidiSend(noteOn2, 54, velocity); 1784 lastB[3][5] = 7; 1785 } 1786 //Write Midi Note Off 1787 if ((keysB[3][5] == 1) and (lastB[3][5] == 7)) { 1788 MidiSend(noteOff2, 54, velocity); 1789 lastB[3][5] = 0; 1790 } 1791 1792 //B55 1793 if ((keysB[4][0] == 0) and (lastB[4][0] == 0)) { 1794 MidiSend(noteOn2, 55, velocity); 1795 lastB[4][0] = 7; 1796 } 1797 //Write Midi Note Off 1798 if ((keysB[4][0] == 1) and (lastB[4][0] == 7)) { 1799 MidiSend(noteOff2, 55, velocity); 1800 lastB[4][0] = 0; 1801 } 1802 1803 //B56 1804 if ((keysB[4][1] == 0) and (lastB[4][1] == 0)) { 1805 MidiSend(noteOn2, 56, velocity); 1806 lastB[4][1] = 7; 1807 } 1808 //Write Midi Note Off 1809 if ((keysB[4][1] == 1) and (lastB[4][1] == 7)) { 1810 MidiSend(noteOff2, 56, velocity); 1811 lastB[4][1] = 0; 1812 } 1813 1814 //B57 1815 if ((keysB[4][2] == 0) and (lastB[4][2] == 0)) { 1816 MidiSend(noteOn2, 57, velocity); 1817 lastB[4][2] = 7; 1818 } 1819 //Write Midi Note Off 1820 if ((keysB[4][2] == 1) and (lastB[4][2] == 7)) { 1821 MidiSend(noteOff2, 57, velocity); 1822 lastB[4][2] = 0; 1823 } 1824 1825 //B58 1826 if ((keysB[4][3] == 0) and (lastB[4][3] == 0)) { 1827 MidiSend(noteOn2, 58, velocity); 1828 lastB[4][3] = 7; 1829 } 1830 //Write Midi Note Off 1831 if ((keysB[4][3] == 1) and (lastB[4][3] == 7)) { 1832 MidiSend(noteOff2, 58, velocity); 1833 lastB[4][3] = 0; 1834 } 1835 1836 //B59 1837 if ((keysB[4][4] == 0) and (lastB[4][4] == 0)) { 1838 MidiSend(noteOn2, 59, velocity); 1839 lastB[4][4] = 7; 1840 } 1841 //Write Midi Note Off 1842 if ((keysB[4][4] == 1) and (lastB[4][4] == 7)) { 1843 MidiSend(noteOff2, 59, velocity); 1844 lastB[4][4] = 0; 1845 } 1846 1847 //B60 1848 if ((keysB[4][5] == 0) and (lastB[4][5] == 0)) { 1849 MidiSend(noteOn2, 60, velocity); 1850 lastB[4][5] = 7; 1851 } 1852 //Write Midi Note Off 1853 if ((keysB[4][5] == 1) and (lastB[4][5] == 7)) { 1854 MidiSend(noteOff2, 60, velocity); 1855 lastB[4][5] = 0; 1856 } 1857 1858 //B61 1859 if ((keysB[5][0] == 0) and (lastB[5][0] == 0)) { 1860 MidiSend(noteOn2, 61, velocity); 1861 lastB[5][0] = 7; 1862 } 1863 //Write Midi Note Off 1864 if ((keysB[5][0] == 1) and (lastB[5][0] == 7)) { 1865 MidiSend(noteOff2, 61, velocity); 1866 lastB[5][0] = 0; 1867 } 1868 1869 //B62 1870 if ((keysB[5][1] == 0) and (lastB[5][1] == 0)) { 1871 MidiSend(noteOn2, 62, velocity); 1872 lastB[5][1] = 7; 1873 } 1874 //Write Midi Note Off 1875 if ((keysB[5][1] == 1) and (lastB[5][1] == 7)) { 1876 MidiSend(noteOff2, 62, velocity); 1877 lastB[5][1] = 0; 1878 } 1879 1880 //B63 1881 if ((keysB[5][2] == 0) and (lastB[5][2] == 0)) { 1882 MidiSend(noteOn2, 63, velocity); 1883 lastB[5][2] = 7; 1884 } 1885 //Write Midi Note Off 1886 if ((keysB[5][2] == 1) and (lastB[5][2] == 7)) { 1887 MidiSend(noteOff2, 63, velocity); 1888 lastB[5][2] = 0; 1889 } 1890 1891 //B64 1892 if ((keysB[5][3] == 0) and (lastB[5][3] == 0)) { 1893 MidiSend(noteOn2, 64, velocity); 1894 lastB[5][3] = 7; 1895 } 1896 //Write Midi Note Off 1897 if ((keysB[5][3] == 1) and (lastB[5][3] == 7)) { 1898 MidiSend(noteOff2, 64, velocity); 1899 lastB[5][3] = 0; 1900 } 1901 1902 //B65 1903 if ((keysB[5][4] == 0) and (lastB[5][4] == 0)) { 1904 MidiSend(noteOn2, 65, velocity); 1905 lastB[5][4] = 7; 1906 } 1907 //Write Midi Note Off 1908 if ((keysB[5][4] == 1) and (lastB[5][4] == 7)) { 1909 MidiSend(noteOff2, 65, velocity); 1910 lastB[5][4] = 0; 1911 } 1912 1913 //B66 1914 if ((keysB[5][5] == 0) and (lastB[5][5] == 0)) { 1915 MidiSend(noteOn2, 66, velocity); 1916 lastB[5][5] = 7; 1917 } 1918 //Write Midi Note Off 1919 if ((keysB[5][5] == 1) and (lastB[5][5] == 7)) { 1920 MidiSend(noteOff2, 66, velocity); 1921 lastB[5][5] = 0; 1922 } 1923 1924 //B67 1925 if ((keysB[6][0] == 0) and (lastB[6][0] == 0)) { 1926 MidiSend(noteOn2, 67, velocity); 1927 lastB[6][0] = 7; 1928 } 1929 //Write Midi Note Off 1930 if ((keysB[6][0] == 1) and (lastB[6][0] == 7)) { 1931 MidiSend(noteOff2, 67, velocity); 1932 lastB[6][0] = 0; 1933 } 1934 1935 //B68 1936 if ((keysB[6][1] == 0) and (lastB[6][1] == 0)) { 1937 MidiSend(noteOn2, 68, velocity); 1938 lastB[6][1] = 7; 1939 } 1940 //Write Midi Note Off 1941 if ((keysB[6][1] == 1) and (lastB[6][1] == 7)) { 1942 MidiSend(noteOff2, 68, velocity); 1943 lastB[6][1] = 0; 1944 } 1945 1946 //B69 1947 if ((keysB[6][2] == 0) and (lastB[6][2] == 0)) { 1948 MidiSend(noteOn2, 69, velocity); 1949 lastB[6][2] = 7; 1950 } 1951 //Write Midi Note Off 1952 if ((keysB[6][2] == 1) and (lastB[6][2] == 7)) { 1953 MidiSend(noteOff2, 69, velocity); 1954 lastB[6][2] = 0; 1955 } 1956 1957 //B70 1958 if ((keysB[6][3] == 0) and (lastB[6][3] == 0)) { 1959 MidiSend(noteOn2, 70, velocity); 1960 lastB[6][3] = 7; 1961 } 1962 //Write Midi Note Off 1963 if ((keysB[6][3] == 1) and (lastB[6][3] == 7)) { 1964 MidiSend(noteOff2, 70, velocity); 1965 lastB[6][3] = 0; 1966 } 1967 1968 //B71 1969 if ((keysB[6][4] == 0) and (lastB[6][4] == 0)) { 1970 MidiSend(noteOn2, 71, velocity); 1971 lastB[6][4] = 7; 1972 } 1973 //Write Midi Note Off 1974 if ((keysB[6][4] == 1) and (lastB[6][4] == 7)) { 1975 MidiSend(noteOff2, 71, velocity); 1976 lastB[6][4] = 0; 1977 } 1978 1979 //B72 1980 if ((keysB[6][5] == 0) and (lastB[6][5] == 0)) { 1981 MidiSend(noteOn2, 72, velocity); 1982 lastB[6][5] = 7; 1983 } 1984 //Write Midi Note Off 1985 if ((keysB[6][5] == 1) and (lastB[6][5] == 7)) { 1986 MidiSend(noteOff2, 72, velocity); 1987 lastB[6][5] = 0; 1988 } 1989 1990 //B73 1991 if ((keysB[7][0] == 0) and (lastB[7][0] == 0)) { 1992 MidiSend(noteOn2, 73, velocity); 1993 lastB[7][0] = 7; 1994 } 1995 //Write Midi Note Off 1996 if ((keysB[7][0] == 1) and (lastB[7][0] == 7)) { 1997 MidiSend(noteOff2, 73, velocity); 1998 lastB[7][0] = 0; 1999 } 2000 2001 //B74 2002 if ((keysB[7][1] == 0) and (lastB[7][1] == 0)) { 2003 MidiSend(noteOn2, 74, velocity); 2004 lastB[7][1] = 7; 2005 } 2006 //Write Midi Note Off 2007 if ((keysB[7][1] == 1) and (lastB[7][1] == 7)) { 2008 MidiSend(noteOff2, 74, velocity); 2009 lastB[7][1] = 0; 2010 } 2011 2012 //B75 2013 if ((keysB[7][2] == 0) and (lastB[7][2] == 0)) { 2014 MidiSend(noteOn2, 75, velocity); 2015 lastB[7][2] = 7; 2016 } 2017 //Write Midi Note Off 2018 if ((keysB[7][2] == 1) and (lastB[7][2] == 7)) { 2019 MidiSend(noteOff2, 75, velocity); 2020 lastB[7][2] = 0; 2021 } 2022 2023 //B76 2024 if ((keysB[7][3] == 0) and (lastB[7][3] == 0)) { 2025 MidiSend(noteOn2, 76, velocity); 2026 lastB[7][3] = 7; 2027 } 2028 //Write Midi Note Off 2029 if ((keysB[7][3] == 1) and (lastB[7][3] == 7)) { 2030 MidiSend(noteOff2, 76, velocity); 2031 lastB[7][3] = 0; 2032 } 2033 2034 //B77 2035 if ((keysB[7][4] == 0) and (lastB[7][4] == 0)) { 2036 MidiSend(noteOn2, 77, velocity); 2037 lastB[7][4] = 7; 2038 } 2039 //Write Midi Note Off 2040 if ((keysB[7][4] == 1) and (lastB[7][4] == 7)) { 2041 MidiSend(noteOff2, 77, velocity); 2042 lastB[7][4] = 0; 2043 } 2044 2045 //B78 2046 if ((keysB[7][5] == 0) and (lastB[7][5] == 0)) { 2047 MidiSend(noteOn2, 78, velocity); 2048 lastB[7][5] = 7; 2049 } 2050 //Write Midi Note Off 2051 if ((keysB[7][5] == 1) and (lastB[7][5] == 7)) { 2052 MidiSend(noteOff2, 78, velocity); 2053 lastB[7][5] = 0; 2054 } 2055 2056 //B79 2057 if ((keysB[8][0] == 0) and (lastB[8][0] == 0)) { 2058 MidiSend(noteOn2, 79, velocity); 2059 lastB[8][0] = 7; 2060 } 2061 //Write Midi Note Off 2062 if ((keysB[8][0] == 1) and (lastB[8][0] == 7)) { 2063 MidiSend(noteOff2, 79, velocity); 2064 lastB[8][0] = 0; 2065 } 2066 2067 //B80 2068 if ((keysB[8][1] == 0) and (lastB[8][1] == 0)) { 2069 MidiSend(noteOn2, 80, velocity); 2070 lastB[8][1] = 7; 2071 } 2072 //Write Midi Note Off 2073 if ((keysB[8][1] == 1) and (lastB[8][1] == 7)) { 2074 MidiSend(noteOff2, 80, velocity); 2075 lastB[8][1] = 0; 2076 } 2077 2078 //B81 2079 if ((keysB[8][2] == 0) and (lastB[8][2] == 0)) { 2080 MidiSend(noteOn2, 81, velocity); 2081 lastB[8][2] = 7; 2082 } 2083 //Write Midi Note Off 2084 if ((keysB[8][2] == 1) and (lastB[8][2] == 7)) { 2085 MidiSend(noteOff2, 81, velocity); 2086 lastB[8][2] = 0; 2087 } 2088 2089 //B82 2090 if ((keysB[8][3] == 0) and (lastB[8][3] == 0)) { 2091 MidiSend(noteOn2, 82, velocity); 2092 lastB[8][3] = 7; 2093 } 2094 //Write Midi Note Off 2095 if ((keysB[8][3] == 1) and (lastB[8][3] == 7)) { 2096 MidiSend(noteOff2, 82, velocity); 2097 lastB[8][3] = 0; 2098 } 2099 2100 //B83 2101 if ((keysB[8][4] == 0) and (lastB[8][4] == 0)) { 2102 MidiSend(noteOn2, 83, velocity); 2103 lastB[8][4] = 7; 2104 } 2105 //Write Midi Note Off 2106 if ((keysB[8][4] == 1) and (lastB[8][4] == 7)) { 2107 MidiSend(noteOff2, 83, velocity); 2108 lastB[8][4] = 0; 2109 } 2110 2111 //B84 2112 if ((keysB[8][5] == 0) and (lastB[8][5] == 0)) { 2113 MidiSend(noteOn2, 84, velocity); 2114 lastB[8][5] = 7; 2115 } 2116 //Write Midi Note Off 2117 if ((keysB[8][5] == 1) and (lastB[8][5] == 7)) { 2118 MidiSend(noteOff2, 84, velocity); 2119 lastB[8][5] = 0; 2120 } 2121 2122 //B85 2123 if ((keysB[9][0] == 0) and (lastB[9][0] == 0)) { 2124 MidiSend(noteOn2, 85, velocity); 2125 lastB[9][0] = 7; 2126 } 2127 //Write Midi Note Off 2128 if ((keysB[9][0] == 1) and (lastB[9][0] == 7)) { 2129 MidiSend(noteOff2, 85, velocity); 2130 lastB[9][0] = 0; 2131 } 2132 2133 //B86 2134 if ((keysB[9][1] == 0) and (lastB[9][1] == 0)) { 2135 MidiSend(noteOn2, 86, velocity); 2136 lastB[9][1] = 7; 2137 } 2138 //Write Midi Note Off 2139 if ((keysB[9][1] == 1) and (lastB[9][1] == 7)) { 2140 MidiSend(noteOff2, 86, velocity); 2141 lastB[9][1] = 0; 2142 } 2143 2144 //B87 2145 if ((keysB[9][2] == 0) and (lastB[9][2] == 0)) { 2146 MidiSend(noteOn2, 87, velocity); 2147 lastB[9][2] = 7; 2148 } 2149 //Write Midi Note Off 2150 if ((keysB[9][2] == 1) and (lastB[9][2] == 7)) { 2151 MidiSend(noteOff2, 87, velocity); 2152 lastB[9][2] = 0; 2153 } 2154 2155 //B88 2156 if ((keysB[9][3] == 0) and (lastB[9][3] == 0)) { 2157 MidiSend(noteOn2, 88, velocity); 2158 lastB[9][3] = 7; 2159 } 2160 //Write Midi Note Off 2161 if ((keysB[9][3] == 1) and (lastB[9][3] == 7)) { 2162 MidiSend(noteOff2, 88, velocity); 2163 lastB[9][3] = 0; 2164 } 2165 2166 //B89 2167 if ((keysB[9][4] == 0) and (lastB[9][4] == 0)) { 2168 MidiSend(noteOn2, 89, velocity); 2169 lastB[9][4] = 7; 2170 } 2171 //Write Midi Note Off 2172 if ((keysB[9][4] == 1) and (lastB[9][4] == 7)) { 2173 MidiSend(noteOff2, 89, velocity); 2174 lastB[9][4] = 0; 2175 } 2176 2177 //B90 2178 if ((keysB[9][5] == 0) and (lastB[9][5] == 0)) { 2179 MidiSend(noteOn2, 90, velocity); 2180 lastB[9][5] = 7; 2181 } 2182 //Write Midi Note Off 2183 if ((keysB[9][5] == 1) and (lastB[9][5] == 7)) { 2184 MidiSend(noteOff2, 90, velocity); 2185 lastB[9][5] = 0; 2186 } 2187 2188 //B91 2189 if ((keysB[10][0] == 0) and (lastB[10][0] == 0)) { 2190 MidiSend(noteOn2, 91, velocity); 2191 lastB[10][0] = 7; 2192 } 2193 //Write Midi Note Off 2194 if ((keysB[10][0] == 1) and (lastB[10][0] == 7)) { 2195 MidiSend(noteOff2, 91, velocity); 2196 lastB[10][0] = 0; 2197 } 2198 2199 //B92 2200 if ((keysB[10][1] == 0) and (lastB[10][1] == 0)) { 2201 MidiSend(noteOn2, 92, velocity); 2202 lastB[10][1] = 7; 2203 } 2204 //Write Midi Note Off 2205 if ((keysB[10][1] == 1) and (lastB[10][1] == 7)) { 2206 MidiSend(noteOff2, 92, velocity); 2207 lastB[10][1] = 0; 2208 } 2209 2210 //B93 2211 if ((keysB[10][2] == 0) and (lastB[10][2] == 0)) { 2212 MidiSend(noteOn2, 93, velocity); 2213 lastB[10][2] = 7; 2214 } 2215 //Write Midi Note Off 2216 if ((keysB[10][2] == 1) and (lastB[10][2] == 7)) { 2217 MidiSend(noteOff2, 93, velocity); 2218 lastB[10][2] = 0; 2219 } 2220 2221 //B94 2222 if ((keysB[10][3] == 0) and (lastB[10][3] == 0)) { 2223 MidiSend(noteOn2, 94, velocity); 2224 lastB[10][3] = 7; 2225 } 2226 //Write Midi Note Off 2227 if ((keysB[10][3] == 1) and (lastB[10][3] == 7)) { 2228 MidiSend(noteOff2, 94, velocity); 2229 lastB[10][3] = 0; 2230 } 2231 2232 //B95 2233 if ((keysB[10][4] == 0) and (lastB[10][4] == 0)) { 2234 MidiSend(noteOn2, 95, velocity); 2235 lastB[10][4] = 7; 2236 } 2237 //Write Midi Note Off 2238 if ((keysB[10][4] == 1) and (lastB[10][4] == 7)) { 2239 MidiSend(noteOff2, 95, velocity); 2240 lastB[10][4] = 0; 2241 } 2242 2243 //B96 2244 if ((keysB[10][5] == 0) and (lastB[10][5] == 0)) { 2245 MidiSend(noteOn2, 96, velocity); 2246 lastB[10][5] = 7; 2247 } 2248 //Write Midi Note Off 2249 if ((keysB[10][5] == 1) and (lastB[10][5] == 7)) { 2250 MidiSend(noteOff2, 96, velocity); 2251 lastB[10][5] = 0; 2252 } 2253 2254 //Write Keyboard C 2255 2256 //C36 2257 if ((keysC[0][0] == 0) and (lastC[0][0] == 0)) { 2258 MidiSend(noteOn3, 36, velocity); 2259 lastC[0][0] = 7; 2260 } 2261 if ((keysC[0][0] == 1) and (lastC[0][0] == 7)) { 2262 MidiSend(noteOff3, 36, velocity); 2263 lastC[0][0] = 0; 2264 } 2265 2266 //C37 2267 if ((keysC[1][0] == 0) and (lastC[1][0] == 0)) { 2268 MidiSend(noteOn3, 37, velocity); 2269 lastC[1][0] = 7; 2270 } 2271 if ((keysC[1][0] == 1) and (lastC[1][0] == 7)) { 2272 MidiSend(noteOff3, 37, velocity); 2273 lastC[1][0] = 0; 2274 } 2275 2276 //C38 2277 if ((keysC[1][1] == 0) and (lastC[1][1] == 0)) { 2278 MidiSend(noteOn3, 38, velocity); 2279 lastC[1][1] = 7; 2280 } 2281 //Write Midi Note Off 2282 if ((keysC[1][1] == 1) and (lastC[1][1] == 7)) { 2283 MidiSend(noteOff3, 38, velocity); 2284 lastC[1][1] = 0; 2285 } 2286 2287 //C39 2288 if ((keysC[1][2] == 0) and (lastC[1][2] == 0)) { 2289 MidiSend(noteOn3, 39, velocity); 2290 lastC[1][2] = 7; 2291 } 2292 //Write Midi Note Off 2293 if ((keysC[1][2] == 1) and (lastC[1][2] == 7)) { 2294 MidiSend(noteOff3, 39, velocity); 2295 lastC[1][2] = 0; 2296 } 2297 2298 //C40 2299 if ((keysC[1][3] == 0) and (lastC[1][3] == 0)) { 2300 MidiSend(noteOn3, 40, velocity); 2301 lastC[1][3] = 7; 2302 } 2303 //Write Midi Note Off 2304 if ((keysC[1][3] == 1) and (lastC[1][3] == 7)) { 2305 MidiSend(noteOff3, 40, velocity); 2306 lastC[1][3] = 0; 2307 } 2308 2309 //C41 2310 if ((keysC[1][4] == 0) and (lastC[1][4] == 0)) { 2311 MidiSend(noteOn3, 41, velocity); 2312 lastC[1][4] = 7; 2313 } 2314 //Write Midi Note Off 2315 if ((keysC[1][4] == 1) and (lastC[1][4] == 7)) { 2316 MidiSend(noteOff3, 41, velocity); 2317 lastC[1][4] = 0; 2318 } 2319 2320 //C42 2321 if ((keysC[1][5] == 0) and (lastC[1][5] == 0)) { 2322 MidiSend(noteOn3, 42, velocity); 2323 lastC[1][5] = 7; 2324 } 2325 //Write Midi Note Off 2326 if ((keysC[1][5] == 1) and (lastC[1][5] == 7)) { 2327 MidiSend(noteOff3, 42, velocity); 2328 lastC[1][5] = 0; 2329 } 2330 2331 //C43 2332 if ((keysC[2][0] == 0) and (lastC[2][0] == 0)) { 2333 MidiSend(noteOn3, 43, velocity); 2334 lastC[2][0] = 7; 2335 } 2336 //Write Midi Note Off 2337 if ((keysC[2][0] == 1) and (lastC[2][0] == 7)) { 2338 MidiSend(noteOff3, 43, velocity); 2339 lastC[2][0] = 0; 2340 } 2341 2342 //C44 2343 if ((keysC[2][1] == 0) and (lastC[2][1] == 0)) { 2344 MidiSend(noteOn3, 44, velocity); 2345 lastC[2][1] = 7; 2346 } 2347 //Write Midi Note Off 2348 if ((keysC[2][1] == 1) and (lastC[2][1] == 7)) { 2349 MidiSend(noteOff3, 44, velocity); 2350 lastC[2][1] = 0; 2351 } 2352 2353 //B45 2354 if ((keysC[2][2] == 0) and (lastC[2][2] == 0)) { 2355 MidiSend(noteOn3, 45, velocity); 2356 lastC[2][2] = 7; 2357 } 2358 //Write Midi Note Off 2359 if ((keysC[2][2] == 1) and (lastC[2][2] == 7)) { 2360 MidiSend(noteOff3, 45, velocity); 2361 lastC[2][2] = 0; 2362 } 2363 2364 //C46 2365 if ((keysC[2][3] == 0) and (lastC[2][3] == 0)) { 2366 MidiSend(noteOn3, 46, velocity); 2367 lastC[2][3] = 7; 2368 } 2369 //Write Midi Note Off 2370 if ((keysC[2][3] == 1) and (lastC[2][3] == 7)) { 2371 MidiSend(noteOff3, 46, velocity); 2372 lastC[2][3] = 0; 2373 } 2374 2375 //C47 2376 if ((keysC[2][4] == 0) and (lastC[2][4] == 0)) { 2377 MidiSend(noteOn3, 47, velocity); 2378 lastC[2][4] = 7; 2379 } 2380 //Write Midi Note Off 2381 if ((keysC[2][4] == 1) and (lastC[2][4] == 7)) { 2382 MidiSend(noteOff3, 47, velocity); 2383 lastC[2][4] = 0; 2384 } 2385 2386 //C48 2387 if ((keysC[2][5] == 0) and (lastC[2][5] == 0)) { 2388 MidiSend(noteOn3, 48, velocity); 2389 lastC[2][5] = 7; 2390 } 2391 //Write Midi Note Off 2392 if ((keysC[2][5] == 1) and (lastC[2][5] == 7)) { 2393 MidiSend(noteOff3, 48, velocity); 2394 lastC[2][5] = 0; 2395 } 2396 2397 //C49 2398 if ((keysC[3][0] == 0) and (lastC[3][0] == 0)) { 2399 MidiSend(noteOn3, 49, velocity); 2400 lastC[3][0] = 7; 2401 } 2402 //Write Midi Note Off 2403 if ((keysC[3][0] == 1) and (lastC[3][0] == 7)) { 2404 MidiSend(noteOff3, 49, velocity); 2405 lastC[3][0] = 0; 2406 } 2407 2408 //C50 2409 if ((keysC[3][1] == 0) and (lastC[3][1] == 0)) { 2410 MidiSend(noteOn3, 50, velocity); 2411 lastC[3][1] = 7; 2412 } 2413 //Write Midi Note Off 2414 if ((keysC[3][1] == 1) and (lastC[3][1] == 7)) { 2415 MidiSend(noteOff3, 50, velocity); 2416 lastC[3][1] = 0; 2417 } 2418 2419 //C51 2420 if ((keysC[3][2] == 0) and (lastC[3][2] == 0)) { 2421 MidiSend(noteOn3, 51, velocity); 2422 lastC[3][2] = 7; 2423 } 2424 //Write Midi Note Off 2425 if ((keysC[3][2] == 1) and (lastC[3][2] == 7)) { 2426 MidiSend(noteOff3, 51, velocity); 2427 lastC[3][2] = 0; 2428 } 2429 2430 //C52 2431 if ((keysC[3][3] == 0) and (lastC[3][3] == 0)) { 2432 MidiSend(noteOn3, 52, velocity); 2433 lastC[3][3] = 7; 2434 } 2435 //Write Midi Note Off 2436 if ((keysC[3][3] == 1) and (lastC[3][3] == 7)) { 2437 MidiSend(noteOff3, 52, velocity); 2438 lastC[3][3] = 0; 2439 } 2440 2441 //C53 2442 if ((keysC[3][4] == 0) and (lastC[3][4] == 0)) { 2443 MidiSend(noteOn3, 53, velocity); 2444 lastC[3][4] = 7; 2445 } 2446 //Write Midi Note Off 2447 if ((keysC[3][4] == 1) and (lastC[3][4] == 7)) { 2448 MidiSend(noteOff3, 53, velocity); 2449 lastC[3][4] = 0; 2450 } 2451 2452 //C54 2453 if ((keysC[3][5] == 0) and (lastC[3][5] == 0)) { 2454 MidiSend(noteOn3, 54, velocity); 2455 lastC[3][5] = 7; 2456 } 2457 //Write Midi Note Off 2458 if ((keysC[3][5] == 1) and (lastC[3][5] == 7)) { 2459 MidiSend(noteOff3, 54, velocity); 2460 lastC[3][5] = 0; 2461 } 2462 2463 //C55 2464 if ((keysC[4][0] == 0) and (lastC[4][0] == 0)) { 2465 MidiSend(noteOn3, 55, velocity); 2466 lastC[4][0] = 7; 2467 } 2468 //Write Midi Note Off 2469 if ((keysC[4][0] == 1) and (lastC[4][0] == 7)) { 2470 MidiSend(noteOff3, 55, velocity); 2471 lastC[4][0] = 0; 2472 } 2473 2474 //C56 2475 if ((keysC[4][1] == 0) and (lastC[4][1] == 0)) { 2476 MidiSend(noteOn3, 56, velocity); 2477 lastC[4][1] = 7; 2478 } 2479 //Write Midi Note Off 2480 if ((keysC[4][1] == 1) and (lastC[4][1] == 7)) { 2481 MidiSend(noteOff3, 56, velocity); 2482 lastC[4][1] = 0; 2483 } 2484 2485 //C57 2486 if ((keysC[4][2] == 0) and (lastC[4][2] == 0)) { 2487 MidiSend(noteOn3, 57, velocity); 2488 lastC[4][2] = 7; 2489 } 2490 //Write Midi Note Off 2491 if ((keysC[4][2] == 1) and (lastC[4][2] == 7)) { 2492 MidiSend(noteOff3, 57, velocity); 2493 lastC[4][2] = 0; 2494 } 2495 2496 //C58 2497 if ((keysC[4][3] == 0) and (lastC[4][3] == 0)) { 2498 MidiSend(noteOn3, 58, velocity); 2499 lastC[4][3] = 7; 2500 } 2501 //Write Midi Note Off 2502 if ((keysC[4][3] == 1) and (lastC[4][3] == 7)) { 2503 MidiSend(noteOff3, 58, velocity); 2504 lastC[4][3] = 0; 2505 } 2506 2507 //C59 2508 if ((keysC[4][4] == 0) and (lastC[4][4] == 0)) { 2509 MidiSend(noteOn3, 59, velocity); 2510 lastC[4][4] = 7; 2511 } 2512 //Write Midi Note Off 2513 if ((keysC[4][4] == 1) and (lastC[4][4] == 7)) { 2514 MidiSend(noteOff3, 59, velocity); 2515 lastC[4][4] = 0; 2516 } 2517 2518 //C60 2519 if ((keysC[4][5] == 0) and (lastC[4][5] == 0)) { 2520 MidiSend(noteOn3, 60, velocity); 2521 lastC[4][5] = 7; 2522 } 2523 //Write Midi Note Off 2524 if ((keysC[4][5] == 1) and (lastC[4][5] == 7)) { 2525 MidiSend(noteOff3, 60, velocity); 2526 lastC[4][5] = 0; 2527 } 2528 2529 //C61 2530 if ((keysC[5][0] == 0) and (lastC[5][0] == 0)) { 2531 MidiSend(noteOn3, 61, velocity); 2532 lastC[5][0] = 7; 2533 } 2534 //Write Midi Note Off 2535 if ((keysC[5][0] == 1) and (lastC[5][0] == 7)) { 2536 MidiSend(noteOff3, 61, velocity); 2537 lastC[5][0] = 0; 2538 } 2539 2540 //C62 2541 if ((keysC[5][1] == 0) and (lastC[5][1] == 0)) { 2542 MidiSend(noteOn3, 62, velocity); 2543 lastC[5][1] = 7; 2544 } 2545 //Write Midi Note Off 2546 if ((keysC[5][1] == 1) and (lastC[5][1] == 7)) { 2547 MidiSend(noteOff3, 62, velocity); 2548 lastC[5][1] = 0; 2549 } 2550 2551 //C63 2552 if ((keysC[5][2] == 0) and (lastC[5][2] == 0)) { 2553 MidiSend(noteOn3, 63, velocity); 2554 lastC[5][2] = 7; 2555 } 2556 //Write Midi Note Off 2557 if ((keysC[5][2] == 1) and (lastC[5][2] == 7)) { 2558 MidiSend(noteOff3, 63, velocity); 2559 lastC[5][2] = 0; 2560 } 2561 2562 //C64 2563 if ((keysC[5][3] == 0) and (lastC[5][3] == 0)) { 2564 MidiSend(noteOn3, 64, velocity); 2565 lastC[5][3] = 7; 2566 } 2567 //Write Midi Note Off 2568 if ((keysC[5][3] == 1) and (lastC[5][3] == 7)) { 2569 MidiSend(noteOff3, 64, velocity); 2570 lastC[5][3] = 0; 2571 } 2572 2573 //C65 2574 if ((keysC[5][4] == 0) and (lastC[5][4] == 0)) { 2575 MidiSend(noteOn3, 65, velocity); 2576 lastC[5][4] = 7; 2577 } 2578 //Write Midi Note Off 2579 if ((keysC[5][4] == 1) and (lastC[5][4] == 7)) { 2580 MidiSend(noteOff3, 65, velocity); 2581 lastC[5][4] = 0; 2582 } 2583 2584 //C66 2585 if ((keysC[5][5] == 0) and (lastC[5][5] == 0)) { 2586 MidiSend(noteOn3, 66, velocity); 2587 lastC[5][5] = 7; 2588 } 2589 //Write Midi Note Off 2590 if ((keysC[5][5] == 1) and (lastC[5][5] == 7)) { 2591 MidiSend(noteOff3, 66, velocity); 2592 lastC[5][5] = 0; 2593 } 2594 2595 //C67 2596 if ((keysC[6][0] == 0) and (lastC[6][0] == 0)) { 2597 MidiSend(noteOn3, 67, velocity); 2598 lastC[6][0] = 7; 2599 } 2600 //Write Midi Note Off 2601 if ((keysC[6][0] == 1) and (lastC[6][0] == 7)) { 2602 MidiSend(noteOff3, 67, velocity); 2603 lastC[6][0] = 0; 2604 } 2605 2606 //C68 2607 if ((keysC[6][1] == 0) and (lastC[6][1] == 0)) { 2608 MidiSend(noteOn3, 68, velocity); 2609 lastC[6][1] = 7; 2610 } 2611 //Write Midi Note Off 2612 if ((keysC[6][1] == 1) and (lastC[6][1] == 7)) { 2613 MidiSend(noteOff3, 68, velocity); 2614 lastC[6][1] = 0; 2615 } 2616 2617 //C69 2618 if ((keysC[6][2] == 0) and (lastC[6][2] == 0)) { 2619 MidiSend(noteOn3, 69, velocity); 2620 lastC[6][2] = 7; 2621 } 2622 //Write Midi Note Off 2623 if ((keysC[6][2] == 1) and (lastC[6][2] == 7)) { 2624 MidiSend(noteOff3, 69, velocity); 2625 lastC[6][2] = 0; 2626 } 2627 2628 //C70 2629 if ((keysC[6][3] == 0) and (lastC[6][3] == 0)) { 2630 MidiSend(noteOn3, 70, velocity); 2631 lastC[6][3] = 7; 2632 } 2633 //Write Midi Note Off 2634 if ((keysC[6][3] == 1) and (lastC[6][3] == 7)) { 2635 MidiSend(noteOff3, 70, velocity); 2636 lastC[6][3] = 0; 2637 } 2638 2639 //C71 2640 if ((keysC[6][4] == 0) and (lastC[6][4] == 0)) { 2641 MidiSend(noteOn3, 71, velocity); 2642 lastC[6][4] = 7; 2643 } 2644 //Write Midi Note Off 2645 if ((keysC[6][4] == 1) and (lastC[6][4] == 7)) { 2646 MidiSend(noteOff3, 71, velocity); 2647 lastC[6][4] = 0; 2648 } 2649 2650 //C72 2651 if ((keysC[6][5] == 0) and (lastC[6][5] == 0)) { 2652 MidiSend(noteOn3, 72, velocity); 2653 lastC[6][5] = 7; 2654 } 2655 //Write Midi Note Off 2656 if ((keysC[6][5] == 1) and (lastC[6][5] == 7)) { 2657 MidiSend(noteOff3, 72, velocity); 2658 lastC[6][5] = 0; 2659 } 2660 2661 //C73 2662 if ((keysC[7][0] == 0) and (lastC[7][0] == 0)) { 2663 MidiSend(noteOn3, 73, velocity); 2664 lastC[7][0] = 7; 2665 } 2666 //Write Midi Note Off 2667 if ((keysC[7][0] == 1) and (lastC[7][0] == 7)) { 2668 MidiSend(noteOff3, 73, velocity); 2669 lastC[7][0] = 0; 2670 } 2671 2672 //C74 2673 if ((keysC[7][1] == 0) and (lastC[7][1] == 0)) { 2674 MidiSend(noteOn3, 74, velocity); 2675 lastC[7][1] = 7; 2676 } 2677 //Write Midi Note Off 2678 if ((keysC[7][1] == 1) and (lastC[7][1] == 7)) { 2679 MidiSend(noteOff3, 74, velocity); 2680 lastC[7][1] = 0; 2681 } 2682 2683 //C75 2684 if ((keysC[7][2] == 0) and (lastC[7][2] == 0)) { 2685 MidiSend(noteOn3, 75, velocity); 2686 lastC[7][2] = 7; 2687 } 2688 //Write Midi Note Off 2689 if ((keysC[7][2] == 1) and (lastC[7][2] == 7)) { 2690 MidiSend(noteOff3, 75, velocity); 2691 lastC[7][2] = 0; 2692 } 2693 2694 //C76 2695 if ((keysC[7][3] == 0) and (lastC[7][3] == 0)) { 2696 MidiSend(noteOn3, 76, velocity); 2697 lastC[7][3] = 7; 2698 } 2699 //Write Midi Note Off 2700 if ((keysC[7][3] == 1) and (lastC[7][3] == 7)) { 2701 MidiSend(noteOff3, 76, velocity); 2702 lastC[7][3] = 0; 2703 } 2704 2705 //C77 2706 if ((keysC[7][4] == 0) and (lastC[7][4] == 0)) { 2707 MidiSend(noteOn3, 77, velocity); 2708 lastC[7][4] = 7; 2709 } 2710 //Write Midi Note Off 2711 if ((keysC[7][4] == 1) and (lastC[7][4] == 7)) { 2712 MidiSend(noteOff3, 77, velocity); 2713 lastC[7][4] = 0; 2714 } 2715 2716 //C78 2717 if ((keysC[7][5] == 0) and (lastC[7][5] == 0)) { 2718 MidiSend(noteOn3, 78, velocity); 2719 lastC[7][5] = 7; 2720 } 2721 //Write Midi Note Off 2722 if ((keysC[7][5] == 1) and (lastC[7][5] == 7)) { 2723 MidiSend(noteOff3, 78, velocity); 2724 lastC[7][5] = 0; 2725 } 2726 2727 //C79 2728 if ((keysC[8][0] == 0) and (lastC[8][0] == 0)) { 2729 MidiSend(noteOn3, 79, velocity); 2730 lastC[8][0] = 7; 2731 } 2732 //Write Midi Note Off 2733 if ((keysC[8][0] == 1) and (lastC[8][0] == 7)) { 2734 MidiSend(noteOff2, 79, velocity); 2735 lastC[8][0] = 0; 2736 } 2737 2738 //C80 2739 if ((keysC[8][1] == 0) and (lastC[8][1] == 0)) { 2740 MidiSend(noteOn3, 80, velocity); 2741 lastC[8][1] = 7; 2742 } 2743 //Write Midi Note Off 2744 if ((keysC[8][1] == 1) and (lastC[8][1] == 7)) { 2745 MidiSend(noteOff3, 80, velocity); 2746 lastC[8][1] = 0; 2747 } 2748 2749 //C81 2750 if ((keysC[8][2] == 0) and (lastC[8][2] == 0)) { 2751 MidiSend(noteOn3, 81, velocity); 2752 lastC[8][2] = 7; 2753 } 2754 //Write Midi Note Off 2755 if ((keysC[8][2] == 1) and (lastC[8][2] == 7)) { 2756 MidiSend(noteOff3, 81, velocity); 2757 lastC[8][2] = 0; 2758 } 2759 2760 //C82 2761 if ((keysC[8][3] == 0) and (lastC[8][3] == 0)) { 2762 MidiSend(noteOn3, 82, velocity); 2763 lastC[8][3] = 7; 2764 } 2765 //Write Midi Note Off 2766 if ((keysC[8][3] == 1) and (lastC[8][3] == 7)) { 2767 MidiSend(noteOff3, 82, velocity); 2768 lastC[8][3] = 0; 2769 } 2770 2771 //C83 2772 if ((keysC[8][4] == 0) and (lastC[8][4] == 0)) { 2773 MidiSend(noteOn3, 83, velocity); 2774 lastC[8][4] = 7; 2775 } 2776 //Write Midi Note Off 2777 if ((keysC[8][4] == 1) and (lastC[8][4] == 7)) { 2778 MidiSend(noteOff3, 83, velocity); 2779 lastC[8][4] = 0; 2780 } 2781 2782 //C84 2783 if ((keysC[8][5] == 0) and (lastC[8][5] == 0)) { 2784 MidiSend(noteOn3, 84, velocity); 2785 lastC[8][5] = 7; 2786 } 2787 //Write Midi Note Off 2788 if ((keysC[8][5] == 1) and (lastC[8][5] == 7)) { 2789 MidiSend(noteOff3, 84, velocity); 2790 lastC[8][5] = 0; 2791 } 2792 2793 //C85 2794 if ((keysC[9][0] == 0) and (lastC[9][0] == 0)) { 2795 MidiSend(noteOn3, 85, velocity); 2796 lastC[9][0] = 7; 2797 } 2798 //Write Midi Note Off 2799 if ((keysC[9][0] == 1) and (lastC[9][0] == 7)) { 2800 MidiSend(noteOff3, 85, velocity); 2801 lastC[9][0] = 0; 2802 } 2803 2804 //C86 2805 if ((keysC[9][1] == 0) and (lastC[9][1] == 0)) { 2806 MidiSend(noteOn2, 86, velocity); 2807 lastC[9][1] = 7; 2808 } 2809 //Write Midi Note Off 2810 if ((keysC[9][1] == 1) and (lastC[9][1] == 7)) { 2811 MidiSend(noteOff3, 86, velocity); 2812 lastC[9][1] = 0; 2813 } 2814 2815 //C87 2816 if ((keysC[9][2] == 0) and (lastC[9][2] == 0)) { 2817 MidiSend(noteOn3, 87, velocity); 2818 lastC[9][2] = 7; 2819 } 2820 //Write Midi Note Off 2821 if ((keysC[9][2] == 1) and (lastC[9][2] == 7)) { 2822 MidiSend(noteOff3, 87, velocity); 2823 lastC[9][2] = 0; 2824 } 2825 2826 //C88 2827 if ((keysC[9][3] == 0) and (lastC[9][3] == 0)) { 2828 MidiSend(noteOn3, 88, velocity); 2829 lastC[9][3] = 7; 2830 } 2831 //Write Midi Note Off 2832 if ((keysC[9][3] == 1) and (lastC[9][3] == 7)) { 2833 MidiSend(noteOff3, 88, velocity); 2834 lastC[9][3] = 0; 2835 } 2836 2837 //C89 2838 if ((keysC[9][4] == 0) and (lastC[9][4] == 0)) { 2839 MidiSend(noteOn3, 89, velocity); 2840 lastC[9][4] = 7; 2841 } 2842 //Write Midi Note Off 2843 if ((keysC[9][4] == 1) and (lastC[9][4] == 7)) { 2844 MidiSend(noteOff3, 89, velocity); 2845 lastC[9][4] = 0; 2846 } 2847 2848 //C90 2849 if ((keysC[9][5] == 0) and (lastC[9][5] == 0)) { 2850 MidiSend(noteOn3, 90, velocity); 2851 lastC[9][5] = 7; 2852 } 2853 //Write Midi Note Off 2854 if ((keysC[9][5] == 1) and (lastC[9][5] == 7)) { 2855 MidiSend(noteOff3, 90, velocity); 2856 lastC[9][5] = 0; 2857 } 2858 2859 //C91 2860 if ((keysC[10][0] == 0) and (lastC[10][0] == 0)) { 2861 MidiSend(noteOn3, 91, velocity); 2862 lastC[10][0] = 7; 2863 } 2864 //Write Midi Note Off 2865 if ((keysC[10][0] == 1) and (lastC[10][0] == 7)) { 2866 MidiSend(noteOff3, 91, velocity); 2867 lastC[10][0] = 0; 2868 } 2869 2870 //C92 2871 if ((keysC[10][1] == 0) and (lastC[10][1] == 0)) { 2872 MidiSend(noteOn3, 92, velocity); 2873 lastC[10][1] = 7; 2874 } 2875 //Write Midi Note Off 2876 if ((keysC[10][1] == 1) and (lastC[10][1] == 7)) { 2877 MidiSend(noteOff3, 92, velocity); 2878 lastC[10][1] = 0; 2879 } 2880 2881 //C93 2882 if ((keysC[10][2] == 0) and (lastC[10][2] == 0)) { 2883 MidiSend(noteOn3, 93, velocity); 2884 lastC[10][2] = 7; 2885 } 2886 //Write Midi Note Off 2887 if ((keysC[10][2] == 1) and (lastC[10][2] == 7)) { 2888 MidiSend(noteOff3, 93, velocity); 2889 lastC[10][2] = 0; 2890 } 2891 2892 //C94 2893 if ((keysC[10][3] == 0) and (lastC[10][3] == 0)) { 2894 MidiSend(noteOn3, 94, velocity); 2895 lastC[10][3] = 7; 2896 } 2897 //Write Midi Note Off 2898 if ((keysC[10][3] == 1) and (lastC[10][3] == 7)) { 2899 MidiSend(noteOff3, 94, velocity); 2900 lastC[10][3] = 0; 2901 } 2902 2903 //C95 2904 if ((keysC[10][4] == 0) and (lastC[10][4] == 0)) { 2905 MidiSend(noteOn3, 95, velocity); 2906 lastC[10][4] = 7; 2907 } 2908 //Write Midi Note Off 2909 if ((keysC[10][4] == 1) and (lastC[10][4] == 7)) { 2910 MidiSend(noteOff3, 95, velocity); 2911 lastC[10][4] = 0; 2912 } 2913 2914 //C96 2915 if ((keysC[10][5] == 0) and (lastC[10][5] == 0)) { 2916 MidiSend(noteOn3, 96, velocity); 2917 lastC[10][5] = 7; 2918 } 2919 //Write Midi Note Off 2920 if ((keysC[10][5] == 1) and (lastC[10][5] == 7)) { 2921 MidiSend(noteOff3, 96, velocity); 2922 lastC[10][5] = 0; 2923 } 2924 2925 //Write Keyboard D 2926 2927 //D36 2928 if ((keysD[0][0] == 0) and (lastD[0][0] == 0)) { 2929 MidiSend(noteOn4, 36, velocity); 2930 lastD[0][0] = 7; 2931 } 2932 if ((keysD[0][0] == 1) and (lastD[0][0] == 7)) { 2933 MidiSend(noteOff4, 36, velocity); 2934 lastD[0][0] = 0; 2935 } 2936 2937 //D37 2938 if ((keysD[1][0] == 0) and (lastD[1][0] == 0)) { 2939 MidiSend(noteOn4, 37, velocity); 2940 lastD[1][0] = 7; 2941 } 2942 if ((keysD[1][0] == 1) and (lastD[1][0] == 7)) { 2943 MidiSend(noteOff4, 37, velocity); 2944 lastD[1][0] = 0; 2945 } 2946 2947 //D38 2948 if ((keysD[1][1] == 0) and (lastD[1][1] == 0)) { 2949 MidiSend(noteOn4, 38, velocity); 2950 lastD[1][1] = 7; 2951 } 2952 //Write Midi Note Off 2953 if ((keysD[1][1] == 1) and (lastD[1][1] == 7)) { 2954 MidiSend(noteOff4, 38, velocity); 2955 lastD[1][1] = 0; 2956 } 2957 2958 //D39 2959 if ((keysD[1][2] == 0) and (lastD[1][2] == 0)) { 2960 MidiSend(noteOn4, 39, velocity); 2961 lastD[1][2] = 7; 2962 } 2963 //Write Midi Note Off 2964 if ((keysD[1][2] == 1) and (lastD[1][2] == 7)) { 2965 MidiSend(noteOff4, 39, velocity); 2966 lastD[1][2] = 0; 2967 } 2968 2969 //D40 2970 if ((keysD[1][3] == 0) and (lastD[1][3] == 0)) { 2971 MidiSend(noteOn4, 40, velocity); 2972 lastD[1][3] = 7; 2973 } 2974 //Write Midi Note Off 2975 if ((keysD[1][3] == 1) and (lastD[1][3] == 7)) { 2976 MidiSend(noteOff4, 40, velocity); 2977 lastD[1][3] = 0; 2978 } 2979 2980 //D41 2981 if ((keysD[1][4] == 0) and (lastD[1][4] == 0)) { 2982 MidiSend(noteOn4, 41, velocity); 2983 lastD[1][4] = 7; 2984 } 2985 //Write Midi Note Off 2986 if ((keysD[1][4] == 1) and (lastD[1][4] == 7)) { 2987 MidiSend(noteOff4, 41, velocity); 2988 lastD[1][4] = 0; 2989 } 2990 2991 //D42 2992 if ((keysD[1][5] == 0) and (lastD[1][5] == 0)) { 2993 MidiSend(noteOn4, 42, velocity); 2994 lastD[1][5] = 7; 2995 } 2996 //Write Midi Note Off 2997 if ((keysD[1][5] == 1) and (lastD[1][5] == 7)) { 2998 MidiSend(noteOff4, 42, velocity); 2999 lastD[1][5] = 0; 3000 } 3001 3002 //D43 3003 if ((keysD[2][0] == 0) and (lastD[2][0] == 0)) { 3004 MidiSend(noteOn4, 43, velocity); 3005 lastD[2][0] = 7; 3006 } 3007 //Write Midi Note Off 3008 if ((keysD[2][0] == 1) and (lastD[2][0] == 7)) { 3009 MidiSend(noteOff4, 43, velocity); 3010 lastD[2][0] = 0; 3011 } 3012 3013 //B44 3014 if ((keysD[2][1] == 0) and (lastD[2][1] == 0)) { 3015 MidiSend(noteOn4, 44, velocity); 3016 lastD[2][1] = 7; 3017 } 3018 //Write Midi Note Off 3019 if ((keysD[2][1] == 1) and (lastD[2][1] == 7)) { 3020 MidiSend(noteOff4, 44, velocity); 3021 lastD[2][1] = 0; 3022 } 3023 3024 //D45 3025 if ((keysD[2][2] == 0) and (lastD[2][2] == 0)) { 3026 MidiSend(noteOn4, 45, velocity); 3027 lastD[2][2] = 7; 3028 } 3029 //Write Midi Note Off 3030 if ((keysD[2][2] == 1) and (lastD[2][2] == 7)) { 3031 MidiSend(noteOff4, 45, velocity); 3032 lastD[2][2] = 0; 3033 } 3034 3035 //D46 3036 if ((keysD[2][3] == 0) and (lastD[2][3] == 0)) { 3037 MidiSend(noteOn4, 46, velocity); 3038 lastD[2][3] = 7; 3039 } 3040 //Write Midi Note Off 3041 if ((keysD[2][3] == 1) and (lastD[2][3] == 7)) { 3042 MidiSend(noteOff4, 46, velocity); 3043 lastD[2][3] = 0; 3044 } 3045 3046 //D47 3047 if ((keysD[2][4] == 0) and (lastD[2][4] == 0)) { 3048 MidiSend(noteOn4, 47, velocity); 3049 lastD[2][4] = 7; 3050 } 3051 //Write Midi Note Off 3052 if ((keysD[2][4] == 1) and (lastD[2][4] == 7)) { 3053 MidiSend(noteOff4, 47, velocity); 3054 lastD[2][4] = 0; 3055 } 3056 3057 //D48 3058 if ((keysD[2][5] == 0) and (lastD[2][5] == 0)) { 3059 MidiSend(noteOn4, 48, velocity); 3060 lastD[2][5] = 7; 3061 } 3062 //Write Midi Note Off 3063 if ((keysD[2][5] == 1) and (lastD[2][5] == 7)) { 3064 MidiSend(noteOff4, 48, velocity); 3065 lastD[2][5] = 0; 3066 } 3067 3068 //D49 3069 if ((keysD[3][0] == 0) and (lastD[3][0] == 0)) { 3070 MidiSend(noteOn4, 49, velocity); 3071 lastD[3][0] = 7; 3072 } 3073 //Write Midi Note Off 3074 if ((keysD[3][0] == 1) and (lastD[3][0] == 7)) { 3075 MidiSend(noteOff4, 49, velocity); 3076 lastD[3][0] = 0; 3077 } 3078 3079 //D50 3080 if ((keysD[3][1] == 0) and (lastD[3][1] == 0)) { 3081 MidiSend(noteOn4, 50, velocity); 3082 lastD[3][1] = 7; 3083 } 3084 //Write Midi Note Off 3085 if ((keysD[3][1] == 1) and (lastD[3][1] == 7)) { 3086 MidiSend(noteOff4, 50, velocity); 3087 lastD[3][1] = 0; 3088 } 3089 3090 //D51 3091 if ((keysD[3][2] == 0) and (lastD[3][2] == 0)) { 3092 MidiSend(noteOn4, 51, velocity); 3093 lastD[3][2] = 7; 3094 } 3095 //Write Midi Note Off 3096 if ((keysD[3][2] == 1) and (lastD[3][2] == 7)) { 3097 MidiSend(noteOff4, 51, velocity); 3098 lastD[3][2] = 0; 3099 } 3100 3101 //D52 3102 if ((keysD[3][3] == 0) and (lastD[3][3] == 0)) { 3103 MidiSend(noteOn4, 52, velocity); 3104 lastD[3][3] = 7; 3105 } 3106 //Write Midi Note Off 3107 if ((keysD[3][3] == 1) and (lastD[3][3] == 7)) { 3108 MidiSend(noteOff4, 52, velocity); 3109 lastD[3][3] = 0; 3110 } 3111 3112 //D53 3113 if ((keysD[3][4] == 0) and (lastD[3][4] == 0)) { 3114 MidiSend(noteOn4, 53, velocity); 3115 lastD[3][4] = 7; 3116 } 3117 //Write Midi Note Off 3118 if ((keysD[3][4] == 1) and (lastD[3][4] == 7)) { 3119 MidiSend(noteOff4, 53, velocity); 3120 lastD[3][4] = 0; 3121 } 3122 3123 //D54 3124 if ((keysD[3][5] == 0) and (lastD[3][5] == 0)) { 3125 MidiSend(noteOn4, 54, velocity); 3126 lastD[3][5] = 7; 3127 } 3128 //Write Midi Note Off 3129 if ((keysD[3][5] == 1) and (lastD[3][5] == 7)) { 3130 MidiSend(noteOff4, 54, velocity); 3131 lastD[3][5] = 0; 3132 } 3133 3134 //D55 3135 if ((keysD[4][0] == 0) and (lastD[4][0] == 0)) { 3136 MidiSend(noteOn4, 55, velocity); 3137 lastD[4][0] = 7; 3138 } 3139 //Write Midi Note Off 3140 if ((keysD[4][0] == 1) and (lastD[4][0] == 7)) { 3141 MidiSend(noteOff4, 55, velocity); 3142 lastD[4][0] = 0; 3143 } 3144 3145 //D56 3146 if ((keysD[4][1] == 0) and (lastD[4][1] == 0)) { 3147 MidiSend(noteOn4, 56, velocity); 3148 lastD[4][1] = 7; 3149 } 3150 //Write Midi Note Off 3151 if ((keysD[4][1] == 1) and (lastD[4][1] == 7)) { 3152 MidiSend(noteOff4, 56, velocity); 3153 lastD[4][1] = 0; 3154 } 3155 3156 //D57 3157 if ((keysD[4][2] == 0) and (lastD[4][2] == 0)) { 3158 MidiSend(noteOn4, 57, velocity); 3159 lastD[4][2] = 7; 3160 } 3161 //Write Midi Note Off 3162 if ((keysD[4][2] == 1) and (lastD[4][2] == 7)) { 3163 MidiSend(noteOff4, 57, velocity); 3164 lastD[4][2] = 0; 3165 } 3166 3167 //D58 3168 if ((keysD[4][3] == 0) and (lastD[4][3] == 0)) { 3169 MidiSend(noteOn4, 58, velocity); 3170 lastD[4][3] = 7; 3171 } 3172 //Write Midi Note Off 3173 if ((keysD[4][3] == 1) and (lastD[4][3] == 7)) { 3174 MidiSend(noteOff4, 58, velocity); 3175 lastD[4][3] = 0; 3176 } 3177 3178 //D59 3179 if ((keysD[4][4] == 0) and (lastD[4][4] == 0)) { 3180 MidiSend(noteOn4, 59, velocity); 3181 lastD[4][4] = 7; 3182 } 3183 //Write Midi Note Off 3184 if ((keysD[4][4] == 1) and (lastD[4][4] == 7)) { 3185 MidiSend(noteOff4, 59, velocity); 3186 lastD[4][4] = 0; 3187 } 3188 3189 //D60 3190 if ((keysD[4][5] == 0) and (lastD[4][5] == 0)) { 3191 MidiSend(noteOn4, 60, velocity); 3192 lastD[4][5] = 7; 3193 } 3194 //Write Midi Note Off 3195 if ((keysD[4][5] == 1) and (lastD[4][5] == 7)) { 3196 MidiSend(noteOff4, 60, velocity); 3197 lastD[4][5] = 0; 3198 } 3199 3200 //D61 3201 if ((keysD[5][0] == 0) and (lastD[5][0] == 0)) { 3202 MidiSend(noteOn4, 61, velocity); 3203 lastD[5][0] = 7; 3204 } 3205 //Write Midi Note Off 3206 if ((keysD[5][0] == 1) and (lastD[5][0] == 7)) { 3207 MidiSend(noteOff4, 61, velocity); 3208 lastD[5][0] = 0; 3209 } 3210 3211 //D62 3212 if ((keysD[5][1] == 0) and (lastD[5][1] == 0)) { 3213 MidiSend(noteOn4, 62, velocity); 3214 lastD[5][1] = 7; 3215 } 3216 //Write Midi Note Off 3217 if ((keysD[5][1] == 1) and (lastD[5][1] == 7)) { 3218 MidiSend(noteOff4, 62, velocity); 3219 lastD[5][1] = 0; 3220 } 3221 3222 //D63 3223 if ((keysD[5][2] == 0) and (lastD[5][2] == 0)) { 3224 MidiSend(noteOn4, 63, velocity); 3225 lastD[5][2] = 7; 3226 } 3227 //Write Midi Note Off 3228 if ((keysD[5][2] == 1) and (lastD[5][2] == 7)) { 3229 MidiSend(noteOff4, 63, velocity); 3230 lastD[5][2] = 0; 3231 } 3232 3233 //D64 3234 if ((keysD[5][3] == 0) and (lastD[5][3] == 0)) { 3235 MidiSend(noteOn4, 64, velocity); 3236 lastD[5][3] = 7; 3237 } 3238 //Write Midi Note Off 3239 if ((keysD[5][3] == 1) and (lastD[5][3] == 7)) { 3240 MidiSend(noteOff4, 64, velocity); 3241 lastD[5][3] = 0; 3242 } 3243 3244 //D65 3245 if ((keysD[5][4] == 0) and (lastD[5][4] == 0)) { 3246 MidiSend(noteOn4, 65, velocity); 3247 lastD[5][4] = 7; 3248 } 3249 //Write Midi Note Off 3250 if ((keysD[5][4] == 1) and (lastD[5][4] == 7)) { 3251 MidiSend(noteOff4, 65, velocity); 3252 lastD[5][4] = 0; 3253 } 3254 3255 //D66 3256 if ((keysD[5][5] == 0) and (lastD[5][5] == 0)) { 3257 MidiSend(noteOn4, 66, velocity); 3258 lastD[5][5] = 7; 3259 } 3260 //Write Midi Note Off 3261 if ((keysD[5][5] == 1) and (lastD[5][5] == 7)) { 3262 MidiSend(noteOff4, 66, velocity); 3263 lastD[5][5] = 0; 3264 } 3265 3266 //D67 3267 if ((keysD[6][0] == 0) and (lastD[6][0] == 0)) { 3268 MidiSend(noteOn4, 67, velocity); 3269 lastD[6][0] = 7; 3270 } 3271 //Write Midi Note Off 3272 if ((keysD[6][0] == 1) and (lastD[6][0] == 7)) { 3273 MidiSend(noteOff4, 67, velocity); 3274 lastD[6][0] = 0; 3275 } 3276 3277 //D68 3278 if ((keysD[6][1] == 0) and (lastD[6][1] == 0)) { 3279 MidiSend(noteOn4, 68, velocity); 3280 lastD[6][1] = 7; 3281 } 3282 //Write Midi Note Off 3283 if ((keysD[6][1] == 1) and (lastD[6][1] == 7)) { 3284 MidiSend(noteOff4, 68, velocity); 3285 lastD[6][1] = 0; 3286 } 3287 3288 //D69 3289 if ((keysD[6][2] == 0) and (lastD[6][2] == 0)) { 3290 MidiSend(noteOn4, 69, velocity); 3291 lastD[6][2] = 7; 3292 } 3293 //Write Midi Note Off 3294 if ((keysD[6][2] == 1) and (lastD[6][2] == 7)) { 3295 MidiSend(noteOff4, 69, velocity); 3296 lastD[6][2] = 0; 3297 } 3298 3299 //D70 3300 if ((keysD[6][3] == 0) and (lastD[6][3] == 0)) { 3301 MidiSend(noteOn4, 70, velocity); 3302 lastD[6][3] = 7; 3303 } 3304 //Write Midi Note Off 3305 if ((keysD[6][3] == 1) and (lastD[6][3] == 7)) { 3306 MidiSend(noteOff4, 70, velocity); 3307 lastD[6][3] = 0; 3308 } 3309 3310 //D71 3311 if ((keysD[6][4] == 0) and (lastD[6][4] == 0)) { 3312 MidiSend(noteOn4, 71, velocity); 3313 lastD[6][4] = 7; 3314 } 3315 //Write Midi Note Off 3316 if ((keysD[6][4] == 1) and (lastD[6][4] == 7)) { 3317 MidiSend(noteOff4, 71, velocity); 3318 lastD[6][4] = 0; 3319 } 3320 3321 //D72 3322 if ((keysD[6][5] == 0) and (lastD[6][5] == 0)) { 3323 MidiSend(noteOn4, 72, velocity); 3324 lastD[6][5] = 7; 3325 } 3326 //Write Midi Note Off 3327 if ((keysD[6][5] == 1) and (lastD[6][5] == 7)) { 3328 MidiSend(noteOff4, 72, velocity); 3329 lastD[6][5] = 0; 3330 } 3331 3332 //D73 3333 if ((keysD[7][0] == 0) and (lastD[7][0] == 0)) { 3334 MidiSend(noteOn4, 73, velocity); 3335 lastD[7][0] = 7; 3336 } 3337 //Write Midi Note Off 3338 if ((keysD[7][0] == 1) and (lastD[7][0] == 7)) { 3339 MidiSend(noteOff4, 73, velocity); 3340 lastD[7][0] = 0; 3341 } 3342 3343 //D74 3344 if ((keysD[7][1] == 0) and (lastD[7][1] == 0)) { 3345 MidiSend(noteOn4, 74, velocity); 3346 lastD[7][1] = 7; 3347 } 3348 //Write Midi Note Off 3349 if ((keysD[7][1] == 1) and (lastD[7][1] == 7)) { 3350 MidiSend(noteOff4, 74, velocity); 3351 lastD[7][1] = 0; 3352 } 3353 3354 //D75 3355 if ((keysD[7][2] == 0) and (lastD[7][2] == 0)) { 3356 MidiSend(noteOn4, 75, velocity); 3357 lastD[7][2] = 7; 3358 } 3359 //Write Midi Note Off 3360 if ((keysD[7][2] == 1) and (lastD[7][2] == 7)) { 3361 MidiSend(noteOff4, 75, velocity); 3362 lastD[7][2] = 0; 3363 } 3364 3365 //D76 3366 if ((keysD[7][3] == 0) and (lastD[7][3] == 0)) { 3367 MidiSend(noteOn4, 76, velocity); 3368 lastD[7][3] = 7; 3369 } 3370 //Write Midi Note Off 3371 if ((keysD[7][3] == 1) and (lastD[7][3] == 7)) { 3372 MidiSend(noteOff4, 76, velocity); 3373 lastD[7][3] = 0; 3374 } 3375 3376 //D77 3377 if ((keysD[7][4] == 0) and (lastD[7][4] == 0)) { 3378 MidiSend(noteOn4, 77, velocity); 3379 lastD[7][4] = 7; 3380 } 3381 //Write Midi Note Off 3382 if ((keysD[7][4] == 1) and (lastD[7][4] == 7)) { 3383 MidiSend(noteOff4, 77, velocity); 3384 lastD[7][4] = 0; 3385 } 3386 3387 //D78 3388 if ((keysD[7][5] == 0) and (lastD[7][5] == 0)) { 3389 MidiSend(noteOn4, 78, velocity); 3390 lastD[7][5] = 7; 3391 } 3392 //Write Midi Note Off 3393 if ((keysD[7][5] == 1) and (lastD[7][5] == 7)) { 3394 MidiSend(noteOff4, 78, velocity); 3395 lastD[7][5] = 0; 3396 } 3397 3398 //D79 3399 if ((keysD[8][0] == 0) and (lastD[8][0] == 0)) { 3400 MidiSend(noteOn4, 79, velocity); 3401 lastD[8][0] = 7; 3402 } 3403 //Write Midi Note Off 3404 if ((keysD[8][0] == 1) and (lastD[8][0] == 7)) { 3405 MidiSend(noteOff4, 79, velocity); 3406 lastD[8][0] = 0; 3407 } 3408 3409 //D80 3410 if ((keysD[8][1] == 0) and (lastD[8][1] == 0)) { 3411 MidiSend(noteOn4, 80, velocity); 3412 lastD[8][1] = 7; 3413 } 3414 //Write Midi Note Off 3415 if ((keysD[8][1] == 1) and (lastD[8][1] == 7)) { 3416 MidiSend(noteOff4, 80, velocity); 3417 lastD[8][1] = 0; 3418 } 3419 3420 //D81 3421 if ((keysD[8][2] == 0) and (lastD[8][2] == 0)) { 3422 MidiSend(noteOn4, 81, velocity); 3423 lastD[8][2] = 7; 3424 } 3425 //Write Midi Note Off 3426 if ((keysD[8][2] == 1) and (lastD[8][2] == 7)) { 3427 MidiSend(noteOff4, 81, velocity); 3428 lastD[8][2] = 0; 3429 } 3430 3431 //D82 3432 if ((keysD[8][3] == 0) and (lastD[8][3] == 0)) { 3433 MidiSend(noteOn4, 82, velocity); 3434 lastD[8][3] = 7; 3435 } 3436 //Write Midi Note Off 3437 if ((keysD[8][3] == 1) and (lastD[8][3] == 7)) { 3438 MidiSend(noteOff4, 82, velocity); 3439 lastD[8][3] = 0; 3440 } 3441 3442 //D83 3443 if ((keysD[8][4] == 0) and (lastD[8][4] == 0)) { 3444 MidiSend(noteOn4, 83, velocity); 3445 lastD[8][4] = 7; 3446 } 3447 //Write Midi Note Off 3448 if ((keysD[8][4] == 1) and (lastD[8][4] == 7)) { 3449 MidiSend(noteOff4, 83, velocity); 3450 lastD[8][4] = 0; 3451 } 3452 3453 //D84 3454 if ((keysD[8][5] == 0) and (lastD[8][5] == 0)) { 3455 MidiSend(noteOn4, 84, velocity); 3456 lastD[8][5] = 7; 3457 } 3458 //Write Midi Note Off 3459 if ((keysD[8][5] == 1) and (lastD[8][5] == 7)) { 3460 MidiSend(noteOff4, 84, velocity); 3461 lastD[8][5] = 0; 3462 } 3463 3464 //D85 3465 if ((keysD[9][0] == 0) and (lastD[9][0] == 0)) { 3466 MidiSend(noteOn4, 85, velocity); 3467 lastD[9][0] = 7; 3468 } 3469 //Write Midi Note Off 3470 if ((keysD[9][0] == 1) and (lastD[9][0] == 7)) { 3471 MidiSend(noteOff4, 85, velocity); 3472 lastD[9][0] = 0; 3473 } 3474 3475 //D86 3476 if ((keysD[9][1] == 0) and (lastD[9][1] == 0)) { 3477 MidiSend(noteOn4, 86, velocity); 3478 lastD[9][1] = 7; 3479 } 3480 //Write Midi Note Off 3481 if ((keysD[9][1] == 1) and (lastD[9][1] == 7)) { 3482 MidiSend(noteOff4, 86, velocity); 3483 lastD[9][1] = 0; 3484 } 3485 3486 //D87 3487 if ((keysD[9][2] == 0) and (lastD[9][2] == 0)) { 3488 MidiSend(noteOn4, 87, velocity); 3489 lastD[9][2] = 7; 3490 } 3491 //Write Midi Note Off 3492 if ((keysD[9][2] == 1) and (lastD[9][2] == 7)) { 3493 MidiSend(noteOff4, 87, velocity); 3494 lastD[9][2] = 0; 3495 } 3496 3497 //D88 3498 if ((keysD[9][3] == 0) and (lastD[9][3] == 0)) { 3499 MidiSend(noteOn4, 88, velocity); 3500 lastD[9][3] = 7; 3501 } 3502 //Write Midi Note Off 3503 if ((keysD[9][3] == 1) and (lastD[9][3] == 7)) { 3504 MidiSend(noteOff4, 88, velocity); 3505 lastD[9][3] = 0; 3506 } 3507 3508 //D89 3509 if ((keysD[9][4] == 0) and (lastD[9][4] == 0)) { 3510 MidiSend(noteOn4, 89, velocity); 3511 lastD[9][4] = 7; 3512 } 3513 //Write Midi Note Off 3514 if ((keysD[9][4] == 1) and (lastD[9][4] == 7)) { 3515 MidiSend(noteOff4, 89, velocity); 3516 lastD[9][4] = 0; 3517 } 3518 3519 //D90 3520 if ((keysD[9][5] == 0) and (lastD[9][5] == 0)) { 3521 MidiSend(noteOn4, 90, velocity); 3522 lastD[9][5] = 7; 3523 } 3524 //Write Midi Note Off 3525 if ((keysD[9][5] == 1) and (lastD[9][5] == 7)) { 3526 MidiSend(noteOff4, 90, velocity); 3527 lastD[9][5] = 0; 3528 } 3529 3530 //D91 3531 if ((keysD[10][0] == 0) and (lastD[10][0] == 0)) { 3532 MidiSend(noteOn4, 91, velocity); 3533 lastD[10][0] = 7; 3534 } 3535 //Write Midi Note Off 3536 if ((keysD[10][0] == 1) and (lastD[10][0] == 7)) { 3537 MidiSend(noteOff4, 91, velocity); 3538 lastD[10][0] = 0; 3539 } 3540 3541 //D92 3542 if ((keysD[10][1] == 0) and (lastD[10][1] == 0)) { 3543 MidiSend(noteOn4, 92, velocity); 3544 lastD[10][1] = 7; 3545 } 3546 //Write Midi Note Off 3547 if ((keysD[10][1] == 1) and (lastD[10][1] == 7)) { 3548 MidiSend(noteOff4, 92, velocity); 3549 lastD[10][1] = 0; 3550 } 3551 3552 //D93 3553 if ((keysD[10][2] == 0) and (lastD[10][2] == 0)) { 3554 MidiSend(noteOn4, 93, velocity); 3555 lastD[10][2] = 7; 3556 } 3557 //Write Midi Note Off 3558 if ((keysD[10][2] == 1) and (lastD[10][2] == 7)) { 3559 MidiSend(noteOff4, 93, velocity); 3560 lastD[10][2] = 0; 3561 } 3562 3563 //D94 3564 if ((keysD[10][3] == 0) and (lastD[10][3] == 0)) { 3565 MidiSend(noteOn4, 94, velocity); 3566 lastD[10][3] = 7; 3567 } 3568 //Write Midi Note Off 3569 if ((keysD[10][3] == 1) and (lastD[10][3] == 7)) { 3570 MidiSend(noteOff4, 94, velocity); 3571 lastD[10][3] = 0; 3572 } 3573 3574 //D95 3575 if ((keysD[10][4] == 0) and (lastD[10][4] == 0)) { 3576 MidiSend(noteOn4, 95, velocity); 3577 lastD[10][4] = 7; 3578 } 3579 //Write Midi Note Off 3580 if ((keysD[10][4] == 1) and (lastD[10][4] == 7)) { 3581 MidiSend(noteOff4, 95, velocity); 3582 lastD[10][4] = 0; 3583 } 3584 3585 //D96 3586 if ((keysD[10][5] == 0) and (lastD[10][5] == 0)) { 3587 MidiSend(noteOn4, 96, velocity); 3588 lastD[10][5] = 7; 3589 } 3590 //Write Midi Note Off 3591 if ((keysD[10][5] == 1) and (lastD[10][5] == 7)) { 3592 MidiSend(noteOff4, 96, velocity); 3593 lastD[10][5] = 0; 3594 } 3595 3596 //Write Keyboard C, only for inverted switches, first 32 notes only. 3597 /* 3598 //C36 3599 if ((keysC[0][0] == 0) and (lastC[0][0] == 0)) { 3600 MidiSend(noteOff3, 36, velocity); 3601 lastC[0][0] = 7; 3602 } 3603 if ((keysC[0][0] == 1) and (lastC[0][0] == 7)) { 3604 MidiSend(noteOn3, 36, velocity); 3605 lastC[0][0] = 0; 3606 } 3607 3608 //C37 3609 if ((keysC[1][0] == 0) and (lastC[1][0] == 0)) { 3610 MidiSend(noteOff3, 37, velocity); 3611 lastC[1][0] = 7; 3612 } 3613 if ((keysC[1][0] == 1) and (lastC[1][0] == 7)) { 3614 MidiSend(noteOn3, 37, velocity); 3615 lastC[1][0] = 0; 3616 } 3617 3618 //C38 3619 if ((keysC[1][1] == 0) and (lastC[1][1] == 0)) { 3620 MidiSend(noteOff3, 38, velocity); 3621 lastC[1][1] = 7; 3622 } 3623 //Write Midi Note Off 3624 if ((keysC[1][1] == 1) and (lastC[1][1] == 7)) { 3625 MidiSend(noteOn3, 38, velocity); 3626 lastC[1][1] = 0; 3627 } 3628 3629 //C39 3630 if ((keysC[1][2] == 0) and (lastC[1][2] == 0)) { 3631 MidiSend(noteOff3, 39, velocity); 3632 lastC[1][2] = 7; 3633 } 3634 //Write Midi Note Off 3635 if ((keysC[1][2] == 1) and (lastC[1][2] == 7)) { 3636 MidiSend(noteOn3, 39, velocity); 3637 lastC[1][2] = 0; 3638 } 3639 3640 //C40 3641 if ((keysC[1][3] == 0) and (lastC[1][3] == 0)) { 3642 MidiSend(noteOff3, 40, velocity); 3643 lastC[1][3] = 7; 3644 } 3645 //Write Midi Note Off 3646 if ((keysC[1][3] == 1) and (lastC[1][3] == 7)) { 3647 MidiSend(noteOn3, 40, velocity); 3648 lastC[1][3] = 0; 3649 } 3650 3651 //C41 3652 if ((keysC[1][4] == 0) and (lastC[1][4] == 0)) { 3653 MidiSend(noteOff3, 41, velocity); 3654 lastC[1][4] = 7; 3655 } 3656 //Write Midi Note Off 3657 if ((keysC[1][4] == 1) and (lastC[1][4] == 7)) { 3658 MidiSend(noteOn3, 41, velocity); 3659 lastC[1][4] = 0; 3660 } 3661 3662 //C42 3663 if ((keysC[1][5] == 0) and (lastC[1][5] == 0)) { 3664 MidiSend(noteOff3, 42, velocity); 3665 lastC[1][5] = 7; 3666 } 3667 //Write Midi Note Off 3668 if ((keysC[1][5] == 1) and (lastC[1][5] == 7)) { 3669 MidiSend(noteOn3, 42, velocity); 3670 lastC[1][5] = 0; 3671 } 3672 3673 //C43 3674 if ((keysC[2][0] == 0) and (lastC[2][0] == 0)) { 3675 MidiSend(noteOff3, 43, velocity); 3676 lastC[2][0] = 7; 3677 } 3678 //Write Midi Note Off 3679 if ((keysC[2][0] == 1) and (lastC[2][0] == 7)) { 3680 MidiSend(noteOn3, 43, velocity); 3681 lastC[2][0] = 0; 3682 } 3683 3684 //C44 3685 if ((keysC[2][1] == 0) and (lastC[2][1] == 0)) { 3686 MidiSend(noteOff3, 44, velocity); 3687 lastC[2][1] = 7; 3688 } 3689 //Write Midi Note Off 3690 if ((keysC[2][1] == 1) and (lastC[2][1] == 7)) { 3691 MidiSend(noteOn3, 44, velocity); 3692 lastC[2][1] = 0; 3693 } 3694 3695 //C45 3696 if ((keysC[2][2] == 0) and (lastC[2][2] == 0)) { 3697 MidiSend(noteOff3, 45, velocity); 3698 lastC[2][2] = 7; 3699 } 3700 //Write Midi Note Off 3701 if ((keysC[2][2] == 1) and (lastC[2][2] == 7)) { 3702 MidiSend(noteOn3, 45, velocity); 3703 lastC[2][2] = 0; 3704 } 3705 3706 //C46 3707 if ((keysC[2][3] == 0) and (lastC[2][3] == 0)) { 3708 MidiSend(noteOff3, 46, velocity); 3709 lastC[2][3] = 7; 3710 } 3711 //Write Midi Note Off 3712 if ((keysC[2][3] == 1) and (lastC[2][3] == 7)) { 3713 MidiSend(noteOn3, 46, velocity); 3714 lastC[2][3] = 0; 3715 } 3716 3717 //C47 3718 if ((keysC[2][4] == 0) and (lastC[2][4] == 0)) { 3719 MidiSend(noteOff3, 47, velocity); 3720 lastC[2][4] = 7; 3721 } 3722 //Write Midi Note Off 3723 if ((keysC[2][4] == 1) and (lastC[2][4] == 7)) { 3724 MidiSend(noteOn3, 47, velocity); 3725 lastC[2][4] = 0; 3726 } 3727 3728 //C48 3729 if ((keysC[2][5] == 0) and (lastC[2][5] == 0)) { 3730 MidiSend(noteOff3, 48, velocity); 3731 lastC[2][5] = 7; 3732 } 3733 //Write Midi Note Off 3734 if ((keysC[2][5] == 1) and (lastC[2][5] == 7)) { 3735 MidiSend(noteOn3, 48, velocity); 3736 lastC[2][5] = 0; 3737 } 3738 3739 //C49 3740 if ((keysC[3][0] == 0) and (lastC[3][0] == 0)) { 3741 MidiSend(noteOff3, 49, velocity); 3742 lastC[3][0] = 7; 3743 } 3744 //Write Midi Note Off 3745 if ((keysC[3][0] == 1) and (lastC[3][0] == 7)) { 3746 MidiSend(noteOn3, 49, velocity); 3747 lastC[3][0] = 0; 3748 } 3749 3750 //C50 3751 if ((keysC[3][1] == 0) and (lastC[3][1] == 0)) { 3752 MidiSend(noteOff3, 50, velocity); 3753 lastC[3][1] = 7; 3754 } 3755 //Write Midi Note Off 3756 if ((keysC[3][1] == 1) and (lastC[3][1] == 7)) { 3757 MidiSend(noteOn3, 50, velocity); 3758 lastC[3][1] = 0; 3759 } 3760 3761 //C51 3762 if ((keysC[3][2] == 0) and (lastC[3][2] == 0)) { 3763 MidiSend(noteOff3, 51, velocity); 3764 lastC[3][2] = 7; 3765 } 3766 //Write Midi Note Off 3767 if ((keysC[3][2] == 1) and (lastC[3][2] == 7)) { 3768 MidiSend(noteOn3, 51, velocity); 3769 lastC[3][2] = 0; 3770 } 3771 3772 //C52 3773 if ((keysC[3][3] == 0) and (lastC[3][3] == 0)) { 3774 MidiSend(noteOff3, 52, velocity); 3775 lastC[3][3] = 7; 3776 } 3777 //Write Midi Note Off 3778 if ((keysC[3][3] == 1) and (lastC[3][3] == 7)) { 3779 MidiSend(noteOn3, 52, velocity); 3780 lastC[3][3] = 0; 3781 } 3782 3783 //C53 3784 if ((keysC[3][4] == 0) and (lastC[3][4] == 0)) { 3785 MidiSend(noteOff3, 53, velocity); 3786 lastC[3][4] = 7; 3787 } 3788 //Write Midi Note Off 3789 if ((keysC[3][4] == 1) and (lastC[3][4] == 7)) { 3790 MidiSend(noteOn3, 53, velocity); 3791 lastC[3][4] = 0; 3792 } 3793 3794 //C54 3795 if ((keysC[3][5] == 0) and (lastC[3][5] == 0)) { 3796 MidiSend(noteOff3, 54, velocity); 3797 lastC[3][5] = 7; 3798 } 3799 //Write Midi Note Off 3800 if ((keysC[3][5] == 1) and (lastC[3][5] == 7)) { 3801 MidiSend(noteOn3, 54, velocity); 3802 lastC[3][5] = 0; 3803 } 3804 3805 //C55 3806 if ((keysC[4][0] == 0) and (lastC[4][0] == 0)) { 3807 MidiSend(noteOff3, 55, velocity); 3808 lastC[4][0] = 7; 3809 } 3810 //Write Midi Note Off 3811 if ((keysC[4][0] == 1) and (lastC[4][0] == 7)) { 3812 MidiSend(noteOn3, 55, velocity); 3813 lastC[4][0] = 0; 3814 } 3815 3816 //C56 3817 if ((keysC[4][1] == 0) and (lastC[4][1] == 0)) { 3818 MidiSend(noteOff3, 56, velocity); 3819 lastC[4][1] = 7; 3820 } 3821 //Write Midi Note Off 3822 if ((keysC[4][1] == 1) and (lastC[4][1] == 7)) { 3823 MidiSend(noteOn3, 56, velocity); 3824 lastC[4][1] = 0; 3825 } 3826 3827 //C57 3828 if ((keysC[4][2] == 0) and (lastC[4][2] == 0)) { 3829 MidiSend(noteOff3, 57, velocity); 3830 lastC[4][2] = 7; 3831 } 3832 //Write Midi Note Off 3833 if ((keysC[4][2] == 1) and (lastC[4][2] == 7)) { 3834 MidiSend(noteOn3, 57, velocity); 3835 lastC[4][2] = 0; 3836 } 3837 3838 //C58 3839 if ((keysC[4][3] == 0) and (lastC[4][3] == 0)) { 3840 MidiSend(noteOff3, 58, velocity); 3841 lastC[4][3] = 7; 3842 } 3843 //Write Midi Note Off 3844 if ((keysC[4][3] == 1) and (lastC[4][3] == 7)) { 3845 MidiSend(noteOn3, 58, velocity); 3846 lastC[4][3] = 0; 3847 } 3848 3849 //C59 3850 if ((keysC[4][4] == 0) and (lastC[4][4] == 0)) { 3851 MidiSend(noteOff3, 59, velocity); 3852 lastC[4][4] = 7; 3853 } 3854 //Write Midi Note Off 3855 if ((keysC[4][4] == 1) and (lastC[4][4] == 7)) { 3856 MidiSend(noteOn3, 59, velocity); 3857 lastC[4][4] = 0; 3858 } 3859 3860 //C60 3861 if ((keysC[4][5] == 0) and (lastC[4][5] == 0)) { 3862 MidiSend(noteOff3, 60, velocity); 3863 lastC[4][5] = 7; 3864 } 3865 //Write Midi Note Off 3866 if ((keysC[4][5] == 1) and (lastC[4][5] == 7)) { 3867 MidiSend(noteOn3, 60, velocity); 3868 lastC[4][5] = 0; 3869 } 3870 3871 //C61 3872 if ((keysC[5][0] == 0) and (lastC[5][0] == 0)) { 3873 MidiSend(noteOff3, 61, velocity); 3874 lastC[5][0] = 7; 3875 } 3876 //Write Midi Note Off 3877 if ((keysC[5][0] == 1) and (lastC[5][0] == 7)) { 3878 MidiSend(noteOn3, 61, velocity); 3879 lastC[5][0] = 0; 3880 } 3881 3882 //C62 3883 if ((keysC[5][1] == 0) and (lastC[5][1] == 0)) { 3884 MidiSend(noteOff3, 62, velocity); 3885 lastC[5][1] = 7; 3886 } 3887 //Write Midi Note Off 3888 if ((keysC[5][1] == 1) and (lastC[5][1] == 7)) { 3889 MidiSend(noteOn3, 62, velocity); 3890 lastC[5][1] = 0; 3891 } 3892 3893 //C63 3894 if ((keysC[5][2] == 0) and (lastC[5][2] == 0)) { 3895 MidiSend(noteOff3, 63, velocity); 3896 lastC[5][2] = 7; 3897 } 3898 //Write Midi Note Off 3899 if ((keysC[5][2] == 1) and (lastC[5][2] == 7)) { 3900 MidiSend(noteOn3, 63, velocity); 3901 lastC[5][2] = 0; 3902 } 3903 3904 //C64 3905 if ((keysC[5][3] == 0) and (lastC[5][3] == 0)) { 3906 MidiSend(noteOff3, 64, velocity); 3907 lastC[5][3] = 7; 3908 } 3909 //Write Midi Note Off 3910 if ((keysC[5][3] == 1) and (lastC[5][3] == 7)) { 3911 MidiSend(noteOn3, 64, velocity); 3912 lastC[5][3] = 0; 3913 } 3914 3915 //C65 3916 if ((keysC[5][4] == 0) and (lastC[5][4] == 0)) { 3917 MidiSend(noteOff3, 65, velocity); 3918 lastC[5][4] = 7; 3919 } 3920 //Write Midi Note Off 3921 if ((keysC[5][4] == 1) and (lastC[5][4] == 7)) { 3922 MidiSend(noteOn3, 65, velocity); 3923 lastC[5][4] = 0; 3924 } 3925 3926 //C66 3927 if ((keysC[5][5] == 0) and (lastC[5][5] == 0)) { 3928 MidiSend(noteOff3, 66, velocity); 3929 lastC[5][5] = 7; 3930 } 3931 //Write Midi Note Off 3932 if ((keysC[5][5] == 1) and (lastC[5][5] == 7)) { 3933 MidiSend(noteOn3, 66, velocity); 3934 lastC[5][5] = 0; 3935 } 3936 3937 //C67 3938 if ((keysC[6][0] == 0) and (lastC[6][0] == 0)) { 3939 MidiSend(noteOff3, 67, velocity); 3940 lastC[6][0] = 7; 3941 } 3942 //Write Midi Note Off 3943 if ((keysC[6][0] == 1) and (lastC[6][0] == 7)) { 3944 MidiSend(noteOn3, 67, velocity); 3945 lastC[6][0] = 0; 3946 } 3947 */ 3948 3949 //Expression Pedal controls 3950 3951 //Expression pedal on analog pin A13 to Channel 6 3952 3953 int Cur6 = analogRead(13); 3954 int Map6 = map(Cur6, 0, 1023, 0, 127); 3955 3956 if (abs(Cur6 - LastPot6) >= 8) { 3957 MidiSend(chan6,Exp,Map6); 3958 LastPot6 = Cur6; 3959 } 3960 3961 //Expression pedal on analog pin A14 to Channel 7 3962 3963 int Cur7 = analogRead(14); 3964 int Map7 = map(Cur7, 0, 1023, 0, 127); 3965 3966 if (abs(Cur7 - LastPot7) >= 8) { 3967 MidiSend(chan7,Exp,Map7); 3968 LastPot7 = Cur7; 3969 } 3970 3971 //Expression pedal on analog pin A15 to Channel 8 3972 3973 int Cur8 = analogRead(15); 3974 int Map8 = map(Cur8, 0, 1023, 0, 127); 3975 3976 if (abs(Cur8 - LastPot8) >= 8) { 3977 MidiSend(chan8,Exp,Map8); 3978 LastPot8 = Cur8; 3979 } 3980} 3981 3982void MidiSend(int one, int two, int three) { 3983 Serial.write(one); 3984 Serial.write(two); 3985 Serial.write(three); 3986 }
Revised Matrixed Code
arduino
To be uploaded to the Arduino when using the Revised Matrixed Schematic.
1// Name: Arduino Mega Midi Controller Mega side. 2// Created: May 10, 2021 3// Last Edited: Mar 26, 2022 4// Author: Larason2 5// Acknowledgements: Bald Engineer, Amanda Ghassaei, jeffb42, GrumpyMike, John Main, Ghost, RIP Tutorial, Arduino tutorials. 6// Includes Midi Through, wiring for pistons, improved debounce. 7 8//Setup Key Data Arrays 9byte keysA[11][6]; 10byte keysB[11][6]; 11byte keysC[7][6]; 12byte keysE[6][6]; 13 14//Setup Key Press Arrays 15byte lastA[11][6]; 16byte lastB[11][6]; 17byte lastC[7][6]; 18byte lastE[6][6]; 19 20//Setup midi channel values 21int noteOn1 = 144; 22int noteOff1 = 128; 23int noteOn2 = 145; 24int noteOff2 = 129; 25int noteOn3 = 146; 26int noteOff3 = 130; 27int noteOn4 = 147; 28int noteOff4 = 131; 29 30//Setup volume control channels 31int CCchan6 = 181; 32int CCchan7 = 182; 33 34//Setup midi variables 35int velocity = 100; 36int Exp = 11; 37 38//Setup Pot Monitoring variables 39int LastPot6 = 1; 40int LastPot7 = 1; 41 42//Setup variable to debounce pots. increase to decrease bounce on the pots (units of analog signal variation) 43int PotT = 10; 44 45//Setup variables for Midi Thru 46boolean byteReady; 47unsigned char midiByte; 48 49//Setup variables for key debounce on 50unsigned long BounceAOn[11][6]; 51unsigned long BounceBOn[11][6]; 52unsigned long BounceCOn[7][6]; 53unsigned long BounceEOn[6][6]; 54 55//Setup variables for key debounce on 56unsigned long BounceAOff[11][6]; 57unsigned long BounceBOff[11][6]; 58unsigned long BounceCOff[7][6]; 59unsigned long BounceEOff[6][6]; 60 61//Setup variable for adjusting key debounce 62//Increase to decrease bounce on the keys (units of milliseconds) 63unsigned long Delay = 50; 64 65void setup() { 66 // Start Serial 67 Serial.begin(31250); 68 69 //Initialize Row Pins Keyboard A 70 pinMode(2, INPUT); 71 pinMode(3, INPUT); 72 pinMode(4, INPUT); 73 pinMode(5, INPUT); 74 pinMode(6, INPUT); 75 pinMode(7, INPUT); 76 77 //Initialize Column Pins Keyboard A 78 79 pinMode(8, INPUT); 80 pinMode(9, INPUT); 81 pinMode(10, INPUT); 82 pinMode(11, INPUT); 83 pinMode(12, INPUT); 84 pinMode(14, INPUT); 85 pinMode(15, INPUT); 86 pinMode(16, INPUT); 87 pinMode(17, INPUT); 88 pinMode(18, INPUT); 89 pinMode(19, INPUT); 90 91 //Initialize Row Pins Keyboard B 92 93 pinMode(22, INPUT); 94 pinMode(23, INPUT); 95 pinMode(24, INPUT); 96 pinMode(25, INPUT); 97 pinMode(26, INPUT); 98 pinMode(27, INPUT); 99 100 //Initialize Column Pins Keyboard B 101 102 pinMode(28, INPUT); 103 pinMode(29, INPUT); 104 pinMode(30, INPUT); 105 pinMode(31, INPUT); 106 pinMode(32, INPUT); 107 pinMode(33, INPUT); 108 pinMode(34, INPUT); 109 pinMode(35, INPUT); 110 pinMode(36, INPUT); 111 pinMode(37, INPUT); 112 pinMode(38, INPUT); 113 114 //Initialize Row Pins Keyboard C (Pedals) 115 116 pinMode(39, INPUT); 117 pinMode(40, INPUT); 118 pinMode(41, INPUT); 119 pinMode(42, INPUT); 120 pinMode(43, INPUT); 121 pinMode(44, INPUT); 122 123 //Initialize Column Pins Keyboard C (Pedals) 124 125 pinMode(45, INPUT); 126 pinMode(46, INPUT); 127 pinMode(47, INPUT); 128 pinMode(48, INPUT); 129 pinMode(49, INPUT); 130 pinMode(50, INPUT); 131 pinMode(51, INPUT); 132 133 //Keyboard E, Pistons Rows 134 135 pinMode(A0, INPUT); 136 pinMode(A1, INPUT); 137 pinMode(A2, INPUT); 138 pinMode(A3, INPUT); 139 pinMode(A4, INPUT); 140 pinMode(A5, INPUT); 141 142 //Keyboard E, Piston Columns 143 144 pinMode(A6, INPUT); 145 pinMode(A7, INPUT); 146 pinMode(A8, INPUT); 147 pinMode(A9, INPUT); 148 pinMode(A10, INPUT); 149 pinMode(A11, INPUT); 150 151 //Pot Pins 152 153 pinMode(A13, INPUT); 154 pinMode(A14, INPUT); 155 156 //Initialize Midi Thru 157 158 byteReady = false; 159 midiByte = 0; 160 161} 162 163void loop() { 164 165 // Read Keyboard A 166 167 pinMode(2, INPUT_PULLUP); 168 pinMode(3, INPUT_PULLUP); 169 pinMode(4, INPUT_PULLUP); 170 pinMode(5, INPUT_PULLUP); 171 pinMode(6, INPUT_PULLUP); 172 pinMode(7, INPUT_PULLUP); 173 174 pinMode(8, OUTPUT); 175 digitalWrite(8, LOW); 176 keysA[0][0] = digitalRead(2); 177 pinMode(8, INPUT); 178 179 pinMode(9, OUTPUT); 180 digitalWrite(9, LOW); 181 keysA[1][0] = digitalRead(3); 182 keysA[1][1] = digitalRead(4); 183 keysA[1][2] = digitalRead(5); 184 keysA[1][3] = digitalRead(6); 185 keysA[1][4] = digitalRead(7); 186 keysA[1][5] = digitalRead(2); 187 pinMode(9, INPUT); 188 189 pinMode(10, OUTPUT); 190 digitalWrite(10, LOW); 191 keysA[2][0] = digitalRead(3); 192 keysA[2][1] = digitalRead(4); 193 keysA[2][2] = digitalRead(5); 194 keysA[2][3] = digitalRead(6); 195 keysA[2][4] = digitalRead(7); 196 keysA[2][5] = digitalRead(2); 197 pinMode(10, INPUT); 198 199 pinMode(11, OUTPUT); 200 digitalWrite(11, LOW); 201 keysA[3][0] = digitalRead(3); 202 keysA[3][1] = digitalRead(4); 203 keysA[3][2] = digitalRead(5); 204 keysA[3][3] = digitalRead(6); 205 keysA[3][4] = digitalRead(7); 206 keysA[3][5] = digitalRead(2); 207 pinMode(11, INPUT); 208 209 pinMode(12, OUTPUT); 210 digitalWrite(12, LOW); 211 keysA[4][0] = digitalRead(3); 212 keysA[4][1] = digitalRead(4); 213 keysA[4][2] = digitalRead(5); 214 keysA[4][3] = digitalRead(6); 215 keysA[4][4] = digitalRead(7); 216 keysA[4][5] = digitalRead(2); 217 pinMode(12, INPUT); 218 219 pinMode(14, OUTPUT); 220 digitalWrite(14, LOW); 221 keysA[5][0] = digitalRead(3); 222 keysA[5][1] = digitalRead(4); 223 keysA[5][2] = digitalRead(5); 224 keysA[5][3] = digitalRead(6); 225 keysA[5][4] = digitalRead(7); 226 keysA[5][5] = digitalRead(2); 227 pinMode(14, INPUT); 228 229 pinMode(15, OUTPUT); 230 digitalWrite(15, LOW); 231 keysA[6][0] = digitalRead(3); 232 keysA[6][1] = digitalRead(4); 233 keysA[6][2] = digitalRead(5); 234 keysA[6][3] = digitalRead(6); 235 keysA[6][4] = digitalRead(7); 236 keysA[6][5] = digitalRead(2); 237 pinMode(15, INPUT); 238 239 pinMode(16, OUTPUT); 240 digitalWrite(16, LOW); 241 keysA[7][0] = digitalRead(3); 242 keysA[7][1] = digitalRead(4); 243 keysA[7][2] = digitalRead(5); 244 keysA[7][3] = digitalRead(6); 245 keysA[7][4] = digitalRead(7); 246 keysA[7][5] = digitalRead(2); 247 pinMode(16, INPUT); 248 249 pinMode(17, OUTPUT); 250 digitalWrite(17, LOW); 251 keysA[8][0] = digitalRead(3); 252 keysA[8][1] = digitalRead(4); 253 keysA[8][2] = digitalRead(5); 254 keysA[8][3] = digitalRead(6); 255 keysA[8][4] = digitalRead(7); 256 keysA[8][5] = digitalRead(2); 257 pinMode(17, INPUT); 258 259 pinMode(18, OUTPUT); 260 digitalWrite(18, LOW); 261 keysA[9][0] = digitalRead(3); 262 keysA[9][1] = digitalRead(4); 263 keysA[9][2] = digitalRead(5); 264 keysA[9][3] = digitalRead(6); 265 keysA[9][4] = digitalRead(7); 266 keysA[9][5] = digitalRead(2); 267 pinMode(18, INPUT); 268 269 pinMode(19, OUTPUT); 270 digitalWrite(19, LOW); 271 keysA[10][0] = digitalRead(3); 272 keysA[10][1] = digitalRead(4); 273 keysA[10][2] = digitalRead(5); 274 keysA[10][3] = digitalRead(6); 275 keysA[10][4] = digitalRead(7); 276 keysA[10][5] = digitalRead(2); 277 pinMode(19, INPUT); 278 279 pinMode(2, INPUT); 280 pinMode(3, INPUT); 281 pinMode(4, INPUT); 282 pinMode(5, INPUT); 283 pinMode(6, INPUT); 284 pinMode(7, INPUT); 285 286 // Read Keyboard B 287 288 pinMode(22, INPUT_PULLUP); 289 pinMode(23, INPUT_PULLUP); 290 pinMode(24, INPUT_PULLUP); 291 pinMode(25, INPUT_PULLUP); 292 pinMode(26, INPUT_PULLUP); 293 pinMode(27, INPUT_PULLUP); 294 295 pinMode(28, OUTPUT); 296 digitalWrite(28, LOW); 297 keysB[0][0] = digitalRead(22); 298 pinMode(28, INPUT); 299 300 pinMode(29, OUTPUT); 301 digitalWrite(29, LOW); 302 keysB[1][0] = digitalRead(23); 303 keysB[1][1] = digitalRead(24); 304 keysB[1][2] = digitalRead(25); 305 keysB[1][3] = digitalRead(26); 306 keysB[1][4] = digitalRead(27); 307 keysB[1][5] = digitalRead(22); 308 pinMode(29, INPUT); 309 310 pinMode(30, OUTPUT); 311 digitalWrite(30, LOW); 312 keysB[2][0] = digitalRead(23); 313 keysB[2][1] = digitalRead(24); 314 keysB[2][2] = digitalRead(25); 315 keysB[2][3] = digitalRead(26); 316 keysB[2][4] = digitalRead(27); 317 keysB[2][5] = digitalRead(22); 318 pinMode(30, INPUT); 319 320 pinMode(31, OUTPUT); 321 digitalWrite(31, LOW); 322 keysB[3][0] = digitalRead(23); 323 keysB[3][1] = digitalRead(24); 324 keysB[3][2] = digitalRead(25); 325 keysB[3][3] = digitalRead(26); 326 keysB[3][4] = digitalRead(27); 327 keysB[3][5] = digitalRead(22); 328 pinMode(31, INPUT); 329 330 pinMode(32, OUTPUT); 331 digitalWrite(32, LOW); 332 keysB[4][0] = digitalRead(23); 333 keysB[4][1] = digitalRead(24); 334 keysB[4][2] = digitalRead(25); 335 keysB[4][3] = digitalRead(26); 336 keysB[4][4] = digitalRead(27); 337 keysB[4][5] = digitalRead(22); 338 pinMode(32, INPUT); 339 340 pinMode(33, OUTPUT); 341 digitalWrite(33, LOW); 342 keysB[5][0] = digitalRead(23); 343 keysB[5][1] = digitalRead(24); 344 keysB[5][2] = digitalRead(25); 345 keysB[5][3] = digitalRead(26); 346 keysB[5][4] = digitalRead(27); 347 keysB[5][5] = digitalRead(22); 348 pinMode(33, INPUT); 349 350 pinMode(34, OUTPUT); 351 digitalWrite(34, LOW); 352 keysB[6][0] = digitalRead(23); 353 keysB[6][1] = digitalRead(24); 354 keysB[6][2] = digitalRead(25); 355 keysB[6][3] = digitalRead(26); 356 keysB[6][4] = digitalRead(27); 357 keysB[6][5] = digitalRead(22); 358 pinMode(34, INPUT); 359 360 pinMode(35, OUTPUT); 361 digitalWrite(35, LOW); 362 keysB[7][0] = digitalRead(23); 363 keysB[7][1] = digitalRead(24); 364 keysB[7][2] = digitalRead(25); 365 keysB[7][3] = digitalRead(26); 366 keysB[7][4] = digitalRead(27); 367 keysB[7][5] = digitalRead(22); 368 pinMode(35, INPUT); 369 370 pinMode(36, OUTPUT); 371 digitalWrite(36, LOW); 372 keysB[8][0] = digitalRead(23); 373 keysB[8][1] = digitalRead(24); 374 keysB[8][2] = digitalRead(25); 375 keysB[8][3] = digitalRead(26); 376 keysB[8][4] = digitalRead(27); 377 keysB[8][5] = digitalRead(22); 378 pinMode(36, INPUT); 379 380 pinMode(37, OUTPUT); 381 digitalWrite(37, LOW); 382 keysB[9][0] = digitalRead(23); 383 keysB[9][1] = digitalRead(24); 384 keysB[9][2] = digitalRead(25); 385 keysB[9][3] = digitalRead(26); 386 keysB[9][4] = digitalRead(27); 387 keysB[9][5] = digitalRead(22); 388 pinMode(37, INPUT); 389 390 pinMode(38, OUTPUT); 391 digitalWrite(38, LOW); 392 keysB[10][0] = digitalRead(23); 393 keysB[10][1] = digitalRead(24); 394 keysB[10][2] = digitalRead(25); 395 keysB[10][3] = digitalRead(26); 396 keysB[10][4] = digitalRead(27); 397 keysB[10][5] = digitalRead(22); 398 pinMode(38, INPUT); 399 400 pinMode(23, INPUT); 401 pinMode(24, INPUT); 402 pinMode(25, INPUT); 403 pinMode(26, INPUT); 404 pinMode(27, INPUT); 405 pinMode(22, INPUT); 406 407 // Read Keyboard C 408 409 //Set Row pins to read 410 411 pinMode(39, INPUT_PULLUP); 412 pinMode(40, INPUT_PULLUP); 413 pinMode(41, INPUT_PULLUP); 414 pinMode(42, INPUT_PULLUP); 415 pinMode(43, INPUT_PULLUP); 416 pinMode(44, INPUT_PULLUP); 417 418 pinMode(45, OUTPUT); 419 digitalWrite(45, LOW); 420 keysC[0][0] = digitalRead(39); 421 pinMode(45, INPUT); 422 423 pinMode(46, OUTPUT); 424 digitalWrite(46, LOW); 425 keysC[1][0] = digitalRead(40); 426 keysC[1][1] = digitalRead(41); 427 keysC[1][2] = digitalRead(42); 428 keysC[1][3] = digitalRead(43); 429 keysC[1][4] = digitalRead(44); 430 keysC[1][5] = digitalRead(39); 431 pinMode(46, INPUT); 432 433 pinMode(47, OUTPUT); 434 digitalWrite(47, LOW); 435 keysC[2][0] = digitalRead(40); 436 keysC[2][1] = digitalRead(41); 437 keysC[2][2] = digitalRead(42); 438 keysC[2][3] = digitalRead(43); 439 keysC[2][4] = digitalRead(44); 440 keysC[2][5] = digitalRead(39); 441 pinMode(47, INPUT); 442 443 pinMode(48, OUTPUT); 444 digitalWrite(48, LOW); 445 keysC[3][0] = digitalRead(40); 446 keysC[3][1] = digitalRead(41); 447 keysC[3][2] = digitalRead(42); 448 keysC[3][3] = digitalRead(43); 449 keysC[3][4] = digitalRead(44); 450 keysC[3][5] = digitalRead(39); 451 pinMode(48, INPUT); 452 453 pinMode(49, OUTPUT); 454 digitalWrite(49, LOW); 455 keysC[4][0] = digitalRead(40); 456 keysC[4][1] = digitalRead(41); 457 keysC[4][2] = digitalRead(42); 458 keysC[4][3] = digitalRead(43); 459 keysC[4][4] = digitalRead(44); 460 keysC[4][5] = digitalRead(39); 461 pinMode(49, INPUT); 462 463 pinMode(50, OUTPUT); 464 digitalWrite(50, LOW); 465 keysC[5][0] = digitalRead(40); 466 keysC[5][1] = digitalRead(41); 467 keysC[5][2] = digitalRead(42); 468 keysC[5][3] = digitalRead(43); 469 keysC[5][4] = digitalRead(44); 470 keysC[5][5] = digitalRead(39); 471 pinMode(50, INPUT); 472 473 pinMode(51, OUTPUT); 474 digitalWrite(51, LOW); 475 keysC[6][0] = digitalRead(40); 476 pinMode(51, INPUT); 477 478 pinMode(39, INPUT); 479 pinMode(40, INPUT); 480 pinMode(41, INPUT); 481 pinMode(42, INPUT); 482 pinMode(43, INPUT); 483 pinMode(44, INPUT); 484 485 //Read Piston data (Keyboard E) 486 487 pinMode(A0, INPUT_PULLUP); 488 pinMode(A1, INPUT_PULLUP); 489 pinMode(A2, INPUT_PULLUP); 490 pinMode(A3, INPUT_PULLUP); 491 pinMode(A4, INPUT_PULLUP); 492 pinMode(A5, INPUT_PULLUP); 493 494 pinMode(20, INPUT_PULLUP); 495 pinMode(21, INPUT_PULLUP); 496 pinMode(52, INPUT_PULLUP); 497 pinMode(53, INPUT_PULLUP); 498 pinMode(A12, INPUT_PULLUP); 499 pinMode(A13, INPUT_PULLUP); 500 501 pinMode(A6, OUTPUT); 502 digitalWrite(A6, LOW); 503 keysE[0][0] = digitalRead(A0); 504 keysE[0][1] = digitalRead(A1); 505 keysE[0][2] = digitalRead(A2); 506 keysE[0][3] = digitalRead(A3); 507 keysE[0][4] = digitalRead(A4); 508 keysE[0][5] = digitalRead(A5); 509 pinMode(A6, INPUT); 510 511 pinMode(A7, OUTPUT); 512 digitalWrite(A7, LOW); 513 keysE[1][0] = digitalRead(A0); 514 keysE[1][1] = digitalRead(A1); 515 keysE[1][2] = digitalRead(A2); 516 keysE[1][3] = digitalRead(A3); 517 keysE[1][4] = digitalRead(A4); 518 keysE[1][5] = digitalRead(A5); 519 pinMode(A7, INPUT); 520 521 pinMode(A8, OUTPUT); 522 digitalWrite(A8, LOW); 523 keysE[2][0] = digitalRead(A0); 524 pinMode(A8, INPUT); 525 526 pinMode(A9, OUTPUT); 527 digitalWrite(A9, LOW); 528 keysE[3][0] = digitalRead(20); 529 keysE[3][1] = digitalRead(21); 530 keysE[3][2] = digitalRead(52); 531 keysE[3][3] = digitalRead(53); 532 keysE[3][4] = digitalRead(A12); 533 keysE[3][5] = digitalRead(A13); 534 pinMode(A9, INPUT); 535 536 pinMode(A10, OUTPUT); 537 digitalWrite(A10, LOW); 538 keysE[4][0] = digitalRead(20); 539 keysE[4][1] = digitalRead(21); 540 keysE[4][2] = digitalRead(52); 541 keysE[4][3] = digitalRead(53); 542 keysE[4][4] = digitalRead(A12); 543 keysE[4][5] = digitalRead(A13); 544 pinMode(A10, INPUT); 545 546 pinMode(A11, OUTPUT); 547 digitalWrite(A11, LOW); 548 keysE[5][0] = digitalRead(20); 549 keysE[5][1] = digitalRead(21); 550 keysE[5][2] = digitalRead(52); 551 keysE[5][3] = digitalRead(53); 552 keysE[5][4] = digitalRead(A12); 553 pinMode(A11, INPUT); 554 555 pinMode(A0, INPUT); 556 pinMode(A1, INPUT); 557 pinMode(A2, INPUT); 558 pinMode(A3, INPUT); 559 pinMode(A4, INPUT); 560 pinMode(A5, INPUT); 561 562 pinMode(20, INPUT); 563 pinMode(21, INPUT); 564 pinMode(52, INPUT); 565 pinMode(53, INPUT); 566 pinMode(A12, INPUT); 567 pinMode(A13, INPUT); 568 569 //Invert Keyboard C data (For switches that are Normally Closed) 570 571 //Column 1 572 573 if (keysC[0][0] == 0) { 574 keysC[0][0] = 1; 575 } 576 else 577 if (keysC[0][0] == 1) { 578 keysC[0][0] = 0; 579 } 580 581 //Column 2 582 583 if (keysC[1][0] == 0) { 584 keysC[1][0] = 1; 585 } 586 else 587 if (keysC[1][0] == 1) { 588 keysC[1][0] = 0; 589 } 590 if (keysC[1][1] == 0) { 591 keysC[1][1] = 1; 592 } 593 else 594 if (keysC[1][1] == 1) { 595 keysC[1][1] = 0; 596 } 597 if (keysC[1][2] == 0) { 598 keysC[1][2] = 1; 599 } 600 else 601 if (keysC[1][2] == 1) { 602 keysC[1][2] = 0; 603 } 604 if (keysC[1][3] == 0) { 605 keysC[1][3] = 1; 606 } 607 else 608 if (keysC[1][3] == 1) { 609 keysC[1][3] = 0; 610 } 611 if (keysC[1][4] == 0) { 612 keysC[1][4] = 1; 613 } 614 else 615 if (keysC[1][4] == 1) { 616 keysC[1][4] = 0; 617 } 618 if (keysC[1][5] == 0) { 619 keysC[1][5] = 1; 620 } 621 else 622 if (keysC[1][5] == 1) { 623 keysC[1][5] = 0; 624 } 625 626 //Column 3 627 628 if (keysC[2][0] == 0) { 629 keysC[2][0] = 1; 630 } 631 else 632 if (keysC[2][0] == 1) { 633 keysC[2][0] = 0; 634 } 635 if (keysC[2][1] == 0) { 636 keysC[2][1] = 1; 637 } 638 else 639 if (keysC[2][1] == 1) { 640 keysC[2][1] = 0; 641 } 642 if (keysC[2][2] == 0) { 643 keysC[2][2] = 1; 644 } 645 else 646 if (keysC[2][2] == 1) { 647 keysC[2][2] = 0; 648 } 649 if (keysC[2][3] == 0) { 650 keysC[2][3] = 1; 651 } 652 else 653 if (keysC[2][3] == 1) { 654 keysC[2][3] = 0; 655 } 656 if (keysC[2][4] == 0) { 657 keysC[2][4] = 1; 658 } 659 else 660 if (keysC[2][4] == 1) { 661 keysC[2][4] = 0; 662 } 663 if (keysC[2][5] == 0) { 664 keysC[2][5] = 1; 665 } 666 else 667 if (keysC[2][5] == 1) { 668 keysC[2][5] = 0; 669 } 670 671 //Column 4 672 673 if (keysC[3][0] == 0) { 674 keysC[3][0] = 1; 675 } 676 else 677 if (keysC[3][0] == 1) { 678 keysC[3][0] = 0; 679 } 680 if (keysC[3][1] == 0) { 681 keysC[3][1] = 1; 682 } 683 else 684 if (keysC[3][1] == 1) { 685 keysC[3][1] = 0; 686 } 687 if (keysC[3][2] == 0) { 688 keysC[3][2] = 1; 689 } 690 else 691 if (keysC[3][2] == 1) { 692 keysC[3][2] = 0; 693 } 694 if (keysC[3][3] == 0) { 695 keysC[3][3] = 1; 696 } 697 else 698 if (keysC[3][3] == 1) { 699 keysC[3][3] = 0; 700 } 701 if (keysC[3][4] == 0) { 702 keysC[3][4] = 1; 703 } 704 else 705 if (keysC[3][4] == 1) { 706 keysC[3][4] = 0; 707 } 708 if (keysC[3][5] == 0) { 709 keysC[3][5] = 1; 710 } 711 else 712 if (keysC[3][5] == 1) { 713 keysC[3][5] = 0; 714 } 715 716 //Column 5 717 718 if (keysC[4][0] == 0) { 719 keysC[4][0] = 1; 720 } 721 else 722 if (keysC[4][0] == 1) { 723 keysC[4][0] = 0; 724 } 725 if (keysC[4][1] == 0) { 726 keysC[4][1] = 1; 727 } 728 else 729 if (keysC[4][1] == 1) { 730 keysC[4][1] = 0; 731 } 732 if (keysC[4][2] == 0) { 733 keysC[4][2] = 1; 734 } 735 else 736 if (keysC[4][2] == 1) { 737 keysC[4][2] = 0; 738 } 739 if (keysC[4][3] == 0) { 740 keysC[4][3] = 1; 741 } 742 else 743 if (keysC[4][3] == 1) { 744 keysC[4][3] = 0; 745 } 746 if (keysC[4][4] == 0) { 747 keysC[4][4] = 1; 748 } 749 else 750 if (keysC[4][4] == 1) { 751 keysC[4][4] = 0; 752 } 753 if (keysC[4][5] == 0) { 754 keysC[4][5] = 1; 755 } 756 else 757 if (keysC[4][5] == 1) { 758 keysC[4][5] = 0; 759 } 760 761 //Column 6 762 763 if (keysC[5][0] == 0) { 764 keysC[5][0] = 1; 765 } 766 else 767 if (keysC[5][0] == 1) { 768 keysC[5][0] = 0; 769 } 770 if (keysC[5][1] == 0) { 771 keysC[5][1] = 1; 772 } 773 else 774 if (keysC[5][1] == 1) { 775 keysC[5][1] = 0; 776 } 777 if (keysC[5][2] == 0) { 778 keysC[5][2] = 1; 779 } 780 else 781 if (keysC[5][2] == 1) { 782 keysC[5][2] = 0; 783 } 784 if (keysC[5][3] == 0) { 785 keysC[5][3] = 1; 786 } 787 else 788 if (keysC[5][3] == 1) { 789 keysC[5][3] = 0; 790 } 791 if (keysC[5][4] == 0) { 792 keysC[5][4] = 1; 793 } 794 else 795 if (keysC[5][4] == 1) { 796 keysC[5][4] = 0; 797 } 798 if (keysC[5][5] == 0) { 799 keysC[5][5] = 1; 800 } 801 else 802 if (keysC[5][5] == 1) { 803 keysC[5][5] = 0; 804 } 805 806 //Column 7 807 808 if (keysC[6][0] == 0) {keysC[6][0] = 1;} 809 else 810 if (keysC[6][0] == 1) {keysC[6][0] = 0;} 811 812 813 //Write Keyboard A 814 815 //A36 816 if (lastA[0][0] == 7) { 817 BounceAOn[0][0] = millis(); 818 } 819 if ((keysA[0][0] == 0) and (lastA[0][0] == 0) and ((millis() - BounceAOn[0][0]) > Delay)) { 820 MidiSend(noteOn1, 36, velocity); 821 lastA[0][0] = 7; 822 } 823 if (lastA[0][0] == 0) { 824 BounceAOff[0][0] = millis(); 825 } 826 if ((keysA[0][0] == 1) and (lastA[0][0] == 7) and ((millis() - BounceAOff[0][0]) > Delay)) { 827 MidiSend(noteOff1, 36, velocity); 828 lastA[0][0] = 0; 829 } 830 831 //A37 832 if (lastA[1][0] == 7) { 833 BounceAOn[1][0] = millis(); 834 } 835 if ((keysA[1][0] == 0) and (lastA[1][0] == 0) and ((millis() - BounceAOn[1][0]) > Delay)) { 836 MidiSend(noteOn1, 37, velocity); 837 lastA[1][0] = 7; 838 } 839 if (lastA[1][0] == 0) { 840 BounceAOff[1][0] = millis(); 841 } 842 if ((keysA[1][0] == 1) and (lastA[1][0] == 7) and ((millis() - BounceAOff[1][0]) > Delay)) { 843 MidiSend(noteOff1, 37, velocity); 844 lastA[1][0] = 0; 845 } 846 847 //A38 848 if (lastA[1][1] == 7) { 849 BounceAOn[1][1] = millis(); 850 } 851 if ((keysA[1][1] == 0) and (lastA[1][1] == 0) and ((millis() - BounceAOn[1][1]) > Delay)) { 852 MidiSend(noteOn1, 38, velocity); 853 lastA[1][1] = 7; 854 } 855 if (lastA[1][1] == 0) { 856 BounceAOff[1][1] = millis(); 857 } 858 if ((keysA[1][1] == 1) and (lastA[1][1] == 7) and ((millis() - BounceAOff[1][1]) > Delay)) { 859 MidiSend(noteOff1, 38, velocity); 860 lastA[1][1] = 0; 861 } 862 863 //A39 864 if (lastA[1][2] == 7) { 865 BounceAOn[1][2] = millis(); 866 } 867 if ((keysA[1][2] == 0) and (lastA[1][2] == 0) and ((millis() - BounceAOn[1][2]) > Delay)) { 868 MidiSend(noteOn1, 39, velocity); 869 lastA[1][2] = 7; 870 } 871 if (lastA[1][2] == 0) { 872 BounceAOff[1][2] = millis(); 873 } 874 if ((keysA[1][2] == 1) and (lastA[1][2] == 7) and ((millis() - BounceAOff[1][2]) > Delay)) { 875 MidiSend(noteOff1, 39, velocity); 876 lastA[1][2] = 0; 877 } 878 879 //A40 880 if (lastA[1][3] == 7) { 881 BounceAOn[1][3] = millis(); 882 } 883 if ((keysA[1][3] == 0) and (lastA[1][3] == 0) and ((millis() - BounceAOn[1][3]) > Delay)) { 884 MidiSend(noteOn1, 40, velocity); 885 lastA[1][3] = 7; 886 } 887 if (lastA[1][3] == 0) { 888 BounceAOff[1][3] = millis(); 889 } 890 if ((keysA[1][3] == 1) and (lastA[1][3] == 7) and ((millis() - BounceAOff[1][3]) > Delay)) { 891 MidiSend(noteOff1, 40, velocity); 892 lastA[1][3] = 0; 893 } 894 895 //A41 896 if (lastA[1][4] == 7) { 897 BounceAOn[1][4] = millis(); 898 } 899 if ((keysA[1][4] == 0) and (lastA[1][4] == 0) and ((millis() - BounceAOn[1][4]) > Delay)) { 900 MidiSend(noteOn1, 41, velocity); 901 lastA[1][4] = 7; 902 } 903 if (lastA[1][4] == 0) { 904 BounceAOff[1][4] = millis(); 905 } 906 if ((keysA[1][4] == 1) and (lastA[1][4] == 7) and ((millis() - BounceAOff[1][4]) > Delay)) { 907 MidiSend(noteOff1, 41, velocity); 908 lastA[1][4] = 0; 909 } 910 911 //A42 912 if (lastA[1][5] == 7) { 913 BounceAOn[1][5] = millis(); 914 } 915 if ((keysA[1][5] == 0) and (lastA[1][5] == 0) and ((millis() - BounceAOn[1][5]) > Delay)) { 916 MidiSend(noteOn1, 42, velocity); 917 lastA[1][5] = 7; 918 } 919 if (lastA[1][5] == 0) { 920 BounceAOff[1][5] = millis(); 921 } 922 if ((keysA[1][5] == 1) and (lastA[1][5] == 7) and ((millis() - BounceAOff[1][5]) > Delay)) { 923 MidiSend(noteOff1, 42, velocity); 924 lastA[1][5] = 0; 925 } 926 927 //A43 928 if (lastA[2][0] == 7) { 929 BounceAOn[2][0] = millis(); 930 } 931 if ((keysA[2][0] == 0) and (lastA[2][0] == 0) and ((millis() - BounceAOn[2][0]) > Delay)) { 932 MidiSend(noteOn1, 43, velocity); 933 lastA[2][0] = 7; 934 } 935 if (lastA[2][0] == 0) { 936 BounceAOff[2][0] = millis(); 937 } 938 if ((keysA[2][0] == 1) and (lastA[2][0] == 7) and ((millis() - BounceAOff[2][0]) > Delay)) { 939 MidiSend(noteOff1, 43, velocity); 940 lastA[2][0] = 0; 941 } 942 943 //A44 944 if (lastA[2][1] == 7) { 945 BounceAOn[2][1] = millis(); 946 } 947 if ((keysA[2][1] == 0) and (lastA[2][1] == 0) and ((millis() - BounceAOn[2][1]) > Delay)) { 948 MidiSend(noteOn1, 44, velocity); 949 lastA[2][1] = 7; 950 } 951 if (lastA[2][1] == 0) { 952 BounceAOff[2][1] = millis(); 953 } 954 if ((keysA[2][1] == 1) and (lastA[2][1] == 7) and ((millis() - BounceAOff[2][1]) > Delay)) { 955 MidiSend(noteOff1, 44, velocity); 956 lastA[2][1] = 0; 957 } 958 959 //A45 960 if (lastA[2][2] == 7) { 961 BounceAOn[2][2] = millis(); 962 } 963 if ((keysA[2][2] == 0) and (lastA[2][2] == 0) and ((millis() - BounceAOn[2][2]) > Delay)) { 964 MidiSend(noteOn1, 45, velocity); 965 lastA[2][2] = 7; 966 } 967 if (lastA[2][2] == 0) { 968 BounceAOff[2][2] = millis(); 969 } 970 if ((keysA[2][2] == 1) and (lastA[2][2] == 7) and ((millis() - BounceAOff[2][2]) > Delay)) { 971 MidiSend(noteOff1, 45, velocity); 972 lastA[2][2] = 0; 973 } 974 975 //A46 976 if (lastA[2][3] == 7) { 977 BounceAOn[2][3] = millis(); 978 } 979 if ((keysA[2][3] == 0) and (lastA[2][3] == 0) and ((millis() - BounceAOn[2][3]) > Delay)) { 980 MidiSend(noteOn1, 46, velocity); 981 lastA[2][3] = 7; 982 } 983 if (lastA[2][3] == 0) { 984 BounceAOff[2][3] = millis(); 985 } 986 if ((keysA[2][3] == 1) and (lastA[2][3] == 7) and ((millis() - BounceAOff[2][3]) > Delay)) { 987 MidiSend(noteOff1, 46, velocity); 988 lastA[2][3] = 0; 989 } 990 991 //A47 992 if (lastA[2][4] == 7) { 993 BounceAOn[2][4] = millis(); 994 } 995 if ((keysA[2][4] == 0) and (lastA[2][4] == 0) and ((millis() - BounceAOn[2][4]) > Delay)) { 996 MidiSend(noteOn1, 47, velocity); 997 lastA[2][4] = 7; 998 } 999 if (lastA[2][4] == 0) { 1000 BounceAOff[2][4] = millis(); 1001 } 1002 if ((keysA[2][4] == 1) and (lastA[2][4] == 7) and ((millis() - BounceAOff[2][4]) > Delay)) { 1003 MidiSend(noteOff1, 47, velocity); 1004 lastA[2][4] = 0; 1005 } 1006 1007 //A48 1008 if (lastA[2][5] == 7) { 1009 BounceAOn[2][5] = millis(); 1010 } 1011 if ((keysA[2][5] == 0) and (lastA[2][5] == 0) and ((millis() - BounceAOn[2][5]) > Delay)) { 1012 MidiSend(noteOn1, 48, velocity); 1013 lastA[2][5] = 7; 1014 } 1015 if (lastA[2][5] == 0) { 1016 BounceAOff[2][5] = millis(); 1017 } 1018 if ((keysA[2][5] == 1) and (lastA[2][5] == 7) and ((millis() - BounceAOff[2][5]) > Delay)) { 1019 MidiSend(noteOff1, 48, velocity); 1020 lastA[2][5] = 0; 1021 } 1022 1023 //A49 1024 if (lastA[3][0] == 7) { 1025 BounceAOn[3][0] = millis(); 1026 } 1027 if ((keysA[3][0] == 0) and (lastA[3][0] == 0) and ((millis() - BounceAOn[3][0]) > Delay)) { 1028 MidiSend(noteOn1, 49, velocity); 1029 lastA[3][0] = 7; 1030 } 1031 if (lastA[3][0] == 0) { 1032 BounceAOff[3][0] = millis(); 1033 } 1034 if ((keysA[3][0] == 1) and (lastA[3][0] == 7) and ((millis() - BounceAOff[3][0]) > Delay)) { 1035 MidiSend(noteOff1, 49, velocity); 1036 lastA[3][0] = 0; 1037 } 1038 1039 //A50 1040 if (lastA[3][1] == 7) { 1041 BounceAOn[3][1] = millis(); 1042 } 1043 if ((keysA[3][1] == 0) and (lastA[3][1] == 0) and ((millis() - BounceAOn[3][1]) > Delay)) { 1044 MidiSend(noteOn1, 50, velocity); 1045 lastA[3][1] = 7; 1046 } 1047 if (lastA[3][1] == 0) { 1048 BounceAOff[3][1] = millis(); 1049 } 1050 if ((keysA[3][1] == 1) and (lastA[3][1] == 7) and ((millis() - BounceAOff[3][1]) > Delay)) { 1051 MidiSend(noteOff1, 50, velocity); 1052 lastA[3][1] = 0; 1053 } 1054 1055 //A51 1056 if (lastA[3][2] == 7) { 1057 BounceAOn[3][2] = millis(); 1058 } 1059 if ((keysA[3][2] == 0) and (lastA[3][2] == 0) and ((millis() - BounceAOn[3][2]) > Delay)) { 1060 MidiSend(noteOn1, 51, velocity); 1061 lastA[3][2] = 7; 1062 } 1063 if (lastA[3][2] == 0) { 1064 BounceAOff[3][2] = millis(); 1065 } 1066 if ((keysA[3][2] == 1) and (lastA[3][2] == 7) and ((millis() - BounceAOff[3][2]) > Delay)) { 1067 MidiSend(noteOff1, 51, velocity); 1068 lastA[3][2] = 0; 1069 } 1070 1071 //A52 1072 if (lastA[3][3] == 7) { 1073 BounceAOn[3][3] = millis(); 1074 } 1075 if ((keysA[3][3] == 0) and (lastA[3][3] == 0) and ((millis() - BounceAOn[3][3]) > Delay)) { 1076 MidiSend(noteOn1, 52, velocity); 1077 lastA[3][3] = 7; 1078 } 1079 if (lastA[3][3] == 0) { 1080 BounceAOff[3][3] = millis(); 1081 } 1082 if ((keysA[3][3] == 1) and (lastA[3][3] == 7) and ((millis() - BounceAOff[3][3]) > Delay)) { 1083 MidiSend(noteOff1, 52, velocity); 1084 lastA[3][3] = 0; 1085 } 1086 1087 //A53 1088 if (lastA[3][4] == 7) { 1089 BounceAOn[3][4] = millis(); 1090 } 1091 if ((keysA[3][4] == 0) and (lastA[3][4] == 0) and ((millis() - BounceAOn[3][4]) > Delay)) { 1092 MidiSend(noteOn1, 53, velocity); 1093 lastA[3][4] = 7; 1094 } 1095 if (lastA[3][4] == 0) { 1096 BounceAOff[3][4] = millis(); 1097 } 1098 if ((keysA[3][4] == 1) and (lastA[3][4] == 7) and ((millis() - BounceAOff[3][4]) > Delay)) { 1099 MidiSend(noteOff1, 53, velocity); 1100 lastA[3][4] = 0; 1101 } 1102 1103 //A54 1104 if (lastA[3][5] == 7) { 1105 BounceAOn[3][5] = millis(); 1106 } 1107 if ((keysA[3][5] == 0) and (lastA[3][5] == 0) and ((millis() - BounceAOn[3][5]) > Delay)) { 1108 MidiSend(noteOn1, 54, velocity); 1109 lastA[3][5] = 7; 1110 } 1111 if (lastA[3][5] == 0) { 1112 BounceAOff[3][5] = millis(); 1113 } 1114 if ((keysA[3][5] == 1) and (lastA[3][5] == 7) and ((millis() - BounceAOff[3][5]) > Delay)) { 1115 MidiSend(noteOff1, 54, velocity); 1116 lastA[3][5] = 0; 1117 } 1118 1119 //A55 1120 if (lastA[4][0] == 7) { 1121 BounceAOn[4][0] = millis(); 1122 } 1123 if ((keysA[4][0] == 0) and (lastA[4][0] == 0) and ((millis() - BounceAOn[4][0]) > Delay)) { 1124 MidiSend(noteOn1, 55, velocity); 1125 lastA[4][0] = 7; 1126 } 1127 if (lastA[4][0] == 0) { 1128 BounceAOff[4][0] = millis(); 1129 } 1130 if ((keysA[4][0] == 1) and (lastA[4][0] == 7) and ((millis() - BounceAOff[4][0]) > Delay)) { 1131 MidiSend(noteOff1, 55, velocity); 1132 lastA[4][0] = 0; 1133 } 1134 1135 //A56 1136 if (lastA[4][1] == 7) { 1137 BounceAOn[4][1] = millis(); 1138 } 1139 if ((keysA[4][1] == 0) and (lastA[4][1] == 0) and ((millis() - BounceAOn[4][1]) > Delay)) { 1140 MidiSend(noteOn1, 56, velocity); 1141 lastA[4][1] = 7; 1142 } 1143 if (lastA[4][1] == 0) { 1144 BounceAOff[4][1] = millis(); 1145 } 1146 if ((keysA[4][1] == 1) and (lastA[4][1] == 7) and ((millis() - BounceAOff[4][1]) > Delay)) { 1147 MidiSend(noteOff1, 56, velocity); 1148 lastA[4][1] = 0; 1149 } 1150 1151 //A57 1152 if (lastA[4][2] == 7) { 1153 BounceAOn[4][2] = millis(); 1154 } 1155 if ((keysA[4][2] == 0) and (lastA[4][2] == 0) and ((millis() - BounceAOn[4][2]) > Delay)) { 1156 MidiSend(noteOn1, 57, velocity); 1157 lastA[4][2] = 7; 1158 } 1159 if (lastA[4][2] == 0) { 1160 BounceAOff[4][2] = millis(); 1161 } 1162 if ((keysA[4][2] == 1) and (lastA[4][2] == 7) and ((millis() - BounceAOff[4][2]) > Delay)) { 1163 MidiSend(noteOff1, 57, velocity); 1164 lastA[4][2] = 0; 1165 } 1166 1167 //A58 1168 if (lastA[4][3] == 7) { 1169 BounceAOn[4][3] = millis(); 1170 } 1171 if ((keysA[4][3] == 0) and (lastA[4][3] == 0) and ((millis() - BounceAOn[4][3]) > Delay)) { 1172 MidiSend(noteOn1, 58, velocity); 1173 lastA[4][3] = 7; 1174 } 1175 if (lastA[4][3] == 0) { 1176 BounceAOff[4][3] = millis(); 1177 } 1178 if ((keysA[4][3] == 1) and (lastA[4][3] == 7) and ((millis() - BounceAOff[4][3]) > Delay)) { 1179 MidiSend(noteOff1, 58, velocity); 1180 lastA[4][3] = 0; 1181 } 1182 1183 //59 1184 if (lastA[4][4] == 7) { 1185 BounceAOn[4][4] = millis(); 1186 } 1187 if ((keysA[4][4] == 0) and (lastA[4][4] == 0) and ((millis() - BounceAOn[4][4]) > Delay)) { 1188 MidiSend(noteOn1, 59, velocity); 1189 lastA[4][4] = 7; 1190 } 1191 if (lastA[4][4] == 0) { 1192 BounceAOff[4][4] = millis(); 1193 } 1194 if ((keysA[4][4] == 1) and (lastA[4][4] == 7) and ((millis() - BounceAOff[4][4]) > Delay)) { 1195 MidiSend(noteOff1, 59, velocity); 1196 lastA[4][4] = 0; 1197 } 1198 1199 //A60 1200 if (lastA[4][5] == 7) { 1201 BounceAOn[4][5] = millis(); 1202 } 1203 if ((keysA[4][5] == 0) and (lastA[4][5] == 0) and ((millis() - BounceAOn[4][5]) > Delay)) { 1204 MidiSend(noteOn1, 60, velocity); 1205 lastA[4][5] = 7; 1206 } 1207 if (lastA[4][5] == 0) { 1208 BounceAOff[4][5] = millis(); 1209 } 1210 if ((keysA[4][5] == 1) and (lastA[4][5] == 7) and ((millis() - BounceAOff[4][5]) > Delay)) { 1211 MidiSend(noteOff1, 60, velocity); 1212 lastA[4][5] = 0; 1213 } 1214 1215 //A61 1216 if (lastA[5][0] == 7) { 1217 BounceAOn[5][0] = millis(); 1218 } 1219 if ((keysA[5][0] == 0) and (lastA[5][0] == 0) and ((millis() - BounceAOn[5][0]) > Delay)) { 1220 MidiSend(noteOn1, 61, velocity); 1221 lastA[5][0] = 7; 1222 } 1223 if (lastA[5][0] == 0) { 1224 BounceAOff[5][0] = millis(); 1225 } 1226 if ((keysA[5][0] == 1) and (lastA[5][0] == 7) and ((millis() - BounceAOff[5][0]) > Delay)) { 1227 MidiSend(noteOff1, 61, velocity); 1228 lastA[5][0] = 0; 1229 } 1230 1231 //A62 1232 if (lastA[5][1] == 7) { 1233 BounceAOn[5][1] = millis(); 1234 } 1235 if ((keysA[5][1] == 0) and (lastA[5][1] == 0) and ((millis() - BounceAOn[5][1]) > Delay)) { 1236 MidiSend(noteOn1, 62, velocity); 1237 lastA[5][1] = 7; 1238 } 1239 if (lastA[5][1] == 0) { 1240 BounceAOff[5][1] = millis(); 1241 } 1242 if ((keysA[5][1] == 1) and (lastA[5][1] == 7) and ((millis() - BounceAOff[5][1]) > Delay)) { 1243 MidiSend(noteOff1, 62, velocity); 1244 lastA[5][1] = 0; 1245 } 1246 1247 //A63 1248 if (lastA[5][2] == 7) { 1249 BounceAOn[5][2] = millis(); 1250 } 1251 if ((keysA[5][2] == 0) and (lastA[5][2] == 0) and ((millis() - BounceAOn[5][2]) > Delay)) { 1252 MidiSend(noteOn1, 63, velocity); 1253 lastA[5][2] = 7; 1254 } 1255 if (lastA[5][2] == 0) { 1256 BounceAOff[5][2] = millis(); 1257 } 1258 if ((keysA[5][2] == 1) and (lastA[5][2] == 7) and ((millis() - BounceAOff[5][2]) > Delay)) { 1259 MidiSend(noteOff1, 63, velocity); 1260 lastA[5][2] = 0; 1261 } 1262 1263 //A64 1264 if (lastA[5][3] == 7) { 1265 BounceAOn[5][3] = millis(); 1266 } 1267 if ((keysA[5][3] == 0) and (lastA[5][3] == 0) and ((millis() - BounceAOn[5][3]) > Delay)) { 1268 MidiSend(noteOn1, 64, velocity); 1269 lastA[5][3] = 7; 1270 } 1271 if (lastA[5][3] == 0) { 1272 BounceAOff[5][3] = millis(); 1273 } 1274 if ((keysA[5][3] == 1) and (lastA[5][3] == 7) and ((millis() - BounceAOff[5][3]) > Delay)) { 1275 MidiSend(noteOff1, 64, velocity); 1276 lastA[5][3] = 0; 1277 } 1278 1279 //A65 1280 if (lastA[5][4] == 7) { 1281 BounceAOn[5][4] = millis(); 1282 } 1283 if ((keysA[5][4] == 0) and (lastA[5][4] == 0) and ((millis() - BounceAOn[5][4]) > Delay)) { 1284 MidiSend(noteOn1, 65, velocity); 1285 lastA[5][4] = 7; 1286 } 1287 if (lastA[5][4] == 0) { 1288 BounceAOff[5][4] = millis(); 1289 } 1290 if ((keysA[5][4] == 1) and (lastA[5][4] == 7) and ((millis() - BounceAOff[5][4]) > Delay)) { 1291 MidiSend(noteOff1, 65, velocity); 1292 lastA[5][4] = 0; 1293 } 1294 1295 //A66 1296 if (lastA[5][5] == 7) { 1297 BounceAOn[5][5] = millis(); 1298 } 1299 if ((keysA[5][5] == 0) and (lastA[5][5] == 0) and ((millis() - BounceAOn[5][5]) > Delay)) { 1300 MidiSend(noteOn1, 66, velocity); 1301 lastA[5][5] = 7; 1302 } 1303 if (lastA[5][5] == 0) { 1304 BounceAOff[5][5] = millis(); 1305 } 1306 if ((keysA[5][5] == 1) and (lastA[5][5] == 7) and ((millis() - BounceAOff[5][5]) > Delay)) { 1307 MidiSend(noteOff1, 66, velocity); 1308 lastA[5][5] = 0; 1309 } 1310 1311 //A67 1312 if (lastA[6][0] == 7) { 1313 BounceAOn[6][0] = millis(); 1314 } 1315 if ((keysA[6][0] == 0) and (lastA[6][0] == 0) and ((millis() - BounceAOn[6][0]) > Delay)) { 1316 MidiSend(noteOn1, 67, velocity); 1317 lastA[6][0] = 7; 1318 } 1319 if (lastA[6][0] == 0) { 1320 BounceAOff[6][0] = millis(); 1321 } 1322 if ((keysA[6][0] == 1) and (lastA[6][0] == 7) and ((millis() - BounceAOff[6][0]) > Delay)) { 1323 MidiSend(noteOff1, 67, velocity); 1324 lastA[6][0] = 0; 1325 } 1326 1327 //A68 1328 if (lastA[6][1] == 7) { 1329 BounceAOn[6][1] = millis(); 1330 } 1331 if ((keysA[6][1] == 0) and (lastA[6][1] == 0) and ((millis() - BounceAOn[6][1]) > Delay)) { 1332 MidiSend(noteOn1, 68, velocity); 1333 lastA[6][1] = 7; 1334 } 1335 if (lastA[6][1] == 0) { 1336 BounceAOff[6][1] = millis(); 1337 } 1338 if ((keysA[6][1] == 1) and (lastA[6][1] == 7) and ((millis() - BounceAOff[6][1]) > Delay)) { 1339 MidiSend(noteOff1, 68, velocity); 1340 lastA[6][1] = 0; 1341 } 1342 1343 //A69 1344 if (lastA[6][2] == 7) { 1345 BounceAOn[6][2] = millis(); 1346 } 1347 if ((keysA[6][2] == 0) and (lastA[6][2] == 0) and ((millis() - BounceAOn[6][2]) > Delay)) { 1348 MidiSend(noteOn1, 69, velocity); 1349 lastA[6][2] = 7; 1350 } 1351 if (lastA[6][2] == 0) { 1352 BounceAOff[6][2] = millis(); 1353 } 1354 if ((keysA[6][2] == 1) and (lastA[6][2] == 7) and ((millis() - BounceAOff[6][2]) > Delay)) { 1355 MidiSend(noteOff1, 69, velocity); 1356 lastA[6][2] = 0; 1357 } 1358 1359 //A70 1360 if (lastA[6][3] == 7) { 1361 BounceAOn[6][3] = millis(); 1362 } 1363 if ((keysA[6][3] == 0) and (lastA[6][3] == 0) and ((millis() - BounceAOn[6][3]) > Delay)) { 1364 MidiSend(noteOn1, 70, velocity); 1365 lastA[6][3] = 7; 1366 } 1367 if (lastA[6][3] == 0) { 1368 BounceAOff[6][3] = millis(); 1369 } 1370 if ((keysA[6][3] == 1) and (lastA[6][3] == 7) and ((millis() - BounceAOff[6][3]) > Delay)) { 1371 MidiSend(noteOff1, 70, velocity); 1372 lastA[6][3] = 0; 1373 } 1374 1375 //A71 1376 if (lastA[6][4] == 7) { 1377 BounceAOn[6][4] = millis(); 1378 } 1379 if ((keysA[6][4] == 0) and (lastA[6][4] == 0) and ((millis() - BounceAOn[6][4]) > Delay)) { 1380 MidiSend(noteOn1, 71, velocity); 1381 lastA[6][4] = 7; 1382 } 1383 if (lastA[6][4] == 0) { 1384 BounceAOff[6][4] = millis(); 1385 } 1386 if ((keysA[6][4] == 1) and (lastA[6][4] == 7) and ((millis() - BounceAOff[6][4]) > Delay)) { 1387 MidiSend(noteOff1, 71, velocity); 1388 lastA[6][4] = 0; 1389 } 1390 1391 //A72 1392 if (lastA[6][5] == 7) { 1393 BounceAOn[6][5] = millis(); 1394 } 1395 if ((keysA[6][5] == 0) and (lastA[6][5] == 0) and ((millis() - BounceAOn[6][5]) > Delay)) { 1396 MidiSend(noteOn1, 72, velocity); 1397 lastA[6][5] = 7; 1398 } 1399 if (lastA[6][5] == 0) { 1400 BounceAOff[6][5] = millis(); 1401 } 1402 if ((keysA[6][5] == 1) and (lastA[6][5] == 7) and ((millis() - BounceAOff[6][5]) > Delay)) { 1403 MidiSend(noteOff1, 72, velocity); 1404 lastA[6][5] = 0; 1405 } 1406 1407 //A73 1408 if (lastA[7][0] == 7) { 1409 BounceAOn[7][0] = millis(); 1410 } 1411 if ((keysA[7][0] == 0) and (lastA[7][0] == 0) and ((millis() - BounceAOn[7][0]) > Delay)) { 1412 MidiSend(noteOn1, 73, velocity); 1413 lastA[7][0] = 7; 1414 } 1415 if (lastA[7][0] == 0) { 1416 BounceAOff[7][0] = millis(); 1417 } 1418 if ((keysA[7][0] == 1) and (lastA[7][0] == 7) and ((millis() - BounceAOff[7][0]) > Delay)) { 1419 MidiSend(noteOff1, 73, velocity); 1420 lastA[7][0] = 0; 1421 } 1422 1423 //A74 1424 if (lastA[7][1] == 7) { 1425 BounceAOn[7][1] = millis(); 1426 } 1427 if ((keysA[7][1] == 0) and (lastA[7][1] == 0) and ((millis() - BounceAOn[7][1]) > Delay)) { 1428 MidiSend(noteOn1, 74, velocity); 1429 lastA[7][1] = 7; 1430 } 1431 if (lastA[7][1] == 0) { 1432 BounceAOff[7][1] = millis(); 1433 } 1434 if ((keysA[7][1] == 1) and (lastA[7][1] == 7) and ((millis() - BounceAOff[7][1]) > Delay)) { 1435 MidiSend(noteOff1, 74, velocity); 1436 lastA[7][1] = 0; 1437 } 1438 1439 //A75 1440 if (lastA[7][2] == 7) { 1441 BounceAOn[7][2] = millis(); 1442 } 1443 if ((keysA[7][2] == 0) and (lastA[7][2] == 0) and ((millis() - BounceAOn[7][2]) > Delay)) { 1444 MidiSend(noteOn1, 75, velocity); 1445 lastA[7][2] = 7; 1446 } 1447 if (lastA[7][2] == 0) { 1448 BounceAOff[7][2] = millis(); 1449 } 1450 if ((keysA[7][2] == 1) and (lastA[7][2] == 7) and ((millis() - BounceAOff[7][2]) > Delay)) { 1451 MidiSend(noteOff1, 75, velocity); 1452 lastA[7][2] = 0; 1453 } 1454 1455 //A76 1456 if (lastA[7][3] == 7) { 1457 BounceAOn[7][3] = millis(); 1458 } 1459 if ((keysA[7][3] == 0) and (lastA[7][3] == 0) and ((millis() - BounceAOn[7][3]) > Delay)) { 1460 MidiSend(noteOn1, 76, velocity); 1461 lastA[7][3] = 7; 1462 } 1463 if (lastA[7][3] == 0) { 1464 BounceAOff[7][3] = millis(); 1465 } 1466 if ((keysA[7][3] == 1) and (lastA[7][3] == 7) and ((millis() - BounceAOff[7][3]) > Delay)) { 1467 MidiSend(noteOff1, 76, velocity); 1468 lastA[7][3] = 0; 1469 } 1470 1471 //A77 1472 if (lastA[7][4] == 7) { 1473 BounceAOn[7][4] = millis(); 1474 } 1475 if ((keysA[7][4] == 0) and (lastA[7][4] == 0) and ((millis() - BounceAOn[7][4]) > Delay)) { 1476 MidiSend(noteOn1, 77, velocity); 1477 lastA[7][4] = 7; 1478 } 1479 if (lastA[7][4] == 0) { 1480 BounceAOff[7][4] = millis(); 1481 } 1482 if ((keysA[7][4] == 1) and (lastA[7][4] == 7) and ((millis() - BounceAOff[7][4]) > Delay)) { 1483 MidiSend(noteOff1, 77, velocity); 1484 lastA[7][4] = 0; 1485 } 1486 1487 //A78 1488 if (lastA[7][5] == 7) { 1489 BounceAOn[7][5] = millis(); 1490 } 1491 if ((keysA[7][5] == 0) and (lastA[7][5] == 0) and ((millis() - BounceAOn[7][5]) > Delay)) { 1492 MidiSend(noteOn1, 78, velocity); 1493 lastA[7][5] = 7; 1494 } 1495 if (lastA[7][5] == 0) { 1496 BounceAOff[7][5] = millis(); 1497 } 1498 if ((keysA[7][5] == 1) and (lastA[7][5] == 7) and ((millis() - BounceAOff[7][5]) > Delay)) { 1499 MidiSend(noteOff1, 78, velocity); 1500 lastA[7][5] = 0; 1501 } 1502 1503 //A79 1504 if (lastA[8][0] == 7) { 1505 BounceAOn[8][0] = millis(); 1506 } 1507 if ((keysA[8][0] == 0) and (lastA[8][0] == 0) and ((millis() - BounceAOn[8][0]) > Delay)) { 1508 MidiSend(noteOn1, 79, velocity); 1509 lastA[8][0] = 7; 1510 } 1511 if (lastA[8][0] == 0) { 1512 BounceAOff[8][0] = millis(); 1513 } 1514 if ((keysA[8][0] == 1) and (lastA[8][0] == 7) and ((millis() - BounceAOff[8][0]) > Delay)) { 1515 MidiSend(noteOff1, 79, velocity); 1516 lastA[8][0] = 0; 1517 } 1518 1519 //A80 1520 if (lastA[8][1] == 7) { 1521 BounceAOn[8][1] = millis(); 1522 } 1523 if ((keysA[8][1] == 0) and (lastA[8][1] == 0) and ((millis() - BounceAOn[8][1]) > Delay)) { 1524 MidiSend(noteOn1, 80, velocity); 1525 lastA[8][1] = 7; 1526 } 1527 if (lastA[8][1] == 0) { 1528 BounceAOff[8][1] = millis(); 1529 } 1530 if ((keysA[8][1] == 1) and (lastA[8][1] == 7) and ((millis() - BounceAOff[8][1]) > Delay)) { 1531 MidiSend(noteOff1, 80, velocity); 1532 lastA[8][1] = 0; 1533 } 1534 1535 //A81 1536 if (lastA[8][2] == 7) { 1537 BounceAOn[8][2] = millis(); 1538 } 1539 if ((keysA[8][2] == 0) and (lastA[8][2] == 0) and ((millis() - BounceAOn[8][2]) > Delay)) { 1540 MidiSend(noteOn1, 81, velocity); 1541 lastA[8][2] = 7; 1542 } 1543 if (lastA[8][2] == 0) { 1544 BounceAOff[8][2] = millis(); 1545 } 1546 if ((keysA[8][2] == 1) and (lastA[8][2] == 7) and ((millis() - BounceAOff[8][2]) > Delay)) { 1547 MidiSend(noteOff1, 81, velocity); 1548 lastA[8][2] = 0; 1549 } 1550 1551 //A82 1552 if (lastA[8][3] == 7) { 1553 BounceAOn[8][3] = millis(); 1554 } 1555 if ((keysA[8][3] == 0) and (lastA[8][3] == 0) and ((millis() - BounceAOn[8][3]) > Delay)) { 1556 MidiSend(noteOn1, 82, velocity); 1557 lastA[8][3] = 7; 1558 } 1559 if (lastA[8][3] == 0) { 1560 BounceAOff[8][3] = millis(); 1561 } 1562 if ((keysA[8][3] == 1) and (lastA[8][3] == 7) and ((millis() - BounceAOff[8][3]) > Delay)) { 1563 MidiSend(noteOff1, 82, velocity); 1564 lastA[8][3] = 0; 1565 } 1566 1567 //A83 1568 if (lastA[8][4] == 7) { 1569 BounceAOn[8][4] = millis(); 1570 } 1571 if ((keysA[8][4] == 0) and (lastA[8][4] == 0) and ((millis() - BounceAOn[8][4]) > Delay)) { 1572 MidiSend(noteOn1, 83, velocity); 1573 lastA[8][4] = 7; 1574 } 1575 if (lastA[8][4] == 0) { 1576 BounceAOff[8][4] = millis(); 1577 } 1578 if ((keysA[8][4] == 1) and (lastA[8][4] == 7) and ((millis() - BounceAOff[8][4]) > Delay)) { 1579 MidiSend(noteOff1, 83, velocity); 1580 lastA[8][4] = 0; 1581 } 1582 1583 //A84 1584 if (lastA[8][5] == 7) { 1585 BounceAOn[8][5] = millis(); 1586 } 1587 if ((keysA[8][5] == 0) and (lastA[8][5] == 0) and ((millis() - BounceAOn[8][5]) > Delay)) { 1588 MidiSend(noteOn1, 84, velocity); 1589 lastA[8][5] = 7; 1590 } 1591 if (lastA[8][5] == 0) { 1592 BounceAOff[8][5] = millis(); 1593 } 1594 if ((keysA[8][5] == 1) and (lastA[8][5] == 7) and ((millis() - BounceAOff[8][5]) > Delay)) { 1595 MidiSend(noteOff1, 84, velocity); 1596 lastA[8][5] = 0; 1597 } 1598 1599 //A85 1600 if (lastA[9][0] == 7) { 1601 BounceAOn[9][0] = millis(); 1602 } 1603 if ((keysA[9][0] == 0) and (lastA[9][0] == 0) and ((millis() - BounceAOn[9][0]) > Delay)) { 1604 MidiSend(noteOn1, 85, velocity); 1605 lastA[9][0] = 7; 1606 } 1607 if (lastA[9][0] == 0) { 1608 BounceAOff[9][0] = millis(); 1609 } 1610 if ((keysA[9][0] == 1) and (lastA[9][0] == 7) and ((millis() - BounceAOff[9][0]) > Delay)) { 1611 MidiSend(noteOff1, 85, velocity); 1612 lastA[9][0] = 0; 1613 } 1614 1615 //A86 1616 if (lastA[9][1] == 7) { 1617 BounceAOn[9][1] = millis(); 1618 } 1619 if ((keysA[9][1] == 0) and (lastA[9][1] == 0) and ((millis() - BounceAOn[9][1]) > Delay)) { 1620 MidiSend(noteOn1, 86, velocity); 1621 lastA[9][1] = 7; 1622 } 1623 if (lastA[9][1] == 0) { 1624 BounceAOff[9][1] = millis(); 1625 } 1626 if ((keysA[9][1] == 1) and (lastA[9][1] == 7) and ((millis() - BounceAOff[9][1]) > Delay)) { 1627 MidiSend(noteOff1, 86, velocity); 1628 lastA[9][1] = 0; 1629 } 1630 1631 //A87 1632 if (lastA[9][2] == 7) { 1633 BounceAOn[9][2] = millis(); 1634 } 1635 if ((keysA[9][2] == 0) and (lastA[9][2] == 0) and ((millis() - BounceAOn[9][2]) > Delay)) { 1636 MidiSend(noteOn1, 87, velocity); 1637 lastA[9][2] = 7; 1638 } 1639 if (lastA[9][2] == 0) { 1640 BounceAOff[9][2] = millis(); 1641 } 1642 if ((keysA[9][2] == 1) and (lastA[9][2] == 7) and ((millis() - BounceAOff[9][2]) > Delay)) { 1643 MidiSend(noteOff1, 87, velocity); 1644 lastA[9][2] = 0; 1645 } 1646 1647 //A88 1648 if (lastA[9][3] == 7) { 1649 BounceAOn[9][3] = millis(); 1650 } 1651 if ((keysA[9][3] == 0) and (lastA[9][3] == 0) and ((millis() - BounceAOn[9][3]) > Delay)) { 1652 MidiSend(noteOn1, 88, velocity); 1653 lastA[9][3] = 7; 1654 } 1655 if (lastA[9][3] == 0) { 1656 BounceAOff[9][3] = millis(); 1657 } 1658 if ((keysA[9][3] == 1) and (lastA[9][3] == 7) and ((millis() - BounceAOff[9][3]) > Delay)) { 1659 MidiSend(noteOff1, 88, velocity); 1660 lastA[9][3] = 0; 1661 } 1662 1663 //A89 1664 if (lastA[9][4] == 7) { 1665 BounceAOn[9][4] = millis(); 1666 } 1667 if ((keysA[9][4] == 0) and (lastA[9][4] == 0) and ((millis() - BounceAOn[9][4]) > Delay)) { 1668 MidiSend(noteOn1, 89, velocity); 1669 lastA[9][4] = 7; 1670 } 1671 if (lastA[9][4] == 0) { 1672 BounceAOff[9][4] = millis(); 1673 } 1674 if ((keysA[9][4] == 1) and (lastA[9][4] == 7) and ((millis() - BounceAOff[9][4]) > Delay)) { 1675 MidiSend(noteOff1, 89, velocity); 1676 lastA[9][4] = 0; 1677 } 1678 1679 //A90 1680 if (lastA[9][5] == 7) { 1681 BounceAOn[9][5] = millis(); 1682 } 1683 if ((keysA[9][5] == 0) and (lastA[9][5] == 0) and ((millis() - BounceAOn[9][5]) > Delay)) { 1684 MidiSend(noteOn1, 90, velocity); 1685 lastA[9][5] = 7; 1686 } 1687 if (lastA[9][5] == 0) { 1688 BounceAOff[9][5] = millis(); 1689 } 1690 if ((keysA[9][5] == 1) and (lastA[9][5] == 7) and ((millis() - BounceAOff[9][5]) > Delay)) { 1691 MidiSend(noteOff1, 90, velocity); 1692 lastA[9][5] = 0; 1693 } 1694 1695 //A91 1696 if (lastA[10][0] == 7) { 1697 BounceAOn[10][0] = millis(); 1698 } 1699 if ((keysA[10][0] == 0) and (lastA[10][0] == 0) and ((millis() - BounceAOn[10][0]) > Delay)) { 1700 MidiSend(noteOn1, 91, velocity); 1701 lastA[10][0] = 7; 1702 } 1703 if (lastA[10][0] == 0) { 1704 BounceAOff[10][0] = millis(); 1705 } 1706 if ((keysA[10][0] == 1) and (lastA[10][0] == 7) and ((millis() - BounceAOff[10][0]) > Delay)) { 1707 MidiSend(noteOff1, 91, velocity); 1708 lastA[10][0] = 0; 1709 } 1710 1711 //A92 1712 if (lastA[10][1] == 7) { 1713 BounceAOn[10][1] = millis(); 1714 } 1715 if ((keysA[10][1] == 0) and (lastA[10][1] == 0) and ((millis() - BounceAOn[10][1]) > Delay)) { 1716 MidiSend(noteOn1, 92, velocity); 1717 lastA[10][1] = 7; 1718 } 1719 if (lastA[10][1] == 0) { 1720 BounceAOff[10][1] = millis(); 1721 } 1722 if ((keysA[10][1] == 1) and (lastA[10][1] == 7) and ((millis() - BounceAOff[10][1]) > Delay)) { 1723 MidiSend(noteOff1, 92, velocity); 1724 lastA[10][1] = 0; 1725 } 1726 1727 //A93 1728 if (lastA[10][2] == 7) { 1729 BounceAOn[10][2] = millis(); 1730 } 1731 if ((keysA[10][2] == 0) and (lastA[10][2] == 0) and ((millis() - BounceAOn[10][2]) > Delay)) { 1732 MidiSend(noteOn1, 93, velocity); 1733 lastA[10][2] = 7; 1734 } 1735 if (lastA[10][2] == 0) { 1736 BounceAOff[10][2] = millis(); 1737 } 1738 if ((keysA[10][2] == 1) and (lastA[10][2] == 7) and ((millis() - BounceAOff[10][2]) > Delay)) { 1739 MidiSend(noteOff1, 93, velocity); 1740 lastA[10][2] = 0; 1741 } 1742 1743 //A94 1744 if (lastA[10][3] == 7) { 1745 BounceAOn[10][3] = millis(); 1746 } 1747 if ((keysA[10][3] == 0) and (lastA[10][3] == 0) and ((millis() - BounceAOn[10][3]) > Delay)) { 1748 MidiSend(noteOn1, 94, velocity); 1749 lastA[10][3] = 7; 1750 } 1751 if (lastA[10][3] == 0) { 1752 BounceAOff[10][3] = millis(); 1753 } 1754 if ((keysA[10][3] == 1) and (lastA[10][3] == 7) and ((millis() - BounceAOff[10][3]) > Delay)) { 1755 MidiSend(noteOff1, 94, velocity); 1756 lastA[10][3] = 0; 1757 } 1758 1759 //A95 1760 if (lastA[10][4] == 7) { 1761 BounceAOn[10][4] = millis(); 1762 } 1763 if ((keysA[10][4] == 0) and (lastA[10][4] == 0) and ((millis() - BounceAOn[10][4]) > Delay)) { 1764 MidiSend(noteOn1, 95, velocity); 1765 lastA[10][4] = 7; 1766 } 1767 if (lastA[10][4] == 0) { 1768 BounceAOff[10][4] = millis(); 1769 } 1770 if ((keysA[10][4] == 1) and (lastA[10][4] == 7) and ((millis() - BounceAOff[10][4]) > Delay)) { 1771 MidiSend(noteOff1, 95, velocity); 1772 lastA[10][4] = 0; 1773 } 1774 1775 //A96 1776 if (lastA[10][5] == 7) { 1777 BounceAOn[10][5] = millis(); 1778 } 1779 if ((keysA[10][5] == 0) and (lastA[10][5] == 0) and ((millis() - BounceAOn[10][5]) > Delay)) { 1780 MidiSend(noteOn1, 96, velocity); 1781 lastA[10][5] = 7; 1782 } 1783 if (lastA[10][5] == 0) { 1784 BounceAOff[10][5] = millis(); 1785 } 1786 if ((keysA[10][5] == 1) and (lastA[10][5] == 7) and ((millis() - BounceAOff[10][5]) > Delay)) { 1787 MidiSend(noteOff1, 96, velocity); 1788 lastA[10][5] = 0; 1789 } 1790 1791 //Write Keyboard B 1792 1793 //B36 1794 if (lastB[0][0] == 7) { 1795 BounceBOn[0][0] = millis(); 1796 } 1797 if ((keysB[0][0] == 0) and (lastB[0][0] == 0) and ((millis() - BounceBOn[0][0]) > Delay)) { 1798 MidiSend(noteOn2, 36, velocity); 1799 lastB[0][0] = 7; 1800 } 1801 if (lastB[0][0] == 0) { 1802 BounceBOff[0][0] = millis(); 1803 } 1804 if ((keysB[0][0] == 1) and (lastB[0][0] == 7) and ((millis() - BounceBOff[0][0]) > Delay)) { 1805 MidiSend(noteOff2, 36, velocity); 1806 lastB[0][0] = 0; 1807 } 1808 1809 //B37 1810 if (lastB[1][0] == 7) { 1811 BounceBOn[1][0] = millis(); 1812 } 1813 if ((keysB[1][0] == 0) and (lastB[1][0] == 0) and ((millis() - BounceBOn[1][0]) > Delay)) { 1814 MidiSend(noteOn2, 37, velocity); 1815 lastB[1][0] = 7; 1816 } 1817 if (lastB[1][0] == 0) { 1818 BounceBOff[1][0] = millis(); 1819 } 1820 if ((keysB[1][0] == 1) and (lastB[1][0] == 7) and ((millis() - BounceBOff[1][0]) > Delay)) { 1821 MidiSend(noteOff2, 37, velocity); 1822 lastB[1][0] = 0; 1823 } 1824 1825 //B38 1826 if (lastB[1][1] == 7) { 1827 BounceBOn[1][1] = millis(); 1828 } 1829 if ((keysB[1][1] == 0) and (lastB[1][1] == 0) and ((millis() - BounceBOn[1][1]) > Delay)) { 1830 MidiSend(noteOn2, 38, velocity); 1831 lastB[1][1] = 7; 1832 } 1833 if (lastB[1][1] == 0) { 1834 BounceBOff[1][1] = millis(); 1835 } 1836 if ((keysB[1][1] == 1) and (lastB[1][1] == 7) and ((millis() - BounceBOff[1][1]) > Delay)) { 1837 MidiSend(noteOff2, 38, velocity); 1838 lastB[1][1] = 0; 1839 } 1840 1841 //B39 1842 if (lastB[1][2] == 7) { 1843 BounceBOn[1][2] = millis(); 1844 } 1845 if ((keysB[1][2] == 0) and (lastB[1][2] == 0) and ((millis() - BounceBOn[1][2]) > Delay)) { 1846 MidiSend(noteOn2, 39, velocity); 1847 lastB[1][2] = 7; 1848 } 1849 if (lastB[1][2] == 0) { 1850 BounceBOff[1][2] = millis(); 1851 } 1852 if ((keysB[1][2] == 1) and (lastB[1][2] == 7) and ((millis() - BounceBOff[1][2]) > Delay)) { 1853 MidiSend(noteOff2, 39, velocity); 1854 lastB[1][2] = 0; 1855 } 1856 1857 //B40 1858 if (lastB[1][3] == 7) { 1859 BounceBOn[1][3] = millis(); 1860 } 1861 if ((keysB[1][3] == 0) and (lastB[1][3] == 0) and ((millis() - BounceBOn[1][3]) > Delay)) { 1862 MidiSend(noteOn2, 40, velocity); 1863 lastB[1][3] = 7; 1864 } 1865 if (lastB[1][3] == 0) { 1866 BounceBOff[1][3] = millis(); 1867 } 1868 if ((keysB[1][3] == 1) and (lastB[1][3] == 7) and ((millis() - BounceBOff[1][3]) > Delay)) { 1869 MidiSend(noteOff2, 40, velocity); 1870 lastB[1][3] = 0; 1871 } 1872 1873 //B41 1874 if (lastB[1][4] == 7) { 1875 BounceBOn[1][4] = millis(); 1876 } 1877 if ((keysB[1][4] == 0) and (lastB[1][4] == 0) and ((millis() - BounceBOn[1][4]) > Delay)) { 1878 MidiSend(noteOn2, 41, velocity); 1879 lastB[1][4] = 7; 1880 } 1881 if (lastB[1][4] == 0) { 1882 BounceBOff[1][4] = millis(); 1883 } 1884 if ((keysB[1][4] == 1) and (lastB[1][4] == 7) and ((millis() - BounceBOff[1][4]) > Delay)) { 1885 MidiSend(noteOff2, 41, velocity); 1886 lastB[1][4] = 0; 1887 } 1888 1889 //B42 1890 if (lastB[1][5] == 7) { 1891 BounceBOn[1][5] = millis(); 1892 } 1893 if ((keysB[1][5] == 0) and (lastB[1][5] == 0) and ((millis() - BounceBOn[1][5]) > Delay)) { 1894 MidiSend(noteOn2, 42, velocity); 1895 lastB[1][5] = 7; 1896 } 1897 if (lastB[1][5] == 0) { 1898 BounceBOff[1][5] = millis(); 1899 } 1900 if ((keysB[1][5] == 1) and (lastB[1][5] == 7) and ((millis() - BounceBOff[1][5]) > Delay)) { 1901 MidiSend(noteOff2, 42, velocity); 1902 lastB[1][5] = 0; 1903 } 1904 1905 //B43 1906 if (lastB[2][0] == 7) { 1907 BounceBOn[2][0] = millis(); 1908 } 1909 if ((keysB[2][0] == 0) and (lastB[2][0] == 0) and ((millis() - BounceBOn[2][0]) > Delay)) { 1910 MidiSend(noteOn2, 43, velocity); 1911 lastB[2][0] = 7; 1912 } 1913 if (lastB[2][0] == 0) { 1914 BounceBOff[2][0] = millis(); 1915 } 1916 if ((keysB[2][0] == 1) and (lastB[2][0] == 7) and ((millis() - BounceBOff[2][0]) > Delay)) { 1917 MidiSend(noteOff2, 43, velocity); 1918 lastB[2][0] = 0; 1919 } 1920 1921 //B44 1922 if (lastB[2][1] == 7) { 1923 BounceBOn[2][1] = millis(); 1924 } 1925 if ((keysB[2][1] == 0) and (lastB[2][1] == 0) and ((millis() - BounceBOn[2][1]) > Delay)) { 1926 MidiSend(noteOn2, 44, velocity); 1927 lastB[2][1] = 7; 1928 } 1929 if (lastB[2][1] == 0) { 1930 BounceBOff[2][1] = millis(); 1931 } 1932 if ((keysB[2][1] == 1) and (lastB[2][1] == 7) and ((millis() - BounceBOff[2][1]) > Delay)) { 1933 MidiSend(noteOff2, 44, velocity); 1934 lastB[2][1] = 0; 1935 } 1936 1937 //B45 1938 if (lastB[2][2] == 7) { 1939 BounceBOn[2][2] = millis(); 1940 } 1941 if ((keysB[2][2] == 0) and (lastB[2][2] == 0) and ((millis() - BounceBOn[2][2]) > Delay)) { 1942 MidiSend(noteOn2, 45, velocity); 1943 lastB[2][2] = 7; 1944 } 1945 if (lastB[2][2] == 0) { 1946 BounceBOff[2][2] = millis(); 1947 } 1948 if ((keysB[2][2] == 1) and (lastB[2][2] == 7) and ((millis() - BounceBOff[2][2]) > Delay)) { 1949 MidiSend(noteOff2, 45, velocity); 1950 lastB[2][2] = 0; 1951 } 1952 1953 //B46 1954 if (lastB[2][3] == 7) { 1955 BounceBOn[2][3] = millis(); 1956 } 1957 if ((keysB[2][3] == 0) and (lastB[2][3] == 0) and ((millis() - BounceBOn[2][3]) > Delay)) { 1958 MidiSend(noteOn2, 46, velocity); 1959 lastB[2][3] = 7; 1960 } 1961 if (lastB[2][3] == 0) { 1962 BounceBOff[2][3] = millis(); 1963 } 1964 if ((keysB[2][3] == 1) and (lastB[2][3] == 7) and ((millis() - BounceBOff[2][3]) > Delay)) { 1965 MidiSend(noteOff2, 46, velocity); 1966 lastB[2][3] = 0; 1967 } 1968 1969 //B47 1970 if (lastB[2][4] == 7) { 1971 BounceBOn[2][4] = millis(); 1972 } 1973 if ((keysB[2][4] == 0) and (lastB[2][4] == 0) and ((millis() - BounceBOn[2][4]) > Delay)) { 1974 MidiSend(noteOn2, 47, velocity); 1975 lastB[2][4] = 7; 1976 } 1977 if (lastB[2][4] == 0) { 1978 BounceBOff[2][4] = millis(); 1979 } 1980 if ((keysB[2][4] == 1) and (lastB[2][4] == 7) and ((millis() - BounceBOff[2][4]) > Delay)) { 1981 MidiSend(noteOff2, 47, velocity); 1982 lastB[2][4] = 0; 1983 } 1984 1985 //B48 1986 if (lastB[2][5] == 7) { 1987 BounceBOn[2][5] = millis(); 1988 } 1989 if ((keysB[2][5] == 0) and (lastB[2][5] == 0) and ((millis() - BounceBOn[2][5]) > Delay)) { 1990 MidiSend(noteOn2, 48, velocity); 1991 lastB[2][5] = 7; 1992 } 1993 if (lastB[2][5] == 0) { 1994 BounceBOff[2][5] = millis(); 1995 } 1996 if ((keysB[2][5] == 1) and (lastB[2][5] == 7) and ((millis() - BounceBOff[2][5]) > Delay)) { 1997 MidiSend(noteOff2, 48, velocity); 1998 lastB[2][5] = 0; 1999 } 2000 2001 //B49 2002 if (lastB[3][0] == 7) { 2003 BounceBOn[3][0] = millis(); 2004 } 2005 if ((keysB[3][0] == 0) and (lastB[3][0] == 0) and ((millis() - BounceBOn[3][0]) > Delay)) { 2006 MidiSend(noteOn2, 49, velocity); 2007 lastB[3][0] = 7; 2008 } 2009 if (lastB[3][0] == 0) { 2010 BounceBOff[3][0] = millis(); 2011 } 2012 if ((keysB[3][0] == 1) and (lastB[3][0] == 7) and ((millis() - BounceBOff[3][0]) > Delay)) { 2013 MidiSend(noteOff2, 49, velocity); 2014 lastB[3][0] = 0; 2015 } 2016 2017 //B50 2018 if (lastB[3][1] == 7) { 2019 BounceBOn[3][1] = millis(); 2020 } 2021 if ((keysB[3][1] == 0) and (lastB[3][1] == 0) and ((millis() - BounceBOn[3][1]) > Delay)) { 2022 MidiSend(noteOn2, 50, velocity); 2023 lastB[3][1] = 7; 2024 } 2025 if (lastB[3][1] == 0) { 2026 BounceBOff[3][1] = millis(); 2027 } 2028 if ((keysB[3][1] == 1) and (lastB[3][1] == 7) and ((millis() - BounceBOff[3][1]) > Delay)) { 2029 MidiSend(noteOff2, 50, velocity); 2030 lastB[3][1] = 0; 2031 } 2032 2033 //B51 2034 if (lastB[3][2] == 7) { 2035 BounceBOn[3][2] = millis(); 2036 } 2037 if ((keysB[3][2] == 0) and (lastB[3][2] == 0) and ((millis() - BounceBOn[3][2]) > Delay)) { 2038 MidiSend(noteOn2, 51, velocity); 2039 lastB[3][2] = 7; 2040 } 2041 if (lastB[3][2] == 0) { 2042 BounceBOff[3][2] = millis(); 2043 } 2044 if ((keysB[3][2] == 1) and (lastB[3][2] == 7) and ((millis() - BounceBOff[3][2]) > Delay)) { 2045 MidiSend(noteOff2, 51, velocity); 2046 lastB[3][2] = 0; 2047 } 2048 2049 //B52 2050 if (lastB[3][3] == 7) { 2051 BounceBOn[3][3] = millis(); 2052 } 2053 if ((keysB[3][3] == 0) and (lastB[3][3] == 0) and ((millis() - BounceBOn[3][3]) > Delay)) { 2054 MidiSend(noteOn2, 52, velocity); 2055 lastB[3][3] = 7; 2056 } 2057 if (lastB[3][3] == 0) { 2058 BounceBOff[3][3] = millis(); 2059 } 2060 if ((keysB[3][3] == 1) and (lastB[3][3] == 7) and ((millis() - BounceBOff[3][3]) > Delay)) { 2061 MidiSend(noteOff2, 52, velocity); 2062 lastB[3][3] = 0; 2063 } 2064 2065 //B53 2066 if (lastB[3][4] == 7) { 2067 BounceBOn[3][4] = millis(); 2068 } 2069 if ((keysB[3][4] == 0) and (lastB[3][4] == 0) and ((millis() - BounceBOn[3][4]) > Delay)) { 2070 MidiSend(noteOn2, 53, velocity); 2071 lastB[3][4] = 7; 2072 } 2073 if (lastB[3][4] == 0) { 2074 BounceBOff[3][4] = millis(); 2075 } 2076 if ((keysB[3][4] == 1) and (lastB[3][4] == 7) and ((millis() - BounceBOff[3][4]) > Delay)) { 2077 MidiSend(noteOff2, 53, velocity); 2078 lastB[3][4] = 0; 2079 } 2080 2081 //B54 2082 if (lastB[3][5] == 7) { 2083 BounceBOn[3][5] = millis(); 2084 } 2085 if ((keysB[3][5] == 0) and (lastB[3][5] == 0) and ((millis() - BounceBOn[3][5]) > Delay)) { 2086 MidiSend(noteOn2, 54, velocity); 2087 lastB[3][5] = 7; 2088 } 2089 if (lastB[3][5] == 0) { 2090 BounceBOff[3][5] = millis(); 2091 } 2092 if ((keysB[3][5] == 1) and (lastB[3][5] == 7) and ((millis() - BounceBOff[3][5]) > Delay)) { 2093 MidiSend(noteOff2, 54, velocity); 2094 lastB[3][5] = 0; 2095 } 2096 2097 //B55 2098 if (lastB[4][0] == 7) { 2099 BounceBOn[4][0] = millis(); 2100 } 2101 if ((keysB[4][0] == 0) and (lastB[4][0] == 0) and ((millis() - BounceBOn[4][0]) > Delay)) { 2102 MidiSend(noteOn2, 55, velocity); 2103 lastB[4][0] = 7; 2104 } 2105 if (lastB[4][0] == 0) { 2106 BounceBOff[4][0] = millis(); 2107 } 2108 if ((keysB[4][0] == 1) and (lastB[4][0] == 7) and ((millis() - BounceBOff[4][0]) > Delay)) { 2109 MidiSend(noteOff2, 55, velocity); 2110 lastB[4][0] = 0; 2111 } 2112 2113 //B56 2114 if (lastB[4][1] == 7) { 2115 BounceBOn[4][1] = millis(); 2116 } 2117 if ((keysB[4][1] == 0) and (lastB[4][1] == 0) and ((millis() - BounceBOn[4][1]) > Delay)) { 2118 MidiSend(noteOn2, 56, velocity); 2119 lastB[4][1] = 7; 2120 } 2121 if (lastB[4][1] == 0) { 2122 BounceBOff[4][1] = millis(); 2123 } 2124 if ((keysB[4][1] == 1) and (lastB[4][1] == 7) and ((millis() - BounceBOff[4][1]) > Delay)) { 2125 MidiSend(noteOff2, 56, velocity); 2126 lastB[4][1] = 0; 2127 } 2128 2129 //B57 2130 if (lastB[4][2] == 7) { 2131 BounceBOn[4][2] = millis(); 2132 } 2133 if ((keysB[4][2] == 0) and (lastB[4][2] == 0) and ((millis() - BounceBOn[4][2]) > Delay)) { 2134 MidiSend(noteOn2, 57, velocity); 2135 lastB[4][2] = 7; 2136 } 2137 if (lastB[4][2] == 0) { 2138 BounceBOff[4][2] = millis(); 2139 } 2140 if ((keysB[4][2] == 1) and (lastB[4][2] == 7) and ((millis() - BounceBOff[4][2]) > Delay)) { 2141 MidiSend(noteOff2, 57, velocity); 2142 lastB[4][2] = 0; 2143 } 2144 2145 //B58 2146 if (lastB[4][3] == 7) { 2147 BounceBOn[4][3] = millis(); 2148 } 2149 if ((keysB[4][3] == 0) and (lastB[4][3] == 0) and ((millis() - BounceBOn[4][3]) > Delay)) { 2150 MidiSend(noteOn2, 58, velocity); 2151 lastB[4][3] = 7; 2152 } 2153 if (lastB[4][3] == 0) { 2154 BounceBOff[4][3] = millis(); 2155 } 2156 if ((keysB[4][3] == 1) and (lastB[4][3] == 7) and ((millis() - BounceBOff[4][3]) > Delay)) { 2157 MidiSend(noteOff2, 58, velocity); 2158 lastB[4][3] = 0; 2159 } 2160 2161 //B59 2162 if (lastB[4][4] == 7) { 2163 BounceBOn[4][4] = millis(); 2164 } 2165 if ((keysB[4][4] == 0) and (lastB[4][4] == 0) and ((millis() - BounceBOn[4][4]) > Delay)) { 2166 MidiSend(noteOn2, 59, velocity); 2167 lastB[4][4] = 7; 2168 } 2169 if (lastB[4][4] == 0) { 2170 BounceBOff[4][4] = millis(); 2171 } 2172 if ((keysB[4][4] == 1) and (lastB[4][4] == 7) and ((millis() - BounceBOff[4][4]) > Delay)) { 2173 MidiSend(noteOff2, 59, velocity); 2174 lastB[4][4] = 0; 2175 } 2176 2177 //B60 2178 if (lastB[4][5] == 7) { 2179 BounceBOn[4][5] = millis(); 2180 } 2181 if ((keysB[4][5] == 0) and (lastB[4][5] == 0) and ((millis() - BounceBOn[4][5]) > Delay)) { 2182 MidiSend(noteOn2, 60, velocity); 2183 lastB[4][5] = 7; 2184 } 2185 if (lastB[4][5] == 0) { 2186 BounceBOff[4][5] = millis(); 2187 } 2188 if ((keysB[4][5] == 1) and (lastB[4][5] == 7) and ((millis() - BounceBOff[4][5]) > Delay)) { 2189 MidiSend(noteOff2, 60, velocity); 2190 lastB[4][5] = 0; 2191 } 2192 2193 //B61 2194 if (lastB[5][0] == 7) { 2195 BounceBOn[5][0] = millis(); 2196 } 2197 if ((keysB[5][0] == 0) and (lastB[5][0] == 0) and ((millis() - BounceBOn[5][0]) > Delay)) { 2198 MidiSend(noteOn2, 61, velocity); 2199 lastB[5][0] = 7; 2200 } 2201 if (lastB[5][0] == 0) { 2202 BounceBOff[5][0] = millis(); 2203 } 2204 if ((keysB[5][0] == 1) and (lastB[5][0] == 7) and ((millis() - BounceBOff[5][0]) > Delay)) { 2205 MidiSend(noteOff2, 61, velocity); 2206 lastB[5][0] = 0; 2207 } 2208 2209 //B62 2210 if (lastB[5][1] == 7) { 2211 BounceBOn[5][1] = millis(); 2212 } 2213 if ((keysB[5][1] == 0) and (lastB[5][1] == 0) and ((millis() - BounceBOn[5][1]) > Delay)) { 2214 MidiSend(noteOn2, 62, velocity); 2215 lastB[5][1] = 7; 2216 } 2217 if (lastB[5][1] == 0) { 2218 BounceBOff[5][1] = millis(); 2219 } 2220 if ((keysB[5][1] == 1) and (lastB[5][1] == 7) and ((millis() - BounceBOff[5][1]) > Delay)) { 2221 MidiSend(noteOff2, 62, velocity); 2222 lastB[5][1] = 0; 2223 } 2224 2225 //B63 2226 if (lastB[5][2] == 7) { 2227 BounceBOn[5][2] = millis(); 2228 } 2229 if ((keysB[5][2] == 0) and (lastB[5][2] == 0) and ((millis() - BounceBOn[5][2]) > Delay)) { 2230 MidiSend(noteOn2, 63, velocity); 2231 lastB[5][2] = 7; 2232 } 2233 if (lastB[5][2] == 0) { 2234 BounceBOff[5][2] = millis(); 2235 } 2236 if ((keysB[5][2] == 1) and (lastB[5][2] == 7) and ((millis() - BounceBOff[5][2]) > Delay)) { 2237 MidiSend(noteOff2, 63, velocity); 2238 lastB[5][2] = 0; 2239 } 2240 2241 //B64 2242 if (lastB[5][3] == 7) { 2243 BounceBOn[5][3] = millis(); 2244 } 2245 if ((keysB[5][3] == 0) and (lastB[5][3] == 0) and ((millis() - BounceBOn[5][3]) > Delay)) { 2246 MidiSend(noteOn2, 64, velocity); 2247 lastB[5][3] = 7; 2248 } 2249 if (lastB[5][3] == 0) { 2250 BounceBOff[5][3] = millis(); 2251 } 2252 if ((keysB[5][3] == 1) and (lastB[5][3] == 7) and ((millis() - BounceBOff[5][3]) > Delay)) { 2253 MidiSend(noteOff2, 64, velocity); 2254 lastB[5][3] = 0; 2255 } 2256 2257 //B65 2258 if (lastB[5][4] == 7) { 2259 BounceBOn[5][4] = millis(); 2260 } 2261 if ((keysB[5][4] == 0) and (lastB[5][4] == 0) and ((millis() - BounceBOn[5][4]) > Delay)) { 2262 MidiSend(noteOn2, 65, velocity); 2263 lastB[5][4] = 7; 2264 } 2265 if (lastB[5][4] == 0) { 2266 BounceBOff[5][4] = millis(); 2267 } 2268 if ((keysB[5][4] == 1) and (lastB[5][4] == 7) and ((millis() - BounceBOff[5][4]) > Delay)) { 2269 MidiSend(noteOff2, 65, velocity); 2270 lastB[5][4] = 0; 2271 } 2272 2273 //B66 2274 if (lastB[5][5] == 7) { 2275 BounceBOn[5][5] = millis(); 2276 } 2277 if ((keysB[5][5] == 0) and (lastB[5][5] == 0) and ((millis() - BounceBOn[5][5]) > Delay)) { 2278 MidiSend(noteOn2, 66, velocity); 2279 lastB[5][5] = 7; 2280 } 2281 if (lastB[5][5] == 0) { 2282 BounceBOff[5][5] = millis(); 2283 } 2284 if ((keysB[5][5] == 1) and (lastB[5][5] == 7) and ((millis() - BounceBOff[5][5]) > Delay)) { 2285 MidiSend(noteOff2, 66, velocity); 2286 lastB[5][5] = 0; 2287 } 2288 2289 //B67 2290 if (lastB[6][0] == 7) { 2291 BounceBOn[6][0] = millis(); 2292 } 2293 if ((keysB[6][0] == 0) and (lastB[6][0] == 0) and ((millis() - BounceBOn[6][0]) > Delay)) { 2294 MidiSend(noteOn2, 67, velocity); 2295 lastB[6][0] = 7; 2296 } 2297 if (lastB[6][0] == 0) { 2298 BounceBOff[6][0] = millis(); 2299 } 2300 if ((keysB[6][0] == 1) and (lastB[6][0] == 7) and ((millis() - BounceBOff[6][0]) > Delay)) { 2301 MidiSend(noteOff2, 67, velocity); 2302 lastB[6][0] = 0; 2303 } 2304 2305 //B68 2306 if (lastB[6][1] == 7) { 2307 BounceBOn[6][1] = millis(); 2308 } 2309 if ((keysB[6][1] == 0) and (lastB[6][1] == 0) and ((millis() - BounceBOn[6][1]) > Delay)) { 2310 MidiSend(noteOn2, 68, velocity); 2311 lastB[6][1] = 7; 2312 } 2313 if (lastB[6][1] == 0) { 2314 BounceBOff[6][1] = millis(); 2315 } 2316 if ((keysB[6][1] == 1) and (lastB[6][1] == 7) and ((millis() - BounceBOff[6][1]) > Delay)) { 2317 MidiSend(noteOff2, 68, velocity); 2318 lastB[6][1] = 0; 2319 } 2320 2321 //B69 2322 if (lastB[6][2] == 7) { 2323 BounceBOn[6][2] = millis(); 2324 } 2325 if ((keysB[6][2] == 0) and (lastB[6][2] == 0) and ((millis() - BounceBOn[6][2]) > Delay)) { 2326 MidiSend(noteOn2, 69, velocity); 2327 lastB[6][2] = 7; 2328 } 2329 if (lastB[6][2] == 0) { 2330 BounceBOff[6][2] = millis(); 2331 } 2332 if ((keysB[6][2] == 1) and (lastB[6][2] == 7) and ((millis() - BounceBOff[6][2]) > Delay)) { 2333 MidiSend(noteOff2, 69, velocity); 2334 lastB[6][2] = 0; 2335 } 2336 2337 //B70 2338 if (lastB[6][3] == 7) { 2339 BounceBOn[6][3] = millis(); 2340 } 2341 if ((keysB[6][3] == 0) and (lastB[6][3] == 0) and ((millis() - BounceBOn[6][3]) > Delay)) { 2342 MidiSend(noteOn2, 70, velocity); 2343 lastB[6][3] = 7; 2344 } 2345 if (lastB[6][3] == 0) { 2346 BounceBOff[6][3] = millis(); 2347 } 2348 if ((keysB[6][3] == 1) and (lastB[6][3] == 7) and ((millis() - BounceBOff[6][3]) > Delay)) { 2349 MidiSend(noteOff2, 70, velocity); 2350 lastB[6][3] = 0; 2351 } 2352 2353 //B71 2354 if (lastB[6][4] == 7) { 2355 BounceBOn[6][4] = millis(); 2356 } 2357 if ((keysB[6][4] == 0) and (lastB[6][4] == 0) and ((millis() - BounceBOn[6][4]) > Delay)) { 2358 MidiSend(noteOn2, 71, velocity); 2359 lastB[6][4] = 7; 2360 } 2361 if (lastB[6][4] == 0) { 2362 BounceBOff[6][4] = millis(); 2363 } 2364 if ((keysB[6][4] == 1) and (lastB[6][4] == 7) and ((millis() - BounceBOff[6][4]) > Delay)) { 2365 MidiSend(noteOff2, 71, velocity); 2366 lastB[6][4] = 0; 2367 } 2368 2369 //B72 2370 if (lastB[6][5] == 7) { 2371 BounceBOn[6][5] = millis(); 2372 } 2373 if ((keysB[6][5] == 0) and (lastB[6][5] == 0) and ((millis() - BounceBOn[6][5]) > Delay)) { 2374 MidiSend(noteOn2, 72, velocity); 2375 lastB[6][5] = 7; 2376 } 2377 if (lastB[6][5] == 0) { 2378 BounceBOff[6][5] = millis(); 2379 } 2380 if ((keysB[6][5] == 1) and (lastB[6][5] == 7) and ((millis() - BounceBOff[6][5]) > Delay)) { 2381 MidiSend(noteOff2, 72, velocity); 2382 lastB[6][5] = 0; 2383 } 2384 2385 //B73 2386 if (lastB[7][0] == 7) { 2387 BounceBOn[7][0] = millis(); 2388 } 2389 if ((keysB[7][0] == 0) and (lastB[7][0] == 0) and ((millis() - BounceBOn[7][0]) > Delay)) { 2390 MidiSend(noteOn2, 73, velocity); 2391 lastB[7][0] = 7; 2392 } 2393 if (lastB[7][0] == 0) { 2394 BounceBOff[7][0] = millis(); 2395 } 2396 if ((keysB[7][0] == 1) and (lastB[7][0] == 7) and ((millis() - BounceBOff[7][0]) > Delay)) { 2397 MidiSend(noteOff2, 73, velocity); 2398 lastB[7][0] = 0; 2399 } 2400 2401 //B74 2402 if (lastB[7][1] == 7) { 2403 BounceBOn[7][1] = millis(); 2404 } 2405 if ((keysB[7][1] == 0) and (lastB[7][1] == 0) and ((millis() - BounceBOn[7][1]) > Delay)) { 2406 MidiSend(noteOn2, 74, velocity); 2407 lastB[7][1] = 7; 2408 } 2409 if (lastB[7][1] == 0) { 2410 BounceBOff[7][1] = millis(); 2411 } 2412 if ((keysB[7][1] == 1) and (lastB[7][1] == 7) and ((millis() - BounceBOff[7][1]) > Delay)) { 2413 MidiSend(noteOff2, 74, velocity); 2414 lastB[7][1] = 0; 2415 } 2416 2417 //B75 2418 if (lastB[7][2] == 7) { 2419 BounceBOn[7][2] = millis(); 2420 } 2421 if ((keysB[7][2] == 0) and (lastB[7][2] == 0) and ((millis() - BounceBOn[7][2]) > Delay)) { 2422 MidiSend(noteOn2, 75, velocity); 2423 lastB[7][2] = 7; 2424 } 2425 if (lastB[7][2] == 0) { 2426 BounceBOff[7][2] = millis(); 2427 } 2428 if ((keysB[7][2] == 1) and (lastB[7][2] == 7) and ((millis() - BounceBOff[7][2]) > Delay)) { 2429 MidiSend(noteOff2, 75, velocity); 2430 lastB[7][2] = 0; 2431 } 2432 2433 //B76 2434 if (lastB[7][3] == 7) { 2435 BounceBOn[7][3] = millis(); 2436 } 2437 if ((keysB[7][3] == 0) and (lastB[7][3] == 0) and ((millis() - BounceBOn[7][3]) > Delay)) { 2438 MidiSend(noteOn2, 76, velocity); 2439 lastB[7][3] = 7; 2440 } 2441 if (lastB[7][3] == 0) { 2442 BounceBOff[7][3] = millis(); 2443 } 2444 if ((keysB[7][3] == 1) and (lastB[7][3] == 7) and ((millis() - BounceBOff[7][3]) > Delay)) { 2445 MidiSend(noteOff2, 76, velocity); 2446 lastB[7][3] = 0; 2447 } 2448 2449 //B77 2450 if (lastB[7][4] == 7) { 2451 BounceBOn[7][4] = millis(); 2452 } 2453 if ((keysB[7][4] == 0) and (lastB[7][4] == 0) and ((millis() - BounceBOn[7][4]) > Delay)) { 2454 MidiSend(noteOn2, 77, velocity); 2455 lastB[7][4] = 7; 2456 } 2457 if (lastB[7][4] == 0) { 2458 BounceBOff[7][4] = millis(); 2459 } 2460 if ((keysB[7][4] == 1) and (lastB[7][4] == 7) and ((millis() - BounceBOff[7][4]) > Delay)) { 2461 MidiSend(noteOff2, 77, velocity); 2462 lastB[7][4] = 0; 2463 } 2464 2465 //B78 2466 if (lastB[7][5] == 7) { 2467 BounceBOn[7][5] = millis(); 2468 } 2469 if ((keysB[7][5] == 0) and (lastB[7][5] == 0) and ((millis() - BounceBOn[7][5]) > Delay)) { 2470 MidiSend(noteOn2, 78, velocity); 2471 lastB[7][5] = 7; 2472 } 2473 if (lastB[7][5] == 0) { 2474 BounceBOff[7][5] = millis(); 2475 } 2476 if ((keysB[7][5] == 1) and (lastB[7][5] == 7) and ((millis() - BounceBOff[7][5]) > Delay)) { 2477 MidiSend(noteOff2, 78, velocity); 2478 lastB[7][5] = 0; 2479 } 2480 2481 //B79 2482 if (lastB[8][0] == 7) { 2483 BounceBOn[8][0] = millis(); 2484 } 2485 if ((keysB[8][0] == 0) and (lastB[8][0] == 0) and ((millis() - BounceBOn[8][0]) > Delay)) { 2486 MidiSend(noteOn2, 79, velocity); 2487 lastB[8][0] = 7; 2488 } 2489 if (lastB[8][0] == 0) { 2490 BounceBOff[8][0] = millis(); 2491 } 2492 if ((keysB[8][0] == 1) and (lastB[8][0] == 7) and ((millis() - BounceBOff[8][0]) > Delay)) { 2493 MidiSend(noteOff2, 79, velocity); 2494 lastB[8][0] = 0; 2495 } 2496 2497 //B80 2498 if (lastB[8][1] == 7) { 2499 BounceBOn[8][1] = millis(); 2500 } 2501 if ((keysB[8][1] == 0) and (lastB[8][1] == 0) and ((millis() - BounceBOn[8][1]) > Delay)) { 2502 MidiSend(noteOn2, 80, velocity); 2503 lastB[8][1] = 7; 2504 } 2505 if (lastB[8][1] == 0) { 2506 BounceBOff[8][1] = millis(); 2507 } 2508 if ((keysB[8][1] == 1) and (lastB[8][1] == 7) and ((millis() - BounceBOff[8][1]) > Delay)) { 2509 MidiSend(noteOff2, 80, velocity); 2510 lastB[8][1] = 0; 2511 } 2512 2513 //B81 2514 if (lastB[8][2] == 7) { 2515 BounceBOn[8][2] = millis(); 2516 } 2517 if ((keysB[8][2] == 0) and (lastB[8][2] == 0) and ((millis() - BounceBOn[8][2]) > Delay)) { 2518 MidiSend(noteOn2, 81, velocity); 2519 lastB[8][2] = 7; 2520 } 2521 if (lastB[8][2] == 0) { 2522 BounceBOff[8][2] = millis(); 2523 } 2524 if ((keysB[8][2] == 1) and (lastB[8][2] == 7) and ((millis() - BounceBOff[8][2]) > Delay)) { 2525 MidiSend(noteOff2, 81, velocity); 2526 lastB[8][2] = 0; 2527 } 2528 2529 //B82 2530 if (lastB[8][3] == 7) { 2531 BounceBOn[8][3] = millis(); 2532 } 2533 if ((keysB[8][3] == 0) and (lastB[8][3] == 0) and ((millis() - BounceBOn[8][3]) > Delay)) { 2534 MidiSend(noteOn2, 82, velocity); 2535 lastB[8][3] = 7; 2536 } 2537 if (lastB[8][3] == 0) { 2538 BounceBOff[8][3] = millis(); 2539 } 2540 if ((keysB[8][3] == 1) and (lastB[8][3] == 7) and ((millis() - BounceBOff[8][3]) > Delay)) { 2541 MidiSend(noteOff2, 82, velocity); 2542 lastB[8][3] = 0; 2543 } 2544 2545 //B83 2546 if (lastB[8][4] == 7) { 2547 BounceBOn[8][4] = millis(); 2548 } 2549 if ((keysB[8][4] == 0) and (lastB[8][4] == 0) and ((millis() - BounceBOn[8][4]) > Delay)) { 2550 MidiSend(noteOn2, 83, velocity); 2551 lastB[8][4] = 7; 2552 } 2553 if (lastB[8][4] == 0) { 2554 BounceBOff[8][4] = millis(); 2555 } 2556 if ((keysB[8][4] == 1) and (lastB[8][4] == 7) and ((millis() - BounceBOff[8][4]) > Delay)) { 2557 MidiSend(noteOff2, 83, velocity); 2558 lastB[8][4] = 0; 2559 } 2560 2561 //B84 2562 if (lastB[8][5] == 7) { 2563 BounceBOn[8][5] = millis(); 2564 } 2565 if ((keysB[8][5] == 0) and (lastB[8][5] == 0) and ((millis() - BounceBOn[8][5]) > Delay)) { 2566 MidiSend(noteOn2, 84, velocity); 2567 lastB[8][5] = 7; 2568 } 2569 if (lastB[8][5] == 0) { 2570 BounceBOff[8][5] = millis(); 2571 } 2572 if ((keysB[8][5] == 1) and (lastB[8][5] == 7) and ((millis() - BounceBOff[8][5]) > Delay)) { 2573 MidiSend(noteOff2, 84, velocity); 2574 lastB[8][5] = 0; 2575 } 2576 2577 //B85 2578 if (lastB[9][0] == 7) { 2579 BounceBOn[9][0] = millis(); 2580 } 2581 if ((keysB[9][0] == 0) and (lastB[9][0] == 0) and ((millis() - BounceBOn[9][0]) > Delay)) { 2582 MidiSend(noteOn2, 85, velocity); 2583 lastB[9][0] = 7; 2584 } 2585 if (lastB[9][0] == 0) { 2586 BounceBOff[9][0] = millis(); 2587 } 2588 if ((keysB[9][0] == 1) and (lastB[9][0] == 7) and ((millis() - BounceBOff[9][0]) > Delay)) { 2589 MidiSend(noteOff2, 85, velocity); 2590 lastB[9][0] = 0; 2591 } 2592 2593 //B86 2594 if (lastB[9][1] == 7) { 2595 BounceBOn[9][1] = millis(); 2596 } 2597 if ((keysB[9][1] == 0) and (lastB[9][1] == 0) and ((millis() - BounceBOn[9][1]) > Delay)) { 2598 MidiSend(noteOn2, 86, velocity); 2599 lastB[9][1] = 7; 2600 } 2601 if (lastB[9][1] == 0) { 2602 BounceBOff[9][1] = millis(); 2603 } 2604 if ((keysB[9][1] == 1) and (lastB[9][1] == 7) and ((millis() - BounceBOff[9][1]) > Delay)) { 2605 MidiSend(noteOff2, 86, velocity); 2606 lastB[9][1] = 0; 2607 } 2608 2609 //B87 2610 if (lastB[9][2] == 7) { 2611 BounceBOn[9][2] = millis(); 2612 } 2613 if ((keysB[9][2] == 0) and (lastB[9][2] == 0) and ((millis() - BounceBOn[9][2]) > Delay)) { 2614 MidiSend(noteOn2, 87, velocity); 2615 lastB[9][2] = 7; 2616 } 2617 if (lastB[9][2] == 0) { 2618 BounceBOff[9][2] = millis(); 2619 } 2620 if ((keysB[9][2] == 1) and (lastB[9][2] == 7) and ((millis() - BounceBOff[9][2]) > Delay)) { 2621 MidiSend(noteOff2, 87, velocity); 2622 lastB[9][2] = 0; 2623 } 2624 2625 //B88 2626 if (lastB[9][3] == 7) { 2627 BounceBOn[9][3] = millis(); 2628 } 2629 if ((keysB[9][3] == 0) and (lastB[9][3] == 0) and ((millis() - BounceBOn[9][3]) > Delay)) { 2630 MidiSend(noteOn2, 88, velocity); 2631 lastB[9][3] = 7; 2632 } 2633 if (lastB[9][3] == 0) { 2634 BounceBOff[9][3] = millis(); 2635 } 2636 if ((keysB[9][3] == 1) and (lastB[9][3] == 7) and ((millis() - BounceBOff[9][3]) > Delay)) { 2637 MidiSend(noteOff2, 88, velocity); 2638 lastB[9][3] = 0; 2639 } 2640 2641 //B89 2642 if (lastB[9][4] == 7) { 2643 BounceBOn[9][4] = millis(); 2644 } 2645 if ((keysB[9][4] == 0) and (lastB[9][4] == 0) and ((millis() - BounceBOn[9][4]) > Delay)) { 2646 MidiSend(noteOn2, 89, velocity); 2647 lastB[9][4] = 7; 2648 } 2649 if (lastB[9][4] == 0) { 2650 BounceBOff[9][4] = millis(); 2651 } 2652 if ((keysB[9][4] == 1) and (lastB[9][4] == 7) and ((millis() - BounceBOff[9][4]) > Delay)) { 2653 MidiSend(noteOff2, 89, velocity); 2654 lastB[9][4] = 0; 2655 } 2656 2657 //B90 2658 if (lastB[9][5] == 7) { 2659 BounceBOn[9][5] = millis(); 2660 } 2661 if ((keysB[9][5] == 0) and (lastB[9][5] == 0) and ((millis() - BounceBOn[9][5]) > Delay)) { 2662 MidiSend(noteOn2, 90, velocity); 2663 lastB[9][5] = 7; 2664 } 2665 if (lastB[9][5] == 0) { 2666 BounceBOff[9][5] = millis(); 2667 } 2668 if ((keysB[9][5] == 1) and (lastB[9][5] == 7) and ((millis() - BounceBOff[9][5]) > Delay)) { 2669 MidiSend(noteOff2, 90, velocity); 2670 lastB[9][5] = 0; 2671 } 2672 2673 //B91 2674 if (lastB[10][0] == 7) { 2675 BounceBOn[10][0] = millis(); 2676 } 2677 if ((keysB[10][0] == 0) and (lastB[10][0] == 0) and ((millis() - BounceBOn[10][0]) > Delay)) { 2678 MidiSend(noteOn2, 91, velocity); 2679 lastB[10][0] = 7; 2680 } 2681 if (lastB[10][0] == 0) { 2682 BounceBOff[10][0] = millis(); 2683 } 2684 if ((keysB[10][0] == 1) and (lastB[10][0] == 7) and ((millis() - BounceBOff[10][0]) > Delay)) { 2685 MidiSend(noteOff2, 91, velocity); 2686 lastB[10][0] = 0; 2687 } 2688 2689 //B92 2690 if (lastB[10][1] == 7) { 2691 BounceBOn[10][1] = millis(); 2692 } 2693 if ((keysB[10][1] == 0) and (lastB[10][1] == 0) and ((millis() - BounceBOn[10][1]) > Delay)) { 2694 MidiSend(noteOn2, 92, velocity); 2695 lastB[10][1] = 7; 2696 } 2697 if (lastB[10][1] == 0) { 2698 BounceBOff[10][1] = millis(); 2699 } 2700 if ((keysB[10][1] == 1) and (lastB[10][1] == 7) and ((millis() - BounceBOff[10][1]) > Delay)) { 2701 MidiSend(noteOff2, 92, velocity); 2702 lastB[10][1] = 0; 2703 } 2704 2705 //B93 2706 if (lastB[10][2] == 7) { 2707 BounceBOn[10][2] = millis(); 2708 } 2709 if ((keysB[10][2] == 0) and (lastB[10][2] == 0) and ((millis() - BounceBOn[10][2]) > Delay)) { 2710 MidiSend(noteOn2, 93, velocity); 2711 lastB[10][2] = 7; 2712 } 2713 if (lastB[10][2] == 0) { 2714 BounceBOff[10][2] = millis(); 2715 } 2716 if ((keysB[10][2] == 1) and (lastB[10][2] == 7) and ((millis() - BounceBOff[10][2]) > Delay)) { 2717 MidiSend(noteOff2, 93, velocity); 2718 lastB[10][2] = 0; 2719 } 2720 2721 //B94 2722 if (lastB[10][3] == 7) { 2723 BounceBOn[10][3] = millis(); 2724 } 2725 if ((keysB[10][3] == 0) and (lastB[10][3] == 0) and ((millis() - BounceBOn[10][3]) > Delay)) { 2726 MidiSend(noteOn2, 94, velocity); 2727 lastB[10][3] = 7; 2728 } 2729 if (lastB[10][3] == 0) { 2730 BounceBOff[10][3] = millis(); 2731 } 2732 if ((keysB[10][3] == 1) and (lastB[10][3] == 7) and ((millis() - BounceBOff[10][3]) > Delay)) { 2733 MidiSend(noteOff2, 94, velocity); 2734 lastB[10][3] = 0; 2735 } 2736 2737 //B95 2738 if (lastB[10][4] == 7) { 2739 BounceBOn[10][4] = millis(); 2740 } 2741 if ((keysB[10][4] == 0) and (lastB[10][4] == 0) and ((millis() - BounceBOn[10][4]) > Delay)) { 2742 MidiSend(noteOn2, 95, velocity); 2743 lastB[10][4] = 7; 2744 } 2745 if (lastB[10][4] == 0) { 2746 BounceBOff[10][4] = millis(); 2747 } 2748 if ((keysB[10][4] == 1) and (lastB[10][4] == 7) and ((millis() - BounceBOff[10][4]) > Delay)) { 2749 MidiSend(noteOff2, 95, velocity); 2750 lastB[10][4] = 0; 2751 } 2752 2753 //B96 2754 if (lastB[10][5] == 7) { 2755 BounceBOn[10][5] = millis(); 2756 } 2757 if ((keysB[10][5] == 0) and (lastB[10][5] == 0) and ((millis() - BounceBOn[10][5]) > Delay)) { 2758 MidiSend(noteOn2, 96, velocity); 2759 lastB[10][5] = 7; 2760 } 2761 if (lastB[10][5] == 0) { 2762 BounceBOff[10][5] = millis(); 2763 } 2764 if ((keysB[10][5] == 1) and (lastB[10][5] == 7) and ((millis() - BounceBOff[10][5]) > Delay)) { 2765 MidiSend(noteOff2, 96, velocity); 2766 lastB[10][5] = 0; 2767 } 2768 2769 //Write Keyboard C, only for inverted switches, first 32 notes only. 2770 2771 //C36 2772 if (lastC[0][0] == 7) { 2773 BounceCOn[0][0] = millis(); 2774 } 2775 if ((keysC[0][0] == 0) and (lastC[0][0] == 0) and ((millis() - BounceCOn[0][0]) > Delay)) { 2776 MidiSend(noteOff3, 36, velocity); 2777 lastC[0][0] = 7; 2778 } 2779 if (lastC[0][0] == 0) { 2780 BounceCOff[0][0] = millis(); 2781 } 2782 if ((keysC[0][0] == 1) and (lastC[0][0] == 7) and ((millis() - BounceCOff[0][0]) > Delay)) { 2783 MidiSend(noteOn3, 36, velocity); 2784 lastC[0][0] = 0; 2785 } 2786 2787 //C37 2788 if (lastC[1][0] == 7) { 2789 BounceCOn[1][0] = millis(); 2790 } 2791 if ((keysC[1][0] == 0) and (lastC[1][0] == 0) and ((millis() - BounceCOn[1][0]) > Delay)) { 2792 MidiSend(noteOff3, 37, velocity); 2793 lastC[1][0] = 7; 2794 } 2795 if (lastC[1][0] == 0) { 2796 BounceCOff[1][0] = millis(); 2797 } 2798 if ((keysC[1][0] == 1) and (lastC[1][0] == 7) and ((millis() - BounceCOff[1][0]) > Delay)) { 2799 MidiSend(noteOn3, 37, velocity); 2800 lastC[1][0] = 0; 2801 } 2802 2803 //C38 2804 if (lastC[1][1] == 7) { 2805 BounceCOn[1][1] = millis(); 2806 } 2807 if ((keysC[1][1] == 0) and (lastC[1][1] == 0) and ((millis() - BounceCOn[1][1]) > Delay)) { 2808 MidiSend(noteOff3, 38, velocity); 2809 lastC[1][1] = 7; 2810 } 2811 if (lastC[1][1] == 0) { 2812 BounceCOff[1][1] = millis(); 2813 } 2814 if ((keysC[1][1] == 1) and (lastC[1][1] == 7) and ((millis() - BounceCOff[1][1]) > Delay)) { 2815 MidiSend(noteOn3, 38, velocity); 2816 lastC[1][1] = 0; 2817 } 2818 2819 //C39 2820 if (lastC[1][2] == 7) { 2821 BounceCOn[1][2] = millis(); 2822 } 2823 if ((keysC[1][2] == 0) and (lastC[1][2] == 0) and ((millis() - BounceCOn[1][2]) > Delay)) { 2824 MidiSend(noteOff3, 39, velocity); 2825 lastC[1][2] = 7; 2826 } 2827 if (lastC[1][2] == 0) { 2828 BounceCOff[1][2] = millis(); 2829 } 2830 if ((keysC[1][2] == 1) and (lastC[1][2] == 7) and ((millis() - BounceCOff[1][2]) > Delay)) { 2831 MidiSend(noteOn3, 39, velocity); 2832 lastC[1][2] = 0; 2833 } 2834 2835 //C40 2836 if (lastC[1][3] == 7) { 2837 BounceCOn[1][3] = millis(); 2838 } 2839 if ((keysC[1][3] == 0) and (lastC[1][3] == 0) and ((millis() - BounceCOn[1][3]) > Delay)) { 2840 MidiSend(noteOff3, 40, velocity); 2841 lastC[1][3] = 7; 2842 } 2843 if (lastC[1][3] == 0) { 2844 BounceCOff[1][3] = millis(); 2845 } 2846 if ((keysC[1][3] == 1) and (lastC[1][3] == 7) and ((millis() - BounceCOff[1][3]) > Delay)) { 2847 MidiSend(noteOn3, 40, velocity); 2848 lastC[1][3] = 0; 2849 } 2850 2851 //C41 2852 if (lastC[1][4] == 7) { 2853 BounceCOn[1][4] = millis(); 2854 } 2855 if ((keysC[1][4] == 0) and (lastC[1][4] == 0) and ((millis() - BounceCOn[1][4]) > Delay)) { 2856 MidiSend(noteOff3, 41, velocity); 2857 lastC[1][4] = 7; 2858 } 2859 if (lastC[1][4] == 0) { 2860 BounceCOff[1][4] = millis(); 2861 } 2862 if ((keysC[1][4] == 1) and (lastC[1][4] == 7) and ((millis() - BounceCOff[1][4]) > Delay)) { 2863 MidiSend(noteOn3, 41, velocity); 2864 lastC[1][4] = 0; 2865 } 2866 2867 //C42 2868 if (lastC[1][5] == 7) { 2869 BounceCOn[1][5] = millis(); 2870 } 2871 if ((keysC[1][5] == 0) and (lastC[1][5] == 0) and ((millis() - BounceCOn[1][5]) > Delay)) { 2872 MidiSend(noteOff3, 42, velocity); 2873 lastC[1][5] = 7; 2874 } 2875 if (lastC[1][5] == 0) { 2876 BounceCOff[1][5] = millis(); 2877 } 2878 if ((keysC[1][5] == 1) and (lastC[1][5] == 7) and ((millis() - BounceCOff[1][5]) > Delay)) { 2879 MidiSend(noteOn3, 42, velocity); 2880 lastC[1][5] = 0; 2881 } 2882 2883 //C43 2884 if (lastC[2][0] == 7) { 2885 BounceCOn[2][0] = millis(); 2886 } 2887 if ((keysC[2][0] == 0) and (lastC[2][0] == 0) and ((millis() - BounceCOn[2][0]) > Delay)) { 2888 MidiSend(noteOff3, 43, velocity); 2889 lastC[2][0] = 7; 2890 } 2891 if (lastC[2][0] == 0) { 2892 BounceCOff[2][0] = millis(); 2893 } 2894 if ((keysC[2][0] == 1) and (lastC[2][0] == 7) and ((millis() - BounceCOff[2][0]) > Delay)) { 2895 MidiSend(noteOn3, 43, velocity); 2896 lastC[2][0] = 0; 2897 } 2898 2899 //C44 2900 if (lastC[2][1] == 7) { 2901 BounceCOn[2][1] = millis(); 2902 } 2903 if ((keysC[2][1] == 0) and (lastC[2][1] == 0) and ((millis() - BounceCOn[2][1]) > Delay)) { 2904 MidiSend(noteOff3, 44, velocity); 2905 lastC[2][1] = 7; 2906 } 2907 if (lastC[2][1] == 0) { 2908 BounceCOff[2][1] = millis(); 2909 } 2910 if ((keysC[2][1] == 1) and (lastC[2][1] == 7) and ((millis() - BounceCOff[2][1]) > Delay)) { 2911 MidiSend(noteOn3, 44, velocity); 2912 lastC[2][1] = 0; 2913 } 2914 2915 //C45 2916 if (lastC[2][2] == 7) { 2917 BounceCOn[2][2] = millis(); 2918 } 2919 if ((keysC[2][2] == 0) and (lastC[2][2] == 0) and ((millis() - BounceCOn[2][2]) > Delay)) { 2920 MidiSend(noteOff3, 45, velocity); 2921 lastC[2][2] = 7; 2922 } 2923 if (lastC[2][2] == 0) { 2924 BounceCOff[2][2] = millis(); 2925 } 2926 if ((keysC[2][2] == 1) and (lastC[2][2] == 7) and ((millis() - BounceCOff[2][2]) > Delay)) { 2927 MidiSend(noteOn3, 45, velocity); 2928 lastC[2][2] = 0; 2929 } 2930 2931 //C46 2932 if (lastC[2][3] == 7) { 2933 BounceCOn[2][3] = millis(); 2934 } 2935 if ((keysC[2][3] == 0) and (lastC[2][3] == 0) and ((millis() - BounceCOn[2][3]) > Delay)) { 2936 MidiSend(noteOff3, 46, velocity); 2937 lastC[2][3] = 7; 2938 } 2939 if (lastC[2][3] == 0) { 2940 BounceCOff[2][3] = millis(); 2941 } 2942 if ((keysC[2][3] == 1) and (lastC[2][3] == 7) and ((millis() - BounceCOff[2][3]) > Delay)) { 2943 MidiSend(noteOn3, 46, velocity); 2944 lastC[2][3] = 0; 2945 } 2946 2947 //C47 2948 if (lastC[2][4] == 7) { 2949 BounceCOn[2][4] = millis(); 2950 } 2951 if ((keysC[2][4] == 0) and (lastC[2][4] == 0) and ((millis() - BounceCOn[2][4]) > Delay)) { 2952 MidiSend(noteOff3, 47, velocity); 2953 lastC[2][4] = 7; 2954 } 2955 if (lastC[2][4] == 0) { 2956 BounceCOff[2][4] = millis(); 2957 } 2958 if ((keysC[2][4] == 1) and (lastC[2][4] == 7) and ((millis() - BounceCOff[2][4]) > Delay)) { 2959 MidiSend(noteOn3, 47, velocity); 2960 lastC[2][4] = 0; 2961 } 2962 2963 //B48 2964 if (lastC[2][5] == 7) { 2965 BounceCOn[2][5] = millis(); 2966 } 2967 if ((keysC[2][5] == 0) and (lastC[2][5] == 0) and ((millis() - BounceCOn[2][5]) > Delay)) { 2968 MidiSend(noteOff3, 48, velocity); 2969 lastC[2][5] = 7; 2970 } 2971 if (lastC[2][5] == 0) { 2972 BounceCOff[2][5] = millis(); 2973 } 2974 if ((keysC[2][5] == 1) and (lastC[2][5] == 7) and ((millis() - BounceCOff[2][5]) > Delay)) { 2975 MidiSend(noteOn3, 48, velocity); 2976 lastC[2][5] = 0; 2977 } 2978 2979 //C49 2980 if (lastC[3][0] == 7) { 2981 BounceCOn[3][0] = millis(); 2982 } 2983 if ((keysC[3][0] == 0) and (lastC[3][0] == 0) and ((millis() - BounceCOn[3][0]) > Delay)) { 2984 MidiSend(noteOff3, 49, velocity); 2985 lastC[3][0] = 7; 2986 } 2987 if (lastC[3][0] == 0) { 2988 BounceCOff[3][0] = millis(); 2989 } 2990 if ((keysC[3][0] == 1) and (lastC[3][0] == 7) and ((millis() - BounceCOff[3][0]) > Delay)) { 2991 MidiSend(noteOn3, 49, velocity); 2992 lastC[3][0] = 0; 2993 } 2994 2995 //C50 2996 if (lastC[3][1] == 7) { 2997 BounceCOn[3][1] = millis(); 2998 } 2999 if ((keysC[3][1] == 0) and (lastC[3][1] == 0) and ((millis() - BounceCOn[3][1]) > Delay)) { 3000 MidiSend(noteOff3, 50, velocity); 3001 lastC[3][1] = 7; 3002 } 3003 if (lastC[3][1] == 0) { 3004 BounceCOff[3][1] = millis(); 3005 } 3006 if ((keysC[3][1] == 1) and (lastC[3][1] == 7) and ((millis() - BounceCOff[3][1]) > Delay)) { 3007 MidiSend(noteOn3, 50, velocity); 3008 lastC[3][1] = 0; 3009 } 3010 3011 //C51 3012 if (lastC[3][2] == 7) { 3013 BounceCOn[3][2] = millis(); 3014 } 3015 if ((keysC[3][2] == 0) and (lastC[3][2] == 0) and ((millis() - BounceCOn[3][2]) > Delay)) { 3016 MidiSend(noteOff3, 51, velocity); 3017 lastC[3][2] = 7; 3018 } 3019 if (lastC[3][2] == 0) { 3020 BounceCOff[3][2] = millis(); 3021 } 3022 if ((keysC[3][2] == 1) and (lastC[3][2] == 7) and ((millis() - BounceCOff[3][2]) > Delay)) { 3023 MidiSend(noteOn3, 51, velocity); 3024 lastC[3][2] = 0; 3025 } 3026 3027 //C52 3028 if (lastC[3][3] == 7) { 3029 BounceCOn[3][3] = millis(); 3030 } 3031 if ((keysC[3][3] == 0) and (lastC[3][3] == 0) and ((millis() - BounceCOn[3][3]) > Delay)) { 3032 MidiSend(noteOff3, 52, velocity); 3033 lastC[3][3] = 7; 3034 } 3035 if (lastC[3][3] == 0) { 3036 BounceCOff[3][3] = millis(); 3037 } 3038 if ((keysC[3][3] == 1) and (lastC[3][3] == 7) and ((millis() - BounceCOff[3][3]) > Delay)) { 3039 MidiSend(noteOn3, 52, velocity); 3040 lastC[3][3] = 0; 3041 } 3042 3043 //C53 3044 if (lastC[3][4] == 7) { 3045 BounceCOn[3][4] = millis(); 3046 } 3047 if ((keysC[3][4] == 0) and (lastC[3][4] == 0) and ((millis() - BounceCOn[3][4]) > Delay)) { 3048 MidiSend(noteOff3, 53, velocity); 3049 lastC[3][4] = 7; 3050 } 3051 if (lastC[3][4] == 0) { 3052 BounceCOff[3][4] = millis(); 3053 } 3054 if ((keysC[3][4] == 1) and (lastC[3][4] == 7) and ((millis() - BounceCOff[3][4]) > Delay)) { 3055 MidiSend(noteOn3, 53, velocity); 3056 lastC[3][4] = 0; 3057 } 3058 3059 //C54 3060 if (lastC[3][5] == 7) { 3061 BounceCOn[3][5] = millis(); 3062 } 3063 if ((keysC[3][5] == 0) and (lastC[3][5] == 0) and ((millis() - BounceCOn[3][5]) > Delay)) { 3064 MidiSend(noteOff3, 54, velocity); 3065 lastC[3][5] = 7; 3066 } 3067 if (lastC[3][5] == 0) { 3068 BounceCOff[3][5] = millis(); 3069 } 3070 if ((keysC[3][5] == 1) and (lastC[3][5] == 7) and ((millis() - BounceCOff[3][5]) > Delay)) { 3071 MidiSend(noteOn3, 54, velocity); 3072 lastC[3][5] = 0; 3073 } 3074 3075 //C55 3076 if (lastC[4][0] == 7) { 3077 BounceCOn[4][0] = millis(); 3078 } 3079 if ((keysC[4][0] == 0) and (lastC[4][0] == 0) and ((millis() - BounceCOn[4][0]) > Delay)) { 3080 MidiSend(noteOff3, 55, velocity); 3081 lastC[4][0] = 7; 3082 } 3083 if (lastC[4][0] == 0) { 3084 BounceCOff[4][0] = millis(); 3085 } 3086 if ((keysC[4][0] == 1) and (lastC[4][0] == 7) and ((millis() - BounceCOff[4][0]) > Delay)) { 3087 MidiSend(noteOn3, 55, velocity); 3088 lastC[4][0] = 0; 3089 } 3090 3091 //C56 3092 if (lastC[4][1] == 7) { 3093 BounceCOn[4][1] = millis(); 3094 } 3095 if ((keysC[4][1] == 0) and (lastC[4][1] == 0) and ((millis() - BounceCOn[4][1]) > Delay)) { 3096 MidiSend(noteOff3, 56, velocity); 3097 lastC[4][1] = 7; 3098 } 3099 if (lastC[4][1] == 0) { 3100 BounceCOff[4][1] = millis(); 3101 } 3102 if ((keysC[4][1] == 1) and (lastC[4][1] == 7) and ((millis() - BounceCOff[4][1]) > Delay)) { 3103 MidiSend(noteOn3, 56, velocity); 3104 lastC[4][1] = 0; 3105 } 3106 3107 //C57 3108 if (lastC[4][2] == 7) { 3109 BounceCOn[4][2] = millis(); 3110 } 3111 if ((keysC[4][2] == 0) and (lastC[4][2] == 0) and ((millis() - BounceCOn[4][2]) > Delay)) { 3112 MidiSend(noteOff3, 57, velocity); 3113 lastC[4][2] = 7; 3114 } 3115 if (lastC[4][2] == 0) { 3116 BounceCOff[4][2] = millis(); 3117 } 3118 if ((keysC[4][2] == 1) and (lastC[4][2] == 7) and ((millis() - BounceCOff[4][2]) > Delay)) { 3119 MidiSend(noteOn3, 57, velocity); 3120 lastC[4][2] = 0; 3121 } 3122 3123 //C58 3124 if (lastC[4][3] == 7) { 3125 BounceCOn[4][3] = millis(); 3126 } 3127 if ((keysC[4][3] == 0) and (lastC[4][3] == 0) and ((millis() - BounceCOn[4][3]) > Delay)) { 3128 MidiSend(noteOff3, 58, velocity); 3129 lastC[4][3] = 7; 3130 } 3131 if (lastC[4][3] == 0) { 3132 BounceCOff[4][3] = millis(); 3133 } 3134 if ((keysC[4][3] == 1) and (lastC[4][3] == 7) and ((millis() - BounceCOff[4][3]) > Delay)) { 3135 MidiSend(noteOn3, 58, velocity); 3136 lastC[4][3] = 0; 3137 } 3138 3139 //C59 3140 if (lastC[4][4] == 7) { 3141 BounceCOn[4][4] = millis(); 3142 } 3143 if ((keysC[4][4] == 0) and (lastC[4][4] == 0) and ((millis() - BounceCOn[4][4]) > Delay)) { 3144 MidiSend(noteOff3, 59, velocity); 3145 lastC[4][4] = 7; 3146 } 3147 if (lastC[4][4] == 0) { 3148 BounceCOff[4][4] = millis(); 3149 } 3150 if ((keysC[4][4] == 1) and (lastC[4][4] == 7) and ((millis() - BounceCOff[4][4]) > Delay)) { 3151 MidiSend(noteOn3, 59, velocity); 3152 lastC[4][4] = 0; 3153 } 3154 3155 //C60 3156 if (lastC[4][5] == 7) { 3157 BounceCOn[4][5] = millis(); 3158 } 3159 if ((keysC[4][5] == 0) and (lastC[4][5] == 0) and ((millis() - BounceCOn[4][5]) > Delay)) { 3160 MidiSend(noteOff3, 60, velocity); 3161 lastC[4][5] = 7; 3162 } 3163 if (lastC[4][5] == 0) { 3164 BounceCOff[4][5] = millis(); 3165 } 3166 if ((keysC[4][5] == 1) and (lastC[4][5] == 7) and ((millis() - BounceCOff[4][5]) > Delay)) { 3167 MidiSend(noteOn3, 60, velocity); 3168 lastC[4][5] = 0; 3169 } 3170 3171 //C61 3172 if (lastC[5][0] == 7) { 3173 BounceCOn[5][0] = millis(); 3174 } 3175 if ((keysC[5][0] == 0) and (lastC[5][0] == 0) and ((millis() - BounceCOn[5][0]) > Delay)) { 3176 MidiSend(noteOff3, 61, velocity); 3177 lastC[5][0] = 7; 3178 } 3179 if (lastC[5][0] == 0) { 3180 BounceCOff[5][0] = millis(); 3181 } 3182 if ((keysC[5][0] == 1) and (lastC[5][0] == 7) and ((millis() - BounceCOff[5][0]) > Delay)) { 3183 MidiSend(noteOn3, 61, velocity); 3184 lastC[5][0] = 0; 3185 } 3186 3187 //C62 3188 if (lastC[5][1] == 7) { 3189 BounceCOn[5][1] = millis(); 3190 } 3191 if ((keysC[5][1] == 0) and (lastC[5][1] == 0) and ((millis() - BounceCOn[5][1]) > Delay)) { 3192 MidiSend(noteOff3, 62, velocity); 3193 lastC[5][1] = 7; 3194 } 3195 if (lastC[5][1] == 0) { 3196 BounceCOff[5][1] = millis(); 3197 } 3198 if ((keysC[5][1] == 1) and (lastC[5][1] == 7) and ((millis() - BounceCOff[5][1]) > Delay)) { 3199 MidiSend(noteOn3, 62, velocity); 3200 lastC[5][1] = 0; 3201 } 3202 3203 //C63 3204 if (lastC[5][2] == 7) { 3205 BounceCOn[5][2] = millis(); 3206 } 3207 if ((keysC[5][2] == 0) and (lastC[5][2] == 0) and ((millis() - BounceCOn[5][2]) > Delay)) { 3208 MidiSend(noteOff3, 63, velocity); 3209 lastC[5][2] = 7; 3210 } 3211 if (lastC[5][2] == 0) { 3212 BounceCOff[5][2] = millis(); 3213 } 3214 if ((keysC[5][2] == 1) and (lastC[5][2] == 7) and ((millis() - BounceCOff[5][2]) > Delay)) { 3215 MidiSend(noteOn3, 63, velocity); 3216 lastC[5][2] = 0; 3217 } 3218 3219 //C64 3220 if (lastC[5][3] == 7) { 3221 BounceCOn[5][3] = millis(); 3222 } 3223 if ((keysC[5][3] == 0) and (lastC[5][3] == 0) and ((millis() - BounceCOn[5][3]) > Delay)) { 3224 MidiSend(noteOff3, 64, velocity); 3225 lastC[5][3] = 7; 3226 } 3227 if (lastC[5][3] == 0) { 3228 BounceCOff[5][3] = millis(); 3229 } 3230 if ((keysC[5][3] == 1) and (lastC[5][3] == 7) and ((millis() - BounceCOff[5][3]) > Delay)) { 3231 MidiSend(noteOn3, 64, velocity); 3232 lastC[5][3] = 0; 3233 } 3234 3235 //C65 3236 if (lastC[5][4] == 7) { 3237 BounceCOn[5][4] = millis(); 3238 } 3239 if ((keysC[5][4] == 0) and (lastC[5][4] == 0) and ((millis() - BounceCOn[5][4]) > Delay)) { 3240 MidiSend(noteOff3, 65, velocity); 3241 lastC[5][4] = 7; 3242 } 3243 if (lastC[5][4] == 0) { 3244 BounceCOff[5][4] = millis(); 3245 } 3246 if ((keysC[5][4] == 1) and (lastC[5][4] == 7) and ((millis() - BounceCOff[5][4]) > Delay)) { 3247 MidiSend(noteOn3, 65, velocity); 3248 lastC[5][4] = 0; 3249 } 3250 3251 //C66 3252 if (lastC[5][5] == 7) { 3253 BounceCOn[5][5] = millis(); 3254 } 3255 if ((keysC[5][5] == 0) and (lastC[5][5] == 0) and ((millis() - BounceCOn[5][5]) > Delay)) { 3256 MidiSend(noteOff3, 66, velocity); 3257 lastC[5][5] = 7; 3258 } 3259 if (lastC[5][5] == 0) { 3260 BounceCOff[5][5] = millis(); 3261 } 3262 if ((keysC[5][5] == 1) and (lastC[5][5] == 7) and ((millis() - BounceCOff[5][5]) > Delay)) { 3263 MidiSend(noteOn3, 66, velocity); 3264 lastC[5][5] = 0; 3265 } 3266 3267 //C67 3268 if (lastC[6][0] == 7) { 3269 BounceCOn[6][0] = millis(); 3270 } 3271 if ((keysC[6][0] == 0) and (lastC[6][0] == 0) and ((millis() - BounceCOn[6][0]) > Delay)) { 3272 MidiSend(noteOff3, 67, velocity); 3273 lastC[6][0] = 7; 3274 } 3275 if (lastC[6][0] == 0) { 3276 BounceCOff[6][0] = millis(); 3277 } 3278 if ((keysC[6][0] == 1) and (lastC[6][0] == 7) and ((millis() - BounceCOff[6][0]) > Delay)) { 3279 MidiSend(noteOn3, 67, velocity); 3280 lastC[6][0] = 0; 3281 } 3282 3283 //Write Keyboard E (Pistons) 3284 3285 //E55 3286 if (lastE[4][0] == 7) { 3287 BounceEOn[4][0] = millis(); 3288 } 3289 if ((keysE[4][0] == 0) and (lastE[4][0] == 0) and ((millis() - BounceEOn[4][0]) > Delay)) { 3290 MidiSend(noteOn4, 55, velocity); 3291 lastE[4][0] = 7; 3292 } 3293 if (lastE[4][0] == 0) { 3294 BounceEOff[4][0] = millis(); 3295 } 3296 if ((keysE[4][0] == 1) and (lastE[4][0] == 7) and ((millis() - BounceEOff[4][0]) > Delay)) { 3297 MidiSend(noteOff4, 55, velocity); 3298 lastE[4][0] = 0; 3299 } 3300 3301 //E56 3302 if (lastE[4][1] == 7) { 3303 BounceEOn[4][1] = millis(); 3304 } 3305 if ((keysE[4][1] == 0) and (lastE[4][1] == 0) and ((millis() - BounceEOn[4][1]) > Delay)) { 3306 MidiSend(noteOn4, 56, velocity); 3307 lastE[4][1] = 7; 3308 } 3309 if (lastE[4][1] == 0) { 3310 BounceEOff[4][1] = millis(); 3311 } 3312 if ((keysE[4][1] == 1) and (lastE[4][1] == 7) and ((millis() - BounceEOff[4][1]) > Delay)) { 3313 MidiSend(noteOff4, 56, velocity); 3314 lastE[4][1] = 0; 3315 } 3316 3317 //E57 3318 if (lastE[4][2] == 7) { 3319 BounceEOn[4][2] = millis(); 3320 } 3321 if ((keysE[4][2] == 0) and (lastE[4][2] == 0) and ((millis() - BounceEOn[4][2]) > Delay)) { 3322 MidiSend(noteOn4, 57, velocity); 3323 lastE[4][2] = 7; 3324 } 3325 if (lastE[4][2] == 0) { 3326 BounceEOff[4][2] = millis(); 3327 } 3328 if ((keysE[4][2] == 1) and (lastE[4][2] == 7) and ((millis() - BounceEOff[4][2]) > Delay)) { 3329 MidiSend(noteOff4, 57, velocity); 3330 lastE[4][2] = 0; 3331 } 3332 3333 //E58 3334 if (lastE[4][3] == 7) { 3335 BounceEOn[4][3] = millis(); 3336 } 3337 if ((keysE[4][3] == 0) and (lastE[4][3] == 0) and ((millis() - BounceEOn[4][3]) > Delay)) { 3338 MidiSend(noteOn4, 58, velocity); 3339 lastE[4][3] = 7; 3340 } 3341 if (lastE[4][3] == 0) { 3342 BounceEOff[4][3] = millis(); 3343 } 3344 if ((keysE[4][3] == 1) and (lastE[4][3] == 7) and ((millis() - BounceEOff[4][3]) > Delay)) { 3345 MidiSend(noteOff4, 58, velocity); 3346 lastE[4][3] = 0; 3347 } 3348 3349 //E59 3350 if (lastE[4][4] == 7) { 3351 BounceEOn[4][4] = millis(); 3352 } 3353 if ((keysE[4][4] == 0) and (lastE[4][4] == 0) and ((millis() - BounceEOn[4][4]) > Delay)) { 3354 MidiSend(noteOn4, 59, velocity); 3355 lastE[4][4] = 7; 3356 } 3357 if (lastE[4][4] == 0) { 3358 BounceEOff[4][4] = millis(); 3359 } 3360 if ((keysE[4][4] == 1) and (lastE[4][4] == 7) and ((millis() - BounceEOff[4][4]) > Delay)) { 3361 MidiSend(noteOff4, 59, velocity); 3362 lastE[4][4] = 0; 3363 } 3364 3365 //E60 3366 if (lastE[4][5] == 7) { 3367 BounceEOn[4][5] = millis(); 3368 } 3369 if ((keysE[4][5] == 0) and (lastE[4][5] == 0) and ((millis() - BounceEOn[4][5]) > Delay)) { 3370 MidiSend(noteOn4, 60, velocity); 3371 lastE[4][5] = 7; 3372 } 3373 if (lastE[4][5] == 0) { 3374 BounceEOff[4][5] = millis(); 3375 } 3376 if ((keysE[4][5] == 1) and (lastE[4][5] == 7) and ((millis() - BounceEOff[4][5]) > Delay)) { 3377 MidiSend(noteOff4, 60, velocity); 3378 lastE[4][5] = 0; 3379 } 3380 3381 //E61 3382 if (lastE[5][0] == 7) { 3383 BounceEOn[5][0] = millis(); 3384 } 3385 if ((keysE[5][0] == 0) and (lastE[5][0] == 0) and ((millis() - BounceEOn[5][0]) > Delay)) { 3386 MidiSend(noteOn4, 61, velocity); 3387 lastE[5][0] = 7; 3388 } 3389 if (lastE[5][0] == 0) { 3390 BounceEOff[5][0] = millis(); 3391 } 3392 if ((keysE[5][0] == 1) and (lastE[5][0] == 7) and ((millis() - BounceEOff[5][0]) > Delay)) { 3393 MidiSend(noteOff4, 61, velocity); 3394 lastE[5][0] = 0; 3395 } 3396 3397 //E62 3398 if (lastE[5][1] == 7) { 3399 BounceEOn[5][1] = millis(); 3400 } 3401 if ((keysE[5][1] == 0) and (lastE[5][1] == 0) and ((millis() - BounceEOn[5][1]) > Delay)) { 3402 MidiSend(noteOn4, 62, velocity); 3403 lastE[5][1] = 7; 3404 } 3405 if (lastE[5][1] == 0) { 3406 BounceEOff[5][1] = millis(); 3407 } 3408 if ((keysE[5][1] == 1) and (lastE[5][1] == 7) and ((millis() - BounceEOff[5][1]) > Delay)) { 3409 MidiSend(noteOff4, 62, velocity); 3410 lastE[5][1] = 0; 3411 } 3412 3413 //E63 3414 if (lastE[5][2] == 7) { 3415 BounceEOn[5][2] = millis(); 3416 } 3417 if ((keysE[5][2] == 0) and (lastE[5][2] == 0) and ((millis() - BounceEOn[5][2]) > Delay)) { 3418 MidiSend(noteOn4, 63, velocity); 3419 lastE[5][2] = 7; 3420 } 3421 if (lastE[5][2] == 0) { 3422 BounceEOff[5][2] = millis(); 3423 } 3424 if ((keysE[5][2] == 1) and (lastE[5][2] == 7) and ((millis() - BounceEOff[5][2]) > Delay)) { 3425 MidiSend(noteOff4, 63, velocity); 3426 lastE[5][2] = 0; 3427 } 3428 3429 //E64 3430 if (lastE[5][3] == 7) { 3431 BounceEOn[5][3] = millis(); 3432 } 3433 if ((keysE[5][3] == 0) and (lastE[5][3] == 0) and ((millis() - BounceEOn[5][3]) > Delay)) { 3434 MidiSend(noteOn4, 64, velocity); 3435 lastE[5][3] = 7; 3436 } 3437 if (lastE[5][3] == 0) { 3438 BounceEOff[5][3] = millis(); 3439 } 3440 if ((keysE[5][3] == 1) and (lastE[5][3] == 7) and ((millis() - BounceEOff[5][3]) > Delay)) { 3441 MidiSend(noteOff4, 64, velocity); 3442 lastE[5][3] = 0; 3443 } 3444 3445 //E65 3446 if (lastE[5][4] == 7) { 3447 BounceEOn[5][4] = millis(); 3448 } 3449 if ((keysE[5][4] == 0) and (lastE[5][4] == 0) and ((millis() - BounceEOn[5][4]) > Delay)) { 3450 MidiSend(noteOn4, 65, velocity); 3451 lastE[5][4] = 7; 3452 } 3453 if (lastE[5][4] == 0) { 3454 BounceEOff[5][4] = millis(); 3455 } 3456 if ((keysE[5][4] == 1) and (lastE[5][4] == 7) and ((millis() - BounceEOff[5][4]) > Delay)) { 3457 MidiSend(noteOff4, 65, velocity); 3458 lastE[5][4] = 0; 3459 } 3460 3461 //E66 3462 if (lastE[5][5] == 7) { 3463 BounceEOn[5][5] = millis(); 3464 } 3465 if ((keysE[5][5] == 0) and (lastE[5][5] == 0) and ((millis() - BounceEOn[5][5]) > Delay)) { 3466 MidiSend(noteOn4, 66, velocity); 3467 lastE[5][5] = 7; 3468 } 3469 if (lastE[5][5] == 0) { 3470 BounceEOff[5][5] = millis(); 3471 } 3472 if ((keysE[5][5] == 1) and (lastE[5][5] == 7) and ((millis() - BounceEOff[5][5]) > Delay)) { 3473 MidiSend(noteOff4, 66, velocity); 3474 lastE[5][5] = 0; 3475 } 3476 3477 //E67 3478 if (lastE[6][0] == 7) { 3479 BounceEOn[6][0] = millis(); 3480 } 3481 if ((keysE[6][0] == 0) and (lastE[6][0] == 0) and ((millis() - BounceEOn[6][0]) > Delay)) { 3482 MidiSend(noteOn4, 67, velocity); 3483 lastE[6][0] = 7; 3484 } 3485 if (lastE[6][0] == 0) { 3486 BounceEOff[6][0] = millis(); 3487 } 3488 if ((keysE[6][0] == 1) and (lastE[6][0] == 7) and ((millis() - BounceEOff[6][0]) > Delay)) { 3489 MidiSend(noteOff4, 67, velocity); 3490 lastE[6][0] = 0; 3491 } 3492 3493 //E68 3494 if (lastE[6][1] == 7) { 3495 BounceEOn[6][1] = millis(); 3496 } 3497 if ((keysE[6][1] == 0) and (lastE[6][1] == 0) and ((millis() - BounceEOn[6][1]) > Delay)) { 3498 MidiSend(noteOn4, 68, velocity); 3499 lastE[6][1] = 7; 3500 } 3501 if (lastE[6][1] == 0) { 3502 BounceEOff[6][1] = millis(); 3503 } 3504 if ((keysE[6][1] == 1) and (lastE[6][1] == 7) and ((millis() - BounceEOff[6][1]) > Delay)) { 3505 MidiSend(noteOff4, 68, velocity); 3506 lastE[6][1] = 0; 3507 } 3508 3509 //E69 3510 if (lastE[6][2] == 7) { 3511 BounceEOn[6][2] = millis(); 3512 } 3513 if ((keysE[6][2] == 0) and (lastE[6][2] == 0) and ((millis() - BounceEOn[6][2]) > Delay)) { 3514 MidiSend(noteOn4, 69, velocity); 3515 lastE[6][2] = 7; 3516 } 3517 if (lastE[6][2] == 0) { 3518 BounceEOff[6][2] = millis(); 3519 } 3520 if ((keysE[6][2] == 1) and (lastE[6][2] == 7) and ((millis() - BounceEOff[6][2]) > Delay)) { 3521 MidiSend(noteOff4, 69, velocity); 3522 lastE[6][2] = 0; 3523 } 3524 3525 //E70 3526 if (lastE[6][3] == 7) { 3527 BounceEOn[6][3] = millis(); 3528 } 3529 if ((keysE[6][3] == 0) and (lastE[6][3] == 0) and ((millis() - BounceEOn[6][3]) > Delay)) { 3530 MidiSend(noteOn4, 70, velocity); 3531 lastE[6][3] = 7; 3532 } 3533 if (lastE[6][3] == 0) { 3534 BounceEOff[6][3] = millis(); 3535 } 3536 if ((keysE[6][3] == 1) and (lastE[6][3] == 7) and ((millis() - BounceEOff[6][3]) > Delay)) { 3537 MidiSend(noteOff4, 70, velocity); 3538 lastE[6][3] = 0; 3539 } 3540 3541 //E71 3542 if (lastE[6][4] == 7) { 3543 BounceEOn[6][4] = millis(); 3544 } 3545 if ((keysE[6][4] == 0) and (lastE[6][4] == 0) and ((millis() - BounceEOn[6][4]) > Delay)) { 3546 MidiSend(noteOn4, 71, velocity); 3547 lastE[6][4] = 7; 3548 } 3549 if (lastE[6][4] == 0) { 3550 BounceEOff[6][4] = millis(); 3551 } 3552 if ((keysE[6][4] == 1) and (lastE[6][4] == 7) and ((millis() - BounceEOff[6][4]) > Delay)) { 3553 MidiSend(noteOff4, 71, velocity); 3554 lastE[6][4] = 0; 3555 } 3556 3557 //E72 3558 if (lastE[6][5] == 7) { 3559 BounceEOn[6][5] = millis(); 3560 } 3561 if ((keysE[6][5] == 0) and (lastE[6][5] == 0) and ((millis() - BounceEOn[6][5]) > Delay)) { 3562 MidiSend(noteOn4, 72, velocity); 3563 lastE[6][5] = 7; 3564 } 3565 if (lastE[6][5] == 0) { 3566 BounceEOff[6][5] = millis(); 3567 } 3568 if ((keysE[6][5] == 1) and (lastE[6][5] == 7) and ((millis() - BounceEOff[6][5]) > Delay)) { 3569 MidiSend(noteOff4, 72, velocity); 3570 lastE[6][5] = 0; 3571 } 3572 3573 //E73 3574 if (lastE[7][0] == 7) { 3575 BounceEOn[7][0] = millis(); 3576 } 3577 if ((keysE[7][0] == 0) and (lastE[7][0] == 0) and ((millis() - BounceEOn[7][0]) > Delay)) { 3578 MidiSend(noteOn4, 73, velocity); 3579 lastE[7][0] = 7; 3580 } 3581 if (lastE[7][0] == 0) { 3582 BounceEOff[7][0] = millis(); 3583 } 3584 if ((keysE[7][0] == 1) and (lastE[7][0] == 7) and ((millis() - BounceEOff[7][0]) > Delay)) { 3585 MidiSend(noteOff4, 73, velocity); 3586 lastE[7][0] = 0; 3587 } 3588 3589 //E74 3590 if (lastE[7][1] == 7) { 3591 BounceEOn[7][1] = millis(); 3592 } 3593 if ((keysE[7][1] == 0) and (lastE[7][1] == 0) and ((millis() - BounceEOn[7][1]) > Delay)) { 3594 MidiSend(noteOn4, 74, velocity); 3595 lastE[7][1] = 7; 3596 } 3597 if (lastE[7][1] == 0) { 3598 BounceEOff[7][1] = millis(); 3599 } 3600 if ((keysE[7][1] == 1) and (lastE[7][1] == 7) and ((millis() - BounceEOff[7][1]) > Delay)) { 3601 MidiSend(noteOff4, 74, velocity); 3602 lastE[7][1] = 0; 3603 } 3604 3605 //E75 3606 if (lastE[7][2] == 7) { 3607 BounceEOn[7][2] = millis(); 3608 } 3609 if ((keysE[7][2] == 0) and (lastE[7][2] == 0) and ((millis() - BounceEOn[7][2]) > Delay)) { 3610 MidiSend(noteOn4, 75, velocity); 3611 lastE[7][2] = 7; 3612 } 3613 if (lastE[7][2] == 0) { 3614 BounceEOff[7][2] = millis(); 3615 } 3616 if ((keysE[7][2] == 1) and (lastE[7][2] == 7) and ((millis() - BounceEOff[7][2]) > Delay)) { 3617 MidiSend(noteOff4, 75, velocity); 3618 lastE[7][2] = 0; 3619 } 3620 3621 //E76 3622 if (lastE[7][3] == 7) { 3623 BounceEOn[7][3] = millis(); 3624 } 3625 if ((keysE[7][3] == 0) and (lastE[7][3] == 0) and ((millis() - BounceEOn[7][3]) > Delay)) { 3626 MidiSend(noteOn4, 76, velocity); 3627 lastE[7][3] = 7; 3628 } 3629 if (lastE[7][3] == 0) { 3630 BounceEOff[7][3] = millis(); 3631 } 3632 if ((keysE[7][3] == 1) and (lastE[7][3] == 7) and ((millis() - BounceEOff[7][3]) > Delay)) { 3633 MidiSend(noteOff4, 76, velocity); 3634 lastE[7][3] = 0; 3635 } 3636 3637 //E77 3638 if (lastE[7][4] == 7) { 3639 BounceEOn[7][4] = millis(); 3640 } 3641 if ((keysE[7][4] == 0) and (lastE[7][4] == 0) and ((millis() - BounceEOn[7][4]) > Delay)) { 3642 MidiSend(noteOn4, 77, velocity); 3643 lastE[7][4] = 7; 3644 } 3645 if (lastE[7][4] == 0) { 3646 BounceEOff[7][4] = millis(); 3647 } 3648 if ((keysE[7][4] == 1) and (lastE[7][4] == 7) and ((millis() - BounceEOff[7][4]) > Delay)) { 3649 MidiSend(noteOff4, 77, velocity); 3650 lastE[7][4] = 0; 3651 } 3652 3653 //E78 3654 if (lastE[7][5] == 7) { 3655 BounceEOn[7][5] = millis(); 3656 } 3657 if ((keysE[7][5] == 0) and (lastE[7][5] == 0) and ((millis() - BounceEOn[7][5]) > Delay)) { 3658 MidiSend(noteOn4, 78, velocity); 3659 lastE[7][5] = 7; 3660 } 3661 if (lastE[7][5] == 0) { 3662 BounceEOff[7][5] = millis(); 3663 } 3664 if ((keysE[7][5] == 1) and (lastE[7][5] == 7) and ((millis() - BounceEOff[7][5]) > Delay)) { 3665 MidiSend(noteOff4, 78, velocity); 3666 lastE[7][5] = 0; 3667 } 3668 3669 //E79 3670 if (lastE[8][0] == 7) { 3671 BounceEOn[8][0] = millis(); 3672 } 3673 if ((keysE[8][0] == 0) and (lastE[8][0] == 0) and ((millis() - BounceEOn[8][0]) > Delay)) { 3674 MidiSend(noteOn4, 79, velocity); 3675 lastE[8][0] = 7; 3676 } 3677 if (lastE[8][0] == 0) { 3678 BounceEOff[8][0] = millis(); 3679 } 3680 if ((keysE[8][0] == 1) and (lastE[8][0] == 7) and ((millis() - BounceEOff[8][0]) > Delay)) { 3681 MidiSend(noteOff4, 79, velocity); 3682 lastE[8][0] = 0; 3683 } 3684 3685 //E80 3686 if (lastE[8][1] == 7) { 3687 BounceEOn[8][1] = millis(); 3688 } 3689 if ((keysE[8][1] == 0) and (lastE[8][1] == 0) and ((millis() - BounceEOn[8][1]) > Delay)) { 3690 MidiSend(noteOn4, 80, velocity); 3691 lastE[8][1] = 7; 3692 } 3693 if (lastE[8][1] == 0) { 3694 BounceEOff[8][1] = millis(); 3695 } 3696 if ((keysE[8][1] == 1) and (lastE[8][1] == 7) and ((millis() - BounceEOff[8][1]) > Delay)) { 3697 MidiSend(noteOff4, 80, velocity); 3698 lastE[8][1] = 0; 3699 } 3700 3701 //E81 3702 if (lastE[8][2] == 7) { 3703 BounceEOn[8][2] = millis(); 3704 } 3705 if ((keysE[8][2] == 0) and (lastE[8][2] == 0) and ((millis() - BounceEOn[8][2]) > Delay)) { 3706 MidiSend(noteOn4, 81, velocity); 3707 lastE[8][2] = 7; 3708 } 3709 if (lastE[8][2] == 0) { 3710 BounceEOff[8][2] = millis(); 3711 } 3712 if ((keysE[8][2] == 1) and (lastE[8][2] == 7) and ((millis() - BounceEOff[8][2]) > Delay)) { 3713 MidiSend(noteOff4, 81, velocity); 3714 lastE[8][2] = 0; 3715 } 3716 3717 //E82 3718 if (lastE[8][3] == 7) { 3719 BounceEOn[8][3] = millis(); 3720 } 3721 if ((keysE[8][3] == 0) and (lastE[8][3] == 0) and ((millis() - BounceEOn[8][3]) > Delay)) { 3722 MidiSend(noteOn4, 82, velocity); 3723 lastE[8][3] = 7; 3724 } 3725 if (lastE[8][3] == 0) { 3726 BounceEOff[8][3] = millis(); 3727 } 3728 if ((keysE[8][3] == 1) and (lastE[8][3] == 7) and ((millis() - BounceEOff[8][3]) > Delay)) { 3729 MidiSend(noteOff4, 82, velocity); 3730 lastE[8][3] = 0; 3731 } 3732 3733 //E83 3734 if (lastE[8][4] == 7) { 3735 BounceEOn[8][4] = millis(); 3736 } 3737 if ((keysE[8][4] == 0) and (lastE[8][4] == 0) and ((millis() - BounceEOn[8][4]) > Delay)) { 3738 MidiSend(noteOn4, 83, velocity); 3739 lastE[8][4] = 7; 3740 } 3741 if (lastE[8][4] == 0) { 3742 BounceEOff[8][4] = millis(); 3743 } 3744 if ((keysE[8][4] == 1) and (lastE[8][4] == 7) and ((millis() - BounceEOff[8][4]) > Delay)) { 3745 MidiSend(noteOff4, 83, velocity); 3746 lastE[8][4] = 0; 3747 } 3748 3749 //E84 3750 if (lastE[8][5] == 7) { 3751 BounceEOn[8][5] = millis(); 3752 } 3753 if ((keysE[8][5] == 0) and (lastE[8][5] == 0) and ((millis() - BounceEOn[8][5]) > Delay)) { 3754 MidiSend(noteOn4, 84, velocity); 3755 lastE[8][5] = 7; 3756 } 3757 if (lastE[8][5] == 0) { 3758 BounceEOff[8][5] = millis(); 3759 } 3760 if ((keysE[8][5] == 1) and (lastE[8][5] == 7) and ((millis() - BounceEOff[8][5]) > Delay)) { 3761 MidiSend(noteOff4, 84, velocity); 3762 lastE[8][5] = 0; 3763 } 3764 3765 //Expression Pedal controls 3766 3767 //Expression pedal on analog pin A13 to Channel 6 3768 3769 int Cur6 = analogRead(14); 3770 int Map6 = map(Cur6, 0, 1023, 0, 127); 3771 3772 if (abs(Cur6 - LastPot6) >= PotT) { 3773 MidiSend(CCchan6,Exp,Map6); 3774 LastPot6 = Cur6; 3775 } 3776 3777 //Expression pedal on analog pin A14 to Channel 7 3778 3779 int Cur7 = analogRead(15); 3780 int Map7 = map(Cur7, 0, 1023, 0, 127); 3781 3782 if (abs(Cur7 - LastPot7) >= PotT) { 3783 MidiSend(CCchan7,Exp,Map7); 3784 LastPot7 = Cur7; 3785 } 3786 3787 //Midi Thru 3788 3789 if (byteReady) { 3790 byteReady = false; 3791 Serial.write(midiByte); 3792 } 3793} 3794 3795void MidiSend(int one, int two, int three) { 3796 Serial.write(one); 3797 Serial.write(two); 3798 Serial.write(three); 3799 } 3800 3801void serialEvent() { 3802 if (Serial.available()) { 3803 // get the new byte: 3804 midiByte = (unsigned char)Serial.read(); 3805 byteReady = true; 3806 } 3807 }
Bussed Keyboard Code
arduino
Code to upload to the Arduino if you are following the Bussed Keyboard Schematic.
1// Name: Arduino Mega Midi Controller 61x4 plus 3 potentiometers. 2// 3 Version 1.0 4// Created: April 12, 2021 5// Author: Larason2 6// Acknowledgements: 7 Bald Engineer, Amanda Ghassaei, jeffb42, GrumpyMike 8 9//Note Data 10 11byte 12 keysA[11][6]; 13byte keysB[11][6]; 14byte keysC[11][6]; 15byte keysD[11][6]; 16 17//Last 18 Key State 19 20byte lastA[11][6]; 21byte lastB[11][6]; 22byte lastC[11][6]; 23byte 24 lastD[11][6]; 25 26//Midi Messages Sent 27 28int noteOn1 = 144; 29int noteOff1 30 = 128; 31int noteOn2 = 145; 32int noteOff2 = 129; 33int noteOn3 = 146; 34int 35 noteOff3 = 130; 36int noteOn4 = 147; 37int noteOff4 = 131; 38int velocity = 100; 39int 40 chan6 = 181; 41int chan7 = 182; 42int chan8 = 183; 43int Exp = 11; 44 45//Last 46 Potentiometer State 47 48int LastPot6 = 1; 49int LastPot7 = 1; 50int LastPot8 51 = 1; 52 53void setup() { 54 // Start Serial at Midi rate 55 Serial.begin(31250); 56 57 58 //Initialize Pins 1-10 59 pinMode(2, INPUT); 60 pinMode(3, INPUT); 61 pinMode(4, 62 INPUT); 63 pinMode(5, INPUT); 64 pinMode(6, INPUT); 65 pinMode(7, INPUT); 66 67 pinMode(8, INPUT); 68 pinMode(9, INPUT); 69 pinMode(10, INPUT); 70 pinMode(11, 71 INPUT); 72 73 //Pins 11-20 74 75 pinMode(12, INPUT); 76 pinMode(13, INPUT); 77 78 pinMode(14, INPUT); 79 pinMode(15, INPUT); 80 pinMode(16, INPUT); 81 pinMode(17, 82 INPUT); 83 pinMode(18, INPUT); 84 pinMode(19, INPUT); 85 pinMode(20, INPUT); 86 87 pinMode(21, INPUT); 88 89 //Pins 21-30 90 91 pinMode(22, INPUT); 92 pinMode(23, 93 INPUT); 94 pinMode(24, INPUT); 95 pinMode(25, INPUT); 96 pinMode(26, INPUT); 97 98 pinMode(27, INPUT); 99 pinMode(28, INPUT); 100 pinMode(29, INPUT); 101 pinMode(30, 102 INPUT); 103 pinMode(31, INPUT); 104 105 //Pins 31-40 106 107 pinMode(32, INPUT); 108 109 pinMode(33, INPUT); 110 pinMode(34, INPUT); 111 pinMode(35, INPUT); 112 pinMode(36, 113 INPUT); 114 pinMode(37, INPUT); 115 pinMode(38, INPUT); 116 pinMode(39, INPUT); 117 118 pinMode(40, INPUT); 119 pinMode(41, INPUT); 120 121 //Pins 41-50 122 123 pinMode(42, 124 INPUT); 125 pinMode(43, INPUT); 126 pinMode(44, INPUT); 127 pinMode(45, INPUT); 128 129 pinMode(46, INPUT); 130 pinMode(47, INPUT); 131 pinMode(48, INPUT); 132 pinMode(49, 133 INPUT); 134 pinMode(50, INPUT); 135 pinMode(51, INPUT); 136 137 //Pins 51-61 138 139 140 pinMode(52, INPUT); 141 pinMode(53, INPUT); 142 pinMode(A0, INPUT); 143 144 pinMode(A1, INPUT); 145 pinMode(A2, INPUT); 146 pinMode(A3, INPUT); 147 pinMode(A4, 148 INPUT); 149 pinMode(A5, INPUT); 150 pinMode(A6, INPUT); 151 pinMode(A7, INPUT); 152 153 pinMode(A8, INPUT); 154 155 //Column Pins 156 157 pinMode(A9, INPUT); 158 159 pinMode(A10, INPUT); 160 pinMode(A11, INPUT); 161 pinMode(A12, INPUT); 162 163 164 //Pot Pins 165 166 pinMode(A13, INPUT); 167 pinMode(A14, INPUT); 168 pinMode(A15, 169 INPUT); 170} 171 172void loop() { 173 174 // Setup pins for keyboards 175 176 177 //Pins 1-10 178 pinMode(2, INPUT_PULLUP); 179 pinMode(3, INPUT_PULLUP); 180 181 pinMode(4, INPUT_PULLUP); 182 pinMode(5, INPUT_PULLUP); 183 pinMode(6, INPUT_PULLUP); 184 185 pinMode(7, INPUT_PULLUP); 186 pinMode(8, INPUT_PULLUP); 187 pinMode(9, INPUT_PULLUP); 188 189 pinMode(10, INPUT_PULLUP); 190 pinMode(11, INPUT_PULLUP); 191 192 //Pins 11-20 193 194 195 pinMode(12, INPUT_PULLUP); 196 pinMode(13, INPUT_PULLUP); 197 pinMode(14, 198 INPUT_PULLUP); 199 pinMode(15, INPUT_PULLUP); 200 pinMode(16, INPUT_PULLUP); 201 202 pinMode(17, INPUT_PULLUP); 203 pinMode(18, INPUT_PULLUP); 204 pinMode(19, INPUT_PULLUP); 205 206 pinMode(20, INPUT_PULLUP); 207 pinMode(21, INPUT_PULLUP); 208 209 //Pins 21-30 210 211 212 pinMode(22, INPUT_PULLUP); 213 pinMode(23, INPUT_PULLUP); 214 pinMode(24, 215 INPUT_PULLUP); 216 pinMode(25, INPUT_PULLUP); 217 pinMode(26, INPUT_PULLUP); 218 219 pinMode(27, INPUT_PULLUP); 220 pinMode(28, INPUT_PULLUP); 221 pinMode(29, INPUT_PULLUP); 222 223 pinMode(30, INPUT_PULLUP); 224 pinMode(31, INPUT_PULLUP); 225 226 //Pins 31-40 227 228 229 pinMode(32, INPUT_PULLUP); 230 pinMode(33, INPUT_PULLUP); 231 pinMode(34, 232 INPUT_PULLUP); 233 pinMode(35, INPUT_PULLUP); 234 pinMode(36, INPUT_PULLUP); 235 236 pinMode(37, INPUT_PULLUP); 237 pinMode(38, INPUT_PULLUP); 238 pinMode(39, INPUT_PULLUP); 239 240 pinMode(40, INPUT_PULLUP); 241 pinMode(41, INPUT_PULLUP); 242 243 //Pins 41-50 244 245 246 pinMode(42, INPUT_PULLUP); 247 pinMode(43, INPUT_PULLUP); 248 pinMode(44, 249 INPUT_PULLUP); 250 pinMode(45, INPUT_PULLUP); 251 pinMode(46, INPUT_PULLUP); 252 253 pinMode(47, INPUT_PULLUP); 254 pinMode(48, INPUT_PULLUP); 255 pinMode(49, INPUT_PULLUP); 256 257 pinMode(50, INPUT_PULLUP); 258 pinMode(51, INPUT_PULLUP); 259 260 //Pins 51-61 261 262 263 pinMode(52, INPUT_PULLUP); 264 pinMode(53, INPUT_PULLUP); 265 pinMode(A0, 266 INPUT_PULLUP); 267 pinMode(A1, INPUT_PULLUP); 268 pinMode(A2, INPUT_PULLUP); 269 270 pinMode(A3, INPUT_PULLUP); 271 pinMode(A4, INPUT_PULLUP); 272 pinMode(A5, INPUT_PULLUP); 273 274 pinMode(A6, INPUT_PULLUP); 275 pinMode(A7, INPUT_PULLUP); 276 pinMode(A8, INPUT_PULLUP); 277 278 279 //Read Keyboard A 280 281 pinMode(A9, OUTPUT); 282 digitalWrite(A9, LOW); 283 284 285 //Keys 1-10 286 287 keysA[0][0] = digitalRead(2); 288 keysA[1][0] 289 = digitalRead(3); 290 keysA[1][1] = digitalRead(4); 291 keysA[1][2] = digitalRead(5); 292 293 keysA[1][3] = digitalRead(6); 294 keysA[1][4] = digitalRead(7); 295 keysA[1][5] 296 = digitalRead(8); 297 keysA[2][0] = digitalRead(9); 298 keysA[2][1] = digitalRead(10); 299 300 keysA[2][2] = digitalRead(11); 301 302 //Keys 11-20 303 304 keysA[2][3] 305 = digitalRead(12); 306 keysA[2][4] = digitalRead(13); 307 keysA[2][5] = digitalRead(14); 308 309 keysA[3][0] = digitalRead(15); 310 keysA[3][1] = digitalRead(16); 311 keysA[3][2] 312 = digitalRead(17); 313 keysA[3][3] = digitalRead(18); 314 keysA[3][4] = digitalRead(19); 315 316 keysA[3][5] = digitalRead(20); 317 keysA[4][0] = digitalRead(21); 318 319 320 321 //Keys 21-30 322 323 keysA[4][1] = digitalRead(22); 324 keysA[4][2] = digitalRead(23); 325 326 keysA[4][3] = digitalRead(24); 327 keysA[4][4] = digitalRead(25); 328 keysA[4][5] 329 = digitalRead(26); 330 keysA[5][0] = digitalRead(27); 331 keysA[5][1] = digitalRead(28); 332 333 keysA[5][2] = digitalRead(29); 334 keysA[5][3] = digitalRead(30); 335 keysA[5][4] 336 = digitalRead(31); 337 338 //Keys 31-40 339 340 keysA[5][5] = digitalRead(32); 341 342 keysA[6][0] = digitalRead(33); 343 keysA[6][1] = digitalRead(34); 344 keysA[6][2] 345 = digitalRead(35); 346 keysA[6][3] = digitalRead(36); 347 keysA[6][4] = digitalRead(37); 348 349 keysA[6][5] = digitalRead(38); 350 keysA[7][0] = digitalRead(39); 351 keysA[7][1] 352 = digitalRead(40); 353 keysA[7][2] = digitalRead(41); 354 355 //Keys 41-50 356 357 358 keysA[7][3] = digitalRead(42); 359 keysA[7][4] = digitalRead(43); 360 keysA[7][5] 361 = digitalRead(44); 362 keysA[8][0] = digitalRead(45); 363 keysA[8][1] = digitalRead(46); 364 365 keysA[8][2] = digitalRead(47); 366 keysA[8][3] = digitalRead(48); 367 keysA[8][4] 368 = digitalRead(49); 369 keysA[8][5] = digitalRead(50); 370 keysA[9][0] = digitalRead(51); 371 372 373 //Keys 51-61 374 375 keysA[9][1] = digitalRead(52); 376 keysA[9][2] = digitalRead(53); 377 378 keysA[9][3] = digitalRead(A0); 379 keysA[9][4] = digitalRead(A1); 380 keysA[9][5] 381 = digitalRead(A2); 382 keysA[10][0] = digitalRead(A3); 383 keysA[10][1] = 384 digitalRead(A4); 385 keysA[10][2] = digitalRead(A5); 386 keysA[10][3] = digitalRead(A6); 387 388 keysA[10][4] = digitalRead(A7); 389 keysA[10][5] = digitalRead(A8); 390 391 392 pinMode(A9, INPUT); 393 394 // Read Keyboard B 395 396 pinMode(A10, OUTPUT); 397 398 digitalWrite(A10, LOW); 399 400 //Keys 1-10 401 402 keysB[0][0] = digitalRead(2); 403 404 keysB[1][0] = digitalRead(3); 405 keysB[1][1] = digitalRead(4); 406 keysB[1][2] 407 = digitalRead(5); 408 keysB[1][3] = digitalRead(6); 409 keysB[1][4] = digitalRead(7); 410 411 keysB[1][5] = digitalRead(8); 412 keysB[2][0] = digitalRead(9); 413 keysB[2][1] 414 = digitalRead(10); 415 keysB[2][2] = digitalRead(11); 416 417 //Keys 11-20 418 419 420 keysB[2][3] = digitalRead(12); 421 keysB[2][4] = digitalRead(13); 422 423 keysB[2][5] = digitalRead(14); 424 keysB[3][0] = digitalRead(15); 425 keysB[3][1] 426 = digitalRead(16); 427 keysB[3][2] = digitalRead(17); 428 keysB[3][3] = digitalRead(18); 429 430 keysB[3][4] = digitalRead(19); 431 keysB[3][5] = digitalRead(20); 432 keysB[4][0] 433 = digitalRead(21); 434 435 436 //Keys 21-30 437 438 keysB[4][1] = digitalRead(22); 439 440 keysB[4][2] = digitalRead(23); 441 keysB[4][3] = digitalRead(24); 442 keysB[4][4] 443 = digitalRead(25); 444 keysB[4][5] = digitalRead(26); 445 keysB[5][0] = digitalRead(27); 446 447 keysB[5][1] = digitalRead(28); 448 keysB[5][2] = digitalRead(29); 449 keysB[5][3] 450 = digitalRead(30); 451 keysB[5][4] = digitalRead(31); 452 453 //Keys 31-40 454 455 456 keysB[5][5] = digitalRead(32); 457 keysB[6][0] = digitalRead(33); 458 459 keysB[6][1] = digitalRead(34); 460 keysB[6][2] = digitalRead(35); 461 keysB[6][3] 462 = digitalRead(36); 463 keysB[6][4] = digitalRead(37); 464 keysB[6][5] = digitalRead(38); 465 466 keysB[7][0] = digitalRead(39); 467 keysB[7][1] = digitalRead(40); 468 keysB[7][2] 469 = digitalRead(41); 470 471 //Keys 41-50 472 473 keysB[7][3] = digitalRead(42); 474 475 keysB[7][4] = digitalRead(43); 476 keysB[7][5] = digitalRead(44); 477 keysB[8][0] 478 = digitalRead(45); 479 keysB[8][1] = digitalRead(46); 480 keysB[8][2] = digitalRead(47); 481 482 keysB[8][3] = digitalRead(48); 483 keysB[8][4] = digitalRead(49); 484 keysB[8][5] 485 = digitalRead(50); 486 keysB[9][0] = digitalRead(51); 487 488 //Keys 51-61 489 490 491 keysB[9][1] = digitalRead(52); 492 keysB[9][2] = digitalRead(53); 493 keysB[9][3] 494 = digitalRead(A0); 495 keysB[9][4] = digitalRead(A1); 496 keysB[9][5] = digitalRead(A2); 497 498 keysB[10][0] = digitalRead(A3); 499 keysB[10][1] = digitalRead(A4); 500 keysB[10][2] 501 = digitalRead(A5); 502 keysB[10][3] = digitalRead(A6); 503 keysB[10][4] = 504 digitalRead(A7); 505 keysB[10][5] = digitalRead(A8); 506 507 pinMode(A10, 508 INPUT); 509 510 // Read Keyboard C 511 512 pinMode(A11, OUTPUT); 513 digitalWrite(A11, 514 LOW); 515 516 //Keys 1-10 517 518 keysC[0][0] = digitalRead(2); 519 keysC[1][0] 520 = digitalRead(3); 521 keysC[1][1] = digitalRead(4); 522 keysC[1][2] = digitalRead(5); 523 524 keysC[1][3] = digitalRead(6); 525 keysC[1][4] = digitalRead(7); 526 keysC[1][5] 527 = digitalRead(8); 528 keysC[2][0] = digitalRead(9); 529 keysC[2][1] = digitalRead(10); 530 531 keysC[2][2] = digitalRead(11); 532 533 //Keys 11-20 534 535 keysC[2][3] 536 = digitalRead(12); 537 keysC[2][4] = digitalRead(13); 538 keysC[2][5] = digitalRead(14); 539 540 keysC[3][0] = digitalRead(15); 541 keysC[3][1] = digitalRead(16); 542 keysC[3][2] 543 = digitalRead(17); 544 keysC[3][3] = digitalRead(18); 545 keysC[3][4] = digitalRead(19); 546 547 keysC[3][5] = digitalRead(20); 548 keysC[4][0] = digitalRead(21); 549 550 551 //Keys 21-30 552 553 keysC[4][1] = digitalRead(22); 554 keysC[4][2] = digitalRead(23); 555 556 keysC[4][3] = digitalRead(24); 557 keysC[4][4] = digitalRead(25); 558 keysC[4][5] 559 = digitalRead(26); 560 keysC[5][0] = digitalRead(27); 561 keysC[5][1] = digitalRead(28); 562 563 keysC[5][2] = digitalRead(29); 564 keysC[5][3] = digitalRead(30); 565 keysC[5][4] 566 = digitalRead(31); 567 568 //Keys 31-40 569 570 keysC[5][5] = digitalRead(32); 571 572 keysC[6][0] = digitalRead(33); 573 keysC[6][1] = digitalRead(34); 574 keysC[6][2] 575 = digitalRead(35); 576 keysC[6][3] = digitalRead(36); 577 keysC[6][4] = digitalRead(37); 578 579 keysC[6][5] = digitalRead(38); 580 keysC[7][0] = digitalRead(39); 581 keysC[7][1] 582 = digitalRead(40); 583 keysC[7][2] = digitalRead(41); 584 585 //Keys 41-50 586 587 588 keysC[7][3] = digitalRead(42); 589 keysC[7][4] = digitalRead(43); 590 keysC[7][5] 591 = digitalRead(44); 592 keysC[8][0] = digitalRead(45); 593 keysC[8][1] = digitalRead(46); 594 595 keysC[8][2] = digitalRead(47); 596 keysC[8][3] = digitalRead(48); 597 keysC[8][4] 598 = digitalRead(49); 599 keysC[8][5] = digitalRead(50); 600 keysC[9][0] = digitalRead(51); 601 602 603 //Keys 51-61 604 605 keysC[9][1] = digitalRead(52); 606 keysC[9][2] 607 = digitalRead(53); 608 keysC[9][3] = digitalRead(A0); 609 keysC[9][4] = digitalRead(A1); 610 611 keysC[9][5] = digitalRead(A2); 612 keysC[10][0] = digitalRead(A3); 613 keysC[10][1] 614 = digitalRead(A4); 615 keysC[10][2] = digitalRead(A5); 616 keysC[10][3] = 617 digitalRead(A6); 618 keysC[10][4] = digitalRead(A7); 619 keysC[10][5] = digitalRead(A8); 620 621 622 pinMode(A11, INPUT); 623 624 // Read Keyboard D 625 626 pinMode(A12, 627 OUTPUT); 628 digitalWrite(A12, LOW); 629 630 //Keys 1-10 631 632 keysD[0][0] 633 = digitalRead(2); 634 keysD[1][0] = digitalRead(3); 635 keysD[1][1] = digitalRead(4); 636 637 keysD[1][2] = digitalRead(5); 638 keysD[1][3] = digitalRead(6); 639 keysD[1][4] 640 = digitalRead(7); 641 keysD[1][5] = digitalRead(8); 642 keysD[2][0] = digitalRead(9); 643 644 keysD[2][1] = digitalRead(10); 645 keysD[2][2] = digitalRead(11); 646 647 648 //Keys 11-20 649 650 keysD[2][3] = digitalRead(12); 651 keysD[2][4] 652 = digitalRead(13); 653 keysD[2][5] = digitalRead(14); 654 keysD[3][0] = digitalRead(15); 655 656 keysD[3][1] = digitalRead(16); 657 keysD[3][2] = digitalRead(17); 658 keysD[3][3] 659 = digitalRead(18); 660 keysD[3][4] = digitalRead(19); 661 keysD[3][5] = digitalRead(20); 662 663 keysD[4][0] = digitalRead(21); 664 665 666 //Keys 21-30 667 668 keysD[4][1] 669 = digitalRead(22); 670 keysD[4][2] = digitalRead(23); 671 keysD[4][3] = digitalRead(24); 672 673 keysD[4][4] = digitalRead(25); 674 keysD[4][5] = digitalRead(26); 675 keysD[5][0] 676 = digitalRead(27); 677 keysD[5][1] = digitalRead(28); 678 keysD[5][2] = digitalRead(29); 679 680 keysD[5][3] = digitalRead(30); 681 keysD[5][4] = digitalRead(31); 682 683 684 //Keys 31-40 685 686 keysD[5][5] = digitalRead(32); 687 keysD[6][0] 688 = digitalRead(33); 689 keysD[6][1] = digitalRead(34); 690 keysD[6][2] = digitalRead(35); 691 692 keysD[6][3] = digitalRead(36); 693 keysD[6][4] = digitalRead(37); 694 keysD[6][5] 695 = digitalRead(38); 696 keysD[7][0] = digitalRead(39); 697 keysD[7][1] = digitalRead(40); 698 699 keysD[7][2] = digitalRead(41); 700 701 //Keys 41-50 702 703 keysD[7][3] 704 = digitalRead(42); 705 keysD[7][4] = digitalRead(43); 706 keysD[7][5] = digitalRead(44); 707 708 keysD[8][0] = digitalRead(45); 709 keysD[8][1] = digitalRead(46); 710 keysD[8][2] 711 = digitalRead(47); 712 keysD[8][3] = digitalRead(48); 713 keysD[8][4] = digitalRead(49); 714 715 keysD[8][5] = digitalRead(50); 716 keysD[9][0] = digitalRead(51); 717 718 719 //Keys 51-61 720 721 keysD[9][1] = digitalRead(52); 722 keysD[9][2] = digitalRead(53); 723 724 keysD[9][3] = digitalRead(A0); 725 keysD[9][4] = digitalRead(A1); 726 keysD[9][5] 727 = digitalRead(A2); 728 keysD[10][0] = digitalRead(A3); 729 keysD[10][1] = 730 digitalRead(A4); 731 keysD[10][2] = digitalRead(A5); 732 keysD[10][3] = digitalRead(A6); 733 734 keysD[10][4] = digitalRead(A7); 735 keysD[10][5] = digitalRead(A8); 736 737 738 pinMode(A12, INPUT); 739 740 //Return pins to Initialized state 741 742 //Pins 743 1-10 744 745 pinMode(2, INPUT); 746 pinMode(3, INPUT); 747 pinMode(4, INPUT); 748 749 pinMode(5, INPUT); 750 pinMode(6, INPUT); 751 pinMode(7, INPUT); 752 pinMode(8, 753 INPUT); 754 pinMode(9, INPUT); 755 pinMode(10, INPUT); 756 pinMode(11, INPUT); 757 758 759 //Pins 11-20 760 761 pinMode(12, INPUT); 762 pinMode(13, INPUT); 763 pinMode(14, 764 INPUT); 765 pinMode(15, INPUT); 766 pinMode(16, INPUT); 767 pinMode(17, INPUT); 768 769 pinMode(18, INPUT); 770 pinMode(19, INPUT); 771 pinMode(20, INPUT); 772 pinMode(21, 773 INPUT); 774 775 //Pins 21-30 776 777 pinMode(22, INPUT); 778 pinMode(23, INPUT); 779 780 pinMode(24, INPUT); 781 pinMode(25, INPUT); 782 pinMode(26, INPUT); 783 pinMode(27, 784 INPUT); 785 pinMode(28, INPUT); 786 pinMode(29, INPUT); 787 pinMode(30, INPUT); 788 789 pinMode(31, INPUT); 790 791 //Pins 31-40 792 793 pinMode(32, INPUT); 794 pinMode(33, 795 INPUT); 796 pinMode(34, INPUT); 797 pinMode(35, INPUT); 798 pinMode(36, INPUT); 799 800 pinMode(37, INPUT); 801 pinMode(38, INPUT); 802 pinMode(39, INPUT); 803 pinMode(40, 804 INPUT); 805 pinMode(41, INPUT); 806 807 //Pins 41-50 808 809 pinMode(42, INPUT); 810 811 pinMode(43, INPUT); 812 pinMode(44, INPUT); 813 pinMode(45, INPUT); 814 pinMode(46, 815 INPUT); 816 pinMode(47, INPUT); 817 pinMode(48, INPUT); 818 pinMode(49, INPUT); 819 820 pinMode(50, INPUT); 821 pinMode(51, INPUT); 822 823 //Pins 51-61 824 825 pinMode(52, 826 INPUT); 827 pinMode(53, INPUT); 828 pinMode(A0, INPUT); 829 pinMode(A1, INPUT); 830 831 pinMode(A2, INPUT); 832 pinMode(A3, INPUT); 833 pinMode(A4, INPUT); 834 pinMode(A5, 835 INPUT); 836 pinMode(A6, INPUT); 837 pinMode(A7, INPUT); 838 pinMode(A8, INPUT); 839 840 841 //Column Pins 842 843 pinMode(A9, INPUT); 844 pinMode(A10, INPUT); 845 pinMode(A11, 846 INPUT); 847 pinMode(A12, INPUT); 848 849 //Pot Pins 850 851 pinMode(A13, INPUT); 852 853 pinMode(A14, INPUT); 854 pinMode(A15, INPUT); 855 856 /* 857 //Invert Keyboard 858 data only if needed. 859 //Example only for 32 pedals of a pedalboard, first 32 860 keys of keyboard C. 861 862 //Column 1 863 864 if (keysC[0][0] == 0) { 865 keysC[0][0] 866 = 1; 867 } 868 else 869 if (keysC[0][0] == 1) { 870 keysC[0][0] = 0; 871 } 872 873 874 //Column 2 875 876 if (keysC[1][0] == 0) { 877 keysC[1][0] = 1; 878 } 879 880 else 881 if (keysC[1][0] == 1) { 882 keysC[1][0] = 0; 883 } 884 if (keysC[1][1] 885 == 0) { 886 keysC[1][1] = 1; 887 } 888 else 889 if (keysC[1][1] == 1) { 890 891 keysC[1][1] = 0; 892 } 893 if (keysC[1][2] == 0) { 894 keysC[1][2] = 895 1; 896 } 897 else 898 if (keysC[1][2] == 1) { 899 keysC[1][2] = 0; 900 } 901 902 if (keysC[1][3] == 0) { 903 keysC[1][3] = 1; 904 } 905 else 906 if (keysC[1][3] 907 == 1) { 908 keysC[1][3] = 0; 909 } 910 if (keysC[1][4] == 0) { 911 keysC[1][4] 912 = 1; 913 } 914 else 915 if (keysC[1][4] == 1) { 916 keysC[1][4] = 0; 917 } 918 919 if (keysC[1][5] == 0) { 920 keysC[1][5] = 1; 921 } 922 else 923 if (keysC[1][5] 924 == 1) { 925 keysC[1][5] = 0; 926 } 927 928 //Column 3 929 930 if (keysC[2][0] 931 == 0) { 932 keysC[2][0] = 1; 933 } 934 else 935 if (keysC[2][0] == 1) { 936 937 keysC[2][0] = 0; 938 } 939 if (keysC[2][1] == 0) { 940 keysC[2][1] = 1; 941 942 } 943 else 944 if (keysC[2][1] == 1) { 945 keysC[2][1] = 0; 946 } 947 948 if (keysC[2][2] == 0) { 949 keysC[2][2] = 1; 950 } 951 else 952 if (keysC[2][2] 953 == 1) { 954 keysC[2][2] = 0; 955 } 956 if (keysC[2][3] == 0) { 957 keysC[2][3] 958 = 1; 959 } 960 else 961 if (keysC[2][3] == 1) { 962 keysC[2][3] = 0; 963 } 964 965 if (keysC[2][4] == 0) { 966 keysC[2][4] = 1; 967 } 968 else 969 if 970 (keysC[2][4] == 1) { 971 keysC[2][4] = 0; 972 } 973 if (keysC[2][5] == 0) { 974 975 keysC[2][5] = 1; 976 } 977 else 978 if (keysC[2][5] == 1) { 979 keysC[2][5] 980 = 0; 981 } 982 983 //Column 4 984 985 if (keysC[3][0] == 0) { 986 keysC[3][0] 987 = 1; 988 } 989 else 990 if (keysC[3][0] == 1) { 991 keysC[3][0] = 0; 992 } 993 994 if (keysC[3][1] == 0) { 995 keysC[3][1] = 1; 996 } 997 else 998 if (keysC[3][1] 999 == 1) { 1000 keysC[3][1] = 0; 1001 } 1002 if (keysC[3][2] == 0) { 1003 keysC[3][2] 1004 = 1; 1005 } 1006 else 1007 if (keysC[3][2] == 1) { 1008 keysC[3][2] = 0; 1009 } 1010 1011 if (keysC[3][3] == 0) { 1012 keysC[3][3] = 1; 1013 } 1014 else 1015 if (keysC[3][3] 1016 == 1) { 1017 keysC[3][3] = 0; 1018 } 1019 if (keysC[3][4] == 0) { 1020 keysC[3][4] 1021 = 1; 1022 } 1023 else 1024 if (keysC[3][4] == 1) { 1025 keysC[3][4] = 0; 1026 } 1027 1028 if (keysC[3][5] == 0) { 1029 keysC[3][5] = 1; 1030 } 1031 else 1032 if (keysC[3][5] 1033 == 1) { 1034 keysC[3][5] = 0; 1035 } 1036 1037 //Column 5 1038 1039 if (keysC[4][0] 1040 == 0) { 1041 keysC[4][0] = 1; 1042 } 1043 else 1044 if (keysC[4][0] == 1) { 1045 1046 keysC[4][0] = 0; 1047 } 1048 if (keysC[4][1] == 0) { 1049 keysC[4][1] = 1; 1050 1051 } 1052 else 1053 if (keysC[4][1] == 1) { 1054 keysC[4][1] = 0; 1055 } 1056 1057 if (keysC[4][2] == 0) { 1058 keysC[4][2] = 1; 1059 } 1060 else 1061 if (keysC[4][2] 1062 == 1) { 1063 keysC[4][2] = 0; 1064 } 1065 if (keysC[4][3] == 0) { 1066 keysC[4][3] 1067 = 1; 1068 } 1069 else 1070 if (keysC[4][3] == 1) { 1071 keysC[4][3] = 0; 1072 } 1073 1074 if (keysC[4][4] == 0) { 1075 keysC[4][4] = 1; 1076 } 1077 else 1078 if 1079 (keysC[4][4] == 1) { 1080 keysC[4][4] = 0; 1081 } 1082 if (keysC[4][5] == 0) { 1083 1084 keysC[4][5] = 1; 1085 } 1086 else 1087 if (keysC[4][5] == 1) { 1088 keysC[4][5] 1089 = 0; 1090 } 1091 1092 //Column 6 1093 1094 if (keysC[5][0] == 0) { 1095 keysC[5][0] 1096 = 1; 1097 } 1098 else 1099 if (keysC[5][0] == 1) { 1100 keysC[5][0] = 0; 1101 } 1102 1103 if (keysC[5][1] == 0) { 1104 keysC[5][1] = 1; 1105 } 1106 else 1107 if (keysC[5][1] 1108 == 1) { 1109 keysC[5][1] = 0; 1110 } 1111 if (keysC[5][2] == 0) { 1112 keysC[5][2] 1113 = 1; 1114 } 1115 else 1116 if (keysC[5][2] == 1) { 1117 keysC[5][2] = 0; 1118 } 1119 1120 if (keysC[5][3] == 0) { 1121 keysC[5][3] = 1; 1122 } 1123 else 1124 if (keysC[5][3] 1125 == 1) { 1126 keysC[5][3] = 0; 1127 } 1128 if (keysC[5][4] == 0) { 1129 keysC[5][4] 1130 = 1; 1131 } 1132 else 1133 if (keysC[5][4] == 1) { 1134 keysC[5][4] = 0; 1135 } 1136 1137 if (keysC[5][5] == 0) { 1138 keysC[5][5] = 1; 1139 } 1140 else 1141 if (keysC[5][5] 1142 == 1) { 1143 keysC[5][5] = 0; 1144 } 1145 1146 //Column 7 1147 1148 if (keysC[6][0] 1149 == 0) { 1150 keysC[6][0] = 1; 1151 } 1152 else 1153 if (keysC[6][0] == 1) { 1154 1155 keysC[6][0] = 0; 1156 } 1157 */ 1158 1159 //Write Keyboard A 1160 1161 //A36 1162 1163 if ((keysA[0][0] == 0) and (lastA[0][0] == 0)) { 1164 MidiSend(noteOn1, 36, 1165 velocity); 1166 lastA[0][0] = 7; 1167 } 1168 if ((keysA[0][0] == 1) and (lastA[0][0] 1169 == 7)) { 1170 MidiSend(noteOff1, 36, velocity); 1171 lastA[0][0] = 0; 1172 } 1173 1174 1175 //A37 1176 if ((keysA[1][0] == 0) and (lastA[1][0] == 0)) { 1177 MidiSend(noteOn1, 1178 37, velocity); 1179 lastA[1][0] = 7; 1180 } 1181 if ((keysA[1][0] == 1) and (lastA[1][0] 1182 == 7)) { 1183 MidiSend(noteOff1, 37, velocity); 1184 lastA[1][0] = 0; 1185 } 1186 1187 1188 //A38 1189 if ((keysA[1][1] == 0) and (lastA[1][1] == 0)) { 1190 MidiSend(noteOn1, 1191 38, velocity); 1192 lastA[1][1] = 7; 1193 } 1194 //Write Midi Note Off 1195 if 1196 ((keysA[1][1] == 1) and (lastA[1][1] == 7)) { 1197 MidiSend(noteOff1, 38, velocity); 1198 1199 lastA[1][1] = 0; 1200 } 1201 1202 //A39 1203 if ((keysA[1][2] == 0) and (lastA[1][2] 1204 == 0)) { 1205 MidiSend(noteOn1, 39, velocity); 1206 lastA[1][2] = 7; 1207 } 1208 1209 //Write Midi Note Off 1210 if ((keysA[1][2] == 1) and (lastA[1][2] == 7)) { 1211 1212 MidiSend(noteOff1, 39, velocity); 1213 lastA[1][2] = 0; 1214 } 1215 1216 //A40 1217 1218 if ((keysA[1][3] == 0) and (lastA[1][3] == 0)) { 1219 MidiSend(noteOn1, 40, 1220 velocity); 1221 lastA[1][3] = 7; 1222 } 1223 //Write Midi Note Off 1224 if ((keysA[1][3] 1225 == 1) and (lastA[1][3] == 7)) { 1226 MidiSend(noteOff1, 40, velocity); 1227 lastA[1][3] 1228 = 0; 1229 } 1230 1231 //A41 1232 if ((keysA[1][4] == 0) and (lastA[1][4] == 0)) { 1233 1234 MidiSend(noteOn1, 41, velocity); 1235 lastA[1][4] = 7; 1236 } 1237 //Write 1238 Midi Note Off 1239 if ((keysA[1][4] == 1) and (lastA[1][4] == 7)) { 1240 MidiSend(noteOff1, 1241 41, velocity); 1242 lastA[1][4] = 0; 1243 } 1244 1245 //A42 1246 if ((keysA[1][5] 1247 == 0) and (lastA[1][5] == 0)) { 1248 MidiSend(noteOn1, 42, velocity); 1249 lastA[1][5] 1250 = 7; 1251 } 1252 //Write Midi Note Off 1253 if ((keysA[1][5] == 1) and (lastA[1][5] 1254 == 7)) { 1255 MidiSend(noteOff1, 42, velocity); 1256 lastA[1][5] = 0; 1257 } 1258 1259 1260 //A43 1261 if ((keysA[2][0] == 0) and (lastA[2][0] == 0)) { 1262 MidiSend(noteOn1, 1263 43, velocity); 1264 lastA[2][0] = 7; 1265 } 1266 //Write Midi Note Off 1267 if 1268 ((keysA[2][0] == 1) and (lastA[2][0] == 7)) { 1269 MidiSend(noteOff1, 43, velocity); 1270 1271 lastA[2][0] = 0; 1272 } 1273 1274 //A44 1275 if ((keysA[2][1] == 0) and (lastA[2][1] 1276 == 0)) { 1277 MidiSend(noteOn1, 44, velocity); 1278 lastA[2][1] = 7; 1279 } 1280 1281 //Write Midi Note Off 1282 if ((keysA[2][1] == 1) and (lastA[2][1] == 7)) { 1283 1284 MidiSend(noteOff1, 44, velocity); 1285 lastA[2][1] = 0; 1286 } 1287 1288 //A45 1289 1290 if ((keysA[2][2] == 0) and (lastA[2][2] == 0)) { 1291 MidiSend(noteOn1, 45, 1292 velocity); 1293 lastA[2][2] = 7; 1294 } 1295 //Write Midi Note Off 1296 if ((keysA[2][2] 1297 == 1) and (lastA[2][2] == 7)) { 1298 MidiSend(noteOff1, 45, velocity); 1299 lastA[2][2] 1300 = 0; 1301 } 1302 1303 //A46 1304 if ((keysA[2][3] == 0) and (lastA[2][3] == 0)) { 1305 1306 MidiSend(noteOn1, 46, velocity); 1307 lastA[2][3] = 7; 1308 } 1309 //Write 1310 Midi Note Off 1311 if ((keysA[2][3] == 1) and (lastA[2][3] == 7)) { 1312 MidiSend(noteOff1, 1313 46, velocity); 1314 lastA[2][3] = 0; 1315 } 1316 1317 //A47 1318 if ((keysA[2][4] 1319 == 0) and (lastA[2][4] == 0)) { 1320 MidiSend(noteOn1, 47, velocity); 1321 lastA[2][4] 1322 = 7; 1323 } 1324 //Write Midi Note Off 1325 if ((keysA[2][4] == 1) and (lastA[2][4] 1326 == 7)) { 1327 MidiSend(noteOff1, 47, velocity); 1328 lastA[2][4] = 0; 1329 } 1330 1331 1332 //A48 1333 if ((keysA[2][5] == 0) and (lastA[2][5] == 0)) { 1334 MidiSend(noteOn1, 1335 48, velocity); 1336 lastA[2][5] = 7; 1337 } 1338 //Write Midi Note Off 1339 if 1340 ((keysA[2][5] == 1) and (lastA[2][5] == 7)) { 1341 MidiSend(noteOff1, 48, velocity); 1342 1343 lastA[2][5] = 0; 1344 } 1345 1346 //A49 1347 if ((keysA[3][0] == 0) and (lastA[3][0] 1348 == 0)) { 1349 MidiSend(noteOn1, 49, velocity); 1350 lastA[3][0] = 7; 1351 } 1352 1353 //Write Midi Note Off 1354 if ((keysA[3][0] == 1) and (lastA[3][0] == 7)) { 1355 1356 MidiSend(noteOff1, 49, velocity); 1357 lastA[3][0] = 0; 1358 } 1359 1360 //A50 1361 1362 if ((keysA[3][1] == 0) and (lastA[3][1] == 0)) { 1363 MidiSend(noteOn1, 50, 1364 velocity); 1365 lastA[3][1] = 7; 1366 } 1367 //Write Midi Note Off 1368 if ((keysA[3][1] 1369 == 1) and (lastA[3][1] == 7)) { 1370 MidiSend(noteOff1, 50, velocity); 1371 lastA[3][1] 1372 = 0; 1373 } 1374 1375 //A51 1376 if ((keysA[3][2] == 0) and (lastA[3][2] == 0)) { 1377 1378 MidiSend(noteOn1, 51, velocity); 1379 lastA[3][2] = 7; 1380 } 1381 //Write 1382 Midi Note Off 1383 if ((keysA[3][2] == 1) and (lastA[3][2] == 7)) { 1384 MidiSend(noteOff1, 1385 51, velocity); 1386 lastA[3][2] = 0; 1387 } 1388 1389 //A52 1390 if ((keysA[3][3] 1391 == 0) and (lastA[3][3] == 0)) { 1392 MidiSend(noteOn1, 52, velocity); 1393 lastA[3][3] 1394 = 7; 1395 } 1396 //Write Midi Note Off 1397 if ((keysA[3][3] == 1) and (lastA[3][3] 1398 == 7)) { 1399 MidiSend(noteOff1, 52, velocity); 1400 lastA[3][3] = 0; 1401 } 1402 1403 1404 //A53 1405 if ((keysA[3][4] == 0) and (lastA[3][4] == 0)) { 1406 MidiSend(noteOn1, 1407 53, velocity); 1408 lastA[3][4] = 7; 1409 } 1410 //Write Midi Note Off 1411 if 1412 ((keysA[3][4] == 1) and (lastA[3][4] == 7)) { 1413 MidiSend(noteOff1, 53, velocity); 1414 1415 lastA[3][4] = 0; 1416 } 1417 1418 //A54 1419 if ((keysA[3][5] == 0) and (lastA[3][5] 1420 == 0)) { 1421 MidiSend(noteOn1, 54, velocity); 1422 lastA[3][5] = 7; 1423 } 1424 1425 //Write Midi Note Off 1426 if ((keysA[3][5] == 1) and (lastA[3][5] == 7)) { 1427 1428 MidiSend(noteOff1, 54, velocity); 1429 lastA[3][5] = 0; 1430 } 1431 1432 //A55 1433 1434 if ((keysA[4][0] == 0) and (lastA[4][0] == 0)) { 1435 MidiSend(noteOn1, 55, 1436 velocity); 1437 lastA[4][0] = 7; 1438 } 1439 //Write Midi Note Off 1440 if ((keysA[4][0] 1441 == 1) and (lastA[4][0] == 7)) { 1442 MidiSend(noteOff1, 55, velocity); 1443 lastA[4][0] 1444 = 0; 1445 } 1446 1447 //A56 1448 if ((keysA[4][1] == 0) and (lastA[4][1] == 0)) { 1449 1450 MidiSend(noteOn1, 56, velocity); 1451 lastA[4][1] = 7; 1452 } 1453 //Write 1454 Midi Note Off 1455 if ((keysA[4][1] == 1) and (lastA[4][1] == 7)) { 1456 MidiSend(noteOff1, 1457 56, velocity); 1458 lastA[4][1] = 0; 1459 } 1460 1461 //A57 1462 if ((keysA[4][2] 1463 == 0) and (lastA[4][2] == 0)) { 1464 MidiSend(noteOn1, 57, velocity); 1465 lastA[4][2] 1466 = 7; 1467 } 1468 //Write Midi Note Off 1469 if ((keysA[4][2] == 1) and (lastA[4][2] 1470 == 7)) { 1471 MidiSend(noteOff1, 57, velocity); 1472 lastA[4][2] = 0; 1473 } 1474 1475 1476 //A58 1477 if ((keysA[4][3] == 0) and (lastA[4][3] == 0)) { 1478 MidiSend(noteOn1, 1479 58, velocity); 1480 lastA[4][3] = 7; 1481 } 1482 //Write Midi Note Off 1483 if 1484 ((keysA[4][3] == 1) and (lastA[4][3] == 7)) { 1485 MidiSend(noteOff1, 58, velocity); 1486 1487 lastA[4][3] = 0; 1488 } 1489 1490 //59 1491 if ((keysA[4][4] == 0) and (lastA[4][4] 1492 == 0)) { 1493 MidiSend(noteOn1, 59, velocity); 1494 lastA[4][4] = 7; 1495 } 1496 1497 //Write Midi Note Off 1498 if ((keysA[4][4] == 1) and (lastA[4][4] == 7)) { 1499 1500 MidiSend(noteOff1, 59, velocity); 1501 lastA[4][4] = 0; 1502 } 1503 1504 //A60 1505 1506 if ((keysA[4][5] == 0) and (lastA[4][5] == 0)) { 1507 MidiSend(noteOn1, 60, 1508 velocity); 1509 lastA[4][5] = 7; 1510 } 1511 //Write Midi Note Off 1512 if ((keysA[4][5] 1513 == 1) and (lastA[4][5] == 7)) { 1514 MidiSend(noteOff1, 60, velocity); 1515 lastA[4][5] 1516 = 0; 1517 } 1518 1519 //A61 1520 if ((keysA[5][0] == 0) and (lastA[5][0] == 0)) { 1521 1522 MidiSend(noteOn1, 61, velocity); 1523 lastA[5][0] = 7; 1524 } 1525 //Write 1526 Midi Note Off 1527 if ((keysA[5][0] == 1) and (lastA[5][0] == 7)) { 1528 MidiSend(noteOff1, 1529 61, velocity); 1530 lastA[5][0] = 0; 1531 } 1532 1533 //A62 1534 if ((keysA[5][1] 1535 == 0) and (lastA[5][1] == 0)) { 1536 MidiSend(noteOn1, 62, velocity); 1537 lastA[5][1] 1538 = 7; 1539 } 1540 //Write Midi Note Off 1541 if ((keysA[5][1] == 1) and (lastA[5][1] 1542 == 7)) { 1543 MidiSend(noteOff1, 62, velocity); 1544 lastA[5][1] = 0; 1545 } 1546 1547 1548 //A63 1549 if ((keysA[5][2] == 0) and (lastA[5][2] == 0)) { 1550 MidiSend(noteOn1, 1551 63, velocity); 1552 lastA[5][2] = 7; 1553 } 1554 //Write Midi Note Off 1555 if 1556 ((keysA[5][2] == 1) and (lastA[5][2] == 7)) { 1557 MidiSend(noteOff1, 63, velocity); 1558 1559 lastA[5][2] = 0; 1560 } 1561 1562 //A64 1563 if ((keysA[5][3] == 0) and (lastA[5][3] 1564 == 0)) { 1565 MidiSend(noteOn1, 64, velocity); 1566 lastA[5][3] = 7; 1567 } 1568 1569 //Write Midi Note Off 1570 if ((keysA[5][3] == 1) and (lastA[5][3] == 7)) { 1571 1572 MidiSend(noteOff1, 64, velocity); 1573 lastA[5][3] = 0; 1574 } 1575 1576 //A65 1577 1578 if ((keysA[5][4] == 0) and (lastA[5][4] == 0)) { 1579 MidiSend(noteOn1, 65, 1580 velocity); 1581 lastA[5][4] = 7; 1582 } 1583 //Write Midi Note Off 1584 if ((keysA[5][4] 1585 == 1) and (lastA[5][4] == 7)) { 1586 MidiSend(noteOff1, 65, velocity); 1587 lastA[5][4] 1588 = 0; 1589 } 1590 1591 //A66 1592 if ((keysA[5][5] == 0) and (lastA[5][5] == 0)) { 1593 1594 MidiSend(noteOn1, 66, velocity); 1595 lastA[5][5] = 7; 1596 } 1597 //Write 1598 Midi Note Off 1599 if ((keysA[5][5] == 1) and (lastA[5][5] == 7)) { 1600 MidiSend(noteOff1, 1601 66, velocity); 1602 lastA[5][5] = 0; 1603 } 1604 1605 //A67 1606 if ((keysA[6][0] 1607 == 0) and (lastA[6][0] == 0)) { 1608 MidiSend(noteOn1, 67, velocity); 1609 lastA[6][0] 1610 = 7; 1611 } 1612 //Write Midi Note Off 1613 if ((keysA[6][0] == 1) and (lastA[6][0] 1614 == 7)) { 1615 MidiSend(noteOff1, 67, velocity); 1616 lastA[6][0] = 0; 1617 } 1618 1619 1620 //A68 1621 if ((keysA[6][1] == 0) and (lastA[6][1] == 0)) { 1622 MidiSend(noteOn1, 1623 68, velocity); 1624 lastA[6][1] = 7; 1625 } 1626 //Write Midi Note Off 1627 if 1628 ((keysA[6][1] == 1) and (lastA[6][1] == 7)) { 1629 MidiSend(noteOff1, 68, velocity); 1630 1631 lastA[6][1] = 0; 1632 } 1633 1634 //A69 1635 if ((keysA[6][2] == 0) and (lastA[6][2] 1636 == 0)) { 1637 MidiSend(noteOn1, 69, velocity); 1638 lastA[6][2] = 7; 1639 } 1640 1641 //Write Midi Note Off 1642 if ((keysA[6][2] == 1) and (lastA[6][2] == 7)) { 1643 1644 MidiSend(noteOff1, 69, velocity); 1645 lastA[6][2] = 0; 1646 } 1647 1648 //A70 1649 1650 if ((keysA[6][3] == 0) and (lastA[6][3] == 0)) { 1651 MidiSend(noteOn1, 70, 1652 velocity); 1653 lastA[6][3] = 7; 1654 } 1655 //Write Midi Note Off 1656 if ((keysA[6][3] 1657 == 1) and (lastA[6][3] == 7)) { 1658 MidiSend(noteOff1, 70, velocity); 1659 lastA[6][3] 1660 = 0; 1661 } 1662 1663 //A71 1664 if ((keysA[6][4] == 0) and (lastA[6][4] == 0)) { 1665 1666 MidiSend(noteOn1, 71, velocity); 1667 lastA[6][4] = 7; 1668 } 1669 //Write 1670 Midi Note Off 1671 if ((keysA[6][4] == 1) and (lastA[6][4] == 7)) { 1672 MidiSend(noteOff1, 1673 71, velocity); 1674 lastA[6][4] = 0; 1675 } 1676 1677 //A72 1678 if ((keysA[6][5] 1679 == 0) and (lastA[6][5] == 0)) { 1680 MidiSend(noteOn1, 72, velocity); 1681 lastA[6][5] 1682 = 7; 1683 } 1684 //Write Midi Note Off 1685 if ((keysA[6][5] == 1) and (lastA[6][5] 1686 == 7)) { 1687 MidiSend(noteOff1, 72, velocity); 1688 lastA[6][5] = 0; 1689 } 1690 1691 1692 //A73 1693 if ((keysA[7][0] == 0) and (lastA[7][0] == 0)) { 1694 MidiSend(noteOn1, 1695 73, velocity); 1696 lastA[7][0] = 7; 1697 } 1698 //Write Midi Note Off 1699 if 1700 ((keysA[7][0] == 1) and (lastA[7][0] == 7)) { 1701 MidiSend(noteOff1, 73, velocity); 1702 1703 lastA[7][0] = 0; 1704 } 1705 1706 //A74 1707 if ((keysA[7][1] == 0) and (lastA[7][1] 1708 == 0)) { 1709 MidiSend(noteOn1, 74, velocity); 1710 lastA[7][1] = 7; 1711 } 1712 1713 //Write Midi Note Off 1714 if ((keysA[7][1] == 1) and (lastA[7][1] == 7)) { 1715 1716 MidiSend(noteOff1, 74, velocity); 1717 lastA[7][1] = 0; 1718 } 1719 1720 //A75 1721 1722 if ((keysA[7][2] == 0) and (lastA[7][2] == 0)) { 1723 MidiSend(noteOn1, 75, 1724 velocity); 1725 lastA[7][2] = 7; 1726 } 1727 //Write Midi Note Off 1728 if ((keysA[7][2] 1729 == 1) and (lastA[7][2] == 7)) { 1730 MidiSend(noteOff1, 75, velocity); 1731 lastA[7][2] 1732 = 0; 1733 } 1734 1735 //A76 1736 if ((keysA[7][3] == 0) and (lastA[7][3] == 0)) { 1737 1738 MidiSend(noteOn1, 76, velocity); 1739 lastA[7][3] = 7; 1740 } 1741 //Write 1742 Midi Note Off 1743 if ((keysA[7][3] == 1) and (lastA[7][3] == 7)) { 1744 MidiSend(noteOff1, 1745 76, velocity); 1746 lastA[7][3] = 0; 1747 } 1748 1749 //A77 1750 if ((keysA[7][4] 1751 == 0) and (lastA[7][4] == 0)) { 1752 MidiSend(noteOn1, 77, velocity); 1753 lastA[7][4] 1754 = 7; 1755 } 1756 //Write Midi Note Off 1757 if ((keysA[7][4] == 1) and (lastA[7][4] 1758 == 7)) { 1759 MidiSend(noteOff1, 77, velocity); 1760 lastA[7][4] = 0; 1761 } 1762 1763 1764 //A78 1765 if ((keysA[7][5] == 0) and (lastA[7][5] == 0)) { 1766 MidiSend(noteOn1, 1767 78, velocity); 1768 lastA[7][5] = 7; 1769 } 1770 //Write Midi Note Off 1771 if 1772 ((keysA[7][5] == 1) and (lastA[7][5] == 7)) { 1773 MidiSend(noteOff1, 78, velocity); 1774 1775 lastA[7][5] = 0; 1776 } 1777 1778 //A79 1779 if ((keysA[8][0] == 0) and (lastA[8][0] 1780 == 0)) { 1781 MidiSend(noteOn1, 79, velocity); 1782 lastA[8][0] = 7; 1783 } 1784 1785 //Write Midi Note Off 1786 if ((keysA[8][0] == 1) and (lastA[8][0] == 7)) { 1787 1788 MidiSend(noteOff1, 79, velocity); 1789 lastA[8][0] = 0; 1790 } 1791 1792 //A80 1793 1794 if ((keysA[8][1] == 0) and (lastA[8][1] == 0)) { 1795 MidiSend(noteOn1, 80, 1796 velocity); 1797 lastA[8][1] = 7; 1798 } 1799 //Write Midi Note Off 1800 if ((keysA[8][1] 1801 == 1) and (lastA[8][1] == 7)) { 1802 MidiSend(noteOff1, 80, velocity); 1803 lastA[8][1] 1804 = 0; 1805 } 1806 1807 //A81 1808 if ((keysA[8][2] == 0) and (lastA[8][2] == 0)) { 1809 1810 MidiSend(noteOn1, 81, velocity); 1811 lastA[8][2] = 7; 1812 } 1813 //Write 1814 Midi Note Off 1815 if ((keysA[8][2] == 1) and (lastA[8][2] == 7)) { 1816 MidiSend(noteOff1, 1817 81, velocity); 1818 lastA[8][2] = 0; 1819 } 1820 1821 //A82 1822 if ((keysA[8][3] 1823 == 0) and (lastA[8][3] == 0)) { 1824 MidiSend(noteOn1, 82, velocity); 1825 lastA[8][3] 1826 = 7; 1827 } 1828 //Write Midi Note Off 1829 if ((keysA[8][3] == 1) and (lastA[8][3] 1830 == 7)) { 1831 MidiSend(noteOff1, 82, velocity); 1832 lastA[8][3] = 0; 1833 } 1834 1835 1836 //A83 1837 if ((keysA[8][4] == 0) and (lastA[8][4] == 0)) { 1838 MidiSend(noteOn1, 1839 83, velocity); 1840 lastA[8][4] = 7; 1841 } 1842 //Write Midi Note Off 1843 if 1844 ((keysA[8][4] == 1) and (lastA[8][4] == 7)) { 1845 MidiSend(noteOff1, 83, velocity); 1846 1847 lastA[8][4] = 0; 1848 } 1849 1850 //A84 1851 if ((keysA[8][5] == 0) and (lastA[8][5] 1852 == 0)) { 1853 MidiSend(noteOn1, 84, velocity); 1854 lastA[8][5] = 7; 1855 } 1856 1857 //Write Midi Note Off 1858 if ((keysA[8][5] == 1) and (lastA[8][5] == 7)) { 1859 1860 MidiSend(noteOff1, 84, velocity); 1861 lastA[8][5] = 0; 1862 } 1863 1864 //A85 1865 1866 if ((keysA[9][0] == 0) and (lastA[9][0] == 0)) { 1867 MidiSend(noteOn1, 85, 1868 velocity); 1869 lastA[9][0] = 7; 1870 } 1871 //Write Midi Note Off 1872 if ((keysA[9][0] 1873 == 1) and (lastA[9][0] == 7)) { 1874 MidiSend(noteOff1, 85, velocity); 1875 lastA[9][0] 1876 = 0; 1877 } 1878 1879 //A86 1880 if ((keysA[9][1] == 0) and (lastA[9][1] == 0)) { 1881 1882 MidiSend(noteOn1, 86, velocity); 1883 lastA[9][1] = 7; 1884 } 1885 //Write 1886 Midi Note Off 1887 if ((keysA[9][1] == 1) and (lastA[9][1] == 7)) { 1888 MidiSend(noteOff1, 1889 86, velocity); 1890 lastA[9][1] = 0; 1891 } 1892 1893 //A87 1894 if ((keysA[9][2] 1895 == 0) and (lastA[9][2] == 0)) { 1896 MidiSend(noteOn1, 87, velocity); 1897 lastA[9][2] 1898 = 7; 1899 } 1900 //Write Midi Note Off 1901 if ((keysA[9][2] == 1) and (lastA[9][2] 1902 == 7)) { 1903 MidiSend(noteOff1, 87, velocity); 1904 lastA[9][2] = 0; 1905 } 1906 1907 1908 //A88 1909 if ((keysA[9][3] == 0) and (lastA[9][3] == 0)) { 1910 MidiSend(noteOn1, 1911 88, velocity); 1912 lastA[9][3] = 7; 1913 } 1914 //Write Midi Note Off 1915 if 1916 ((keysA[9][3] == 1) and (lastA[9][3] == 7)) { 1917 MidiSend(noteOff1, 88, velocity); 1918 1919 lastA[9][3] = 0; 1920 } 1921 1922 //A89 1923 if ((keysA[9][4] == 0) and (lastA[9][4] 1924 == 0)) { 1925 MidiSend(noteOn1, 89, velocity); 1926 lastA[9][4] = 7; 1927 } 1928 1929 //Write Midi Note Off 1930 if ((keysA[9][4] == 1) and (lastA[9][4] == 7)) { 1931 1932 MidiSend(noteOff1, 89, velocity); 1933 lastA[9][4] = 0; 1934 } 1935 1936 //A90 1937 1938 if ((keysA[9][5] == 0) and (lastA[9][5] == 0)) { 1939 MidiSend(noteOn1, 90, 1940 velocity); 1941 lastA[9][5] = 7; 1942 } 1943 //Write Midi Note Off 1944 if ((keysA[9][5] 1945 == 1) and (lastA[9][5] == 7)) { 1946 MidiSend(noteOff1, 90, velocity); 1947 lastA[9][5] 1948 = 0; 1949 } 1950 1951 //A91 1952 if ((keysA[10][0] == 0) and (lastA[10][0] == 0)) 1953 { 1954 MidiSend(noteOn1, 91, velocity); 1955 lastA[10][0] = 7; 1956 } 1957 //Write 1958 Midi Note Off 1959 if ((keysA[10][0] == 1) and (lastA[10][0] == 7)) { 1960 MidiSend(noteOff1, 1961 91, velocity); 1962 lastA[10][0] = 0; 1963 } 1964 1965 //A92 1966 if ((keysA[10][1] 1967 == 0) and (lastA[10][1] == 0)) { 1968 MidiSend(noteOn1, 92, velocity); 1969 lastA[10][1] 1970 = 7; 1971 } 1972 //Write Midi Note Off 1973 if ((keysA[10][1] == 1) and (lastA[10][1] 1974 == 7)) { 1975 MidiSend(noteOff1, 92, velocity); 1976 lastA[10][1] = 0; 1977 } 1978 1979 1980 //A93 1981 if ((keysA[10][2] == 0) and (lastA[10][2] == 0)) { 1982 MidiSend(noteOn1, 1983 93, velocity); 1984 lastA[10][2] = 7; 1985 } 1986 //Write Midi Note Off 1987 if 1988 ((keysA[10][2] == 1) and (lastA[10][2] == 7)) { 1989 MidiSend(noteOff1, 93, velocity); 1990 1991 lastA[10][2] = 0; 1992 } 1993 1994 //A94 1995 if ((keysA[10][3] == 0) and (lastA[10][3] 1996 == 0)) { 1997 MidiSend(noteOn1, 94, velocity); 1998 lastA[10][3] = 7; 1999 } 2000 2001 //Write Midi Note Off 2002 if ((keysA[10][3] == 1) and (lastA[10][3] == 7)) { 2003 2004 MidiSend(noteOff1, 94, velocity); 2005 lastA[10][3] = 0; 2006 } 2007 2008 //A95 2009 2010 if ((keysA[10][4] == 0) and (lastA[10][4] == 0)) { 2011 MidiSend(noteOn1, 95, 2012 velocity); 2013 lastA[10][4] = 7; 2014 } 2015 //Write Midi Note Off 2016 if ((keysA[10][4] 2017 == 1) and (lastA[10][4] == 7)) { 2018 MidiSend(noteOff1, 95, velocity); 2019 lastA[10][4] 2020 = 0; 2021 } 2022 2023 //A96 2024 if ((keysA[10][5] == 0) and (lastA[10][5] == 0)) 2025 { 2026 MidiSend(noteOn1, 96, velocity); 2027 lastA[10][5] = 7; 2028 } 2029 //Write 2030 Midi Note Off 2031 if ((keysA[10][5] == 1) and (lastA[10][5] == 7)) { 2032 MidiSend(noteOff1, 2033 96, velocity); 2034 lastA[10][5] = 0; 2035 } 2036 2037 //Write Keyboard B 2038 2039 2040 //B36 2041 if ((keysB[0][0] == 0) and (lastB[0][0] == 0)) { 2042 MidiSend(noteOn2, 2043 36, velocity); 2044 lastB[0][0] = 7; 2045 } 2046 if ((keysB[0][0] == 1) and (lastB[0][0] 2047 == 7)) { 2048 MidiSend(noteOff2, 36, velocity); 2049 lastB[0][0] = 0; 2050 } 2051 2052 2053 //B37 2054 if ((keysB[1][0] == 0) and (lastB[1][0] == 0)) { 2055 MidiSend(noteOn2, 2056 37, velocity); 2057 lastB[1][0] = 7; 2058 } 2059 if ((keysB[1][0] == 1) and (lastB[1][0] 2060 == 7)) { 2061 MidiSend(noteOff2, 37, velocity); 2062 lastB[1][0] = 0; 2063 } 2064 2065 2066 //B38 2067 if ((keysB[1][1] == 0) and (lastB[1][1] == 0)) { 2068 MidiSend(noteOn2, 2069 38, velocity); 2070 lastB[1][1] = 7; 2071 } 2072 //Write Midi Note Off 2073 if 2074 ((keysB[1][1] == 1) and (lastB[1][1] == 7)) { 2075 MidiSend(noteOff2, 38, velocity); 2076 2077 lastB[1][1] = 0; 2078 } 2079 2080 //B39 2081 if ((keysB[1][2] == 0) and (lastB[1][2] 2082 == 0)) { 2083 MidiSend(noteOn2, 39, velocity); 2084 lastB[1][2] = 7; 2085 } 2086 2087 //Write Midi Note Off 2088 if ((keysB[1][2] == 1) and (lastB[1][2] == 7)) { 2089 2090 MidiSend(noteOff2, 39, velocity); 2091 lastB[1][2] = 0; 2092 } 2093 2094 //B40 2095 2096 if ((keysB[1][3] == 0) and (lastB[1][3] == 0)) { 2097 MidiSend(noteOn2, 40, 2098 velocity); 2099 lastB[1][3] = 7; 2100 } 2101 //Write Midi Note Off 2102 if ((keysB[1][3] 2103 == 1) and (lastB[1][3] == 7)) { 2104 MidiSend(noteOff2, 40, velocity); 2105 lastB[1][3] 2106 = 0; 2107 } 2108 2109 //B41 2110 if ((keysB[1][4] == 0) and (lastB[1][4] == 0)) { 2111 2112 MidiSend(noteOn2, 41, velocity); 2113 lastB[1][4] = 7; 2114 } 2115 //Write 2116 Midi Note Off 2117 if ((keysB[1][4] == 1) and (lastB[1][4] == 7)) { 2118 MidiSend(noteOff2, 2119 41, velocity); 2120 lastB[1][4] = 0; 2121 } 2122 2123 //B42 2124 if ((keysB[1][5] 2125 == 0) and (lastB[1][5] == 0)) { 2126 MidiSend(noteOn2, 42, velocity); 2127 lastB[1][5] 2128 = 7; 2129 } 2130 //Write Midi Note Off 2131 if ((keysB[1][5] == 1) and (lastB[1][5] 2132 == 7)) { 2133 MidiSend(noteOff2, 42, velocity); 2134 lastB[1][5] = 0; 2135 } 2136 2137 2138 //B43 2139 if ((keysB[2][0] == 0) and (lastB[2][0] == 0)) { 2140 MidiSend(noteOn2, 2141 43, velocity); 2142 lastB[2][0] = 7; 2143 } 2144 //Write Midi Note Off 2145 if 2146 ((keysB[2][0] == 1) and (lastB[2][0] == 7)) { 2147 MidiSend(noteOff2, 43, velocity); 2148 2149 lastB[2][0] = 0; 2150 } 2151 2152 //B44 2153 if ((keysB[2][1] == 0) and (lastB[2][1] 2154 == 0)) { 2155 MidiSend(noteOn2, 44, velocity); 2156 lastB[2][1] = 7; 2157 } 2158 2159 //Write Midi Note Off 2160 if ((keysB[2][1] == 1) and (lastB[2][1] == 7)) { 2161 2162 MidiSend(noteOff2, 44, velocity); 2163 lastB[2][1] = 0; 2164 } 2165 2166 //B45 2167 2168 if ((keysB[2][2] == 0) and (lastB[2][2] == 0)) { 2169 MidiSend(noteOn2, 45, 2170 velocity); 2171 lastB[2][2] = 7; 2172 } 2173 //Write Midi Note Off 2174 if ((keysB[2][2] 2175 == 1) and (lastB[2][2] == 7)) { 2176 MidiSend(noteOff2, 45, velocity); 2177 lastB[2][2] 2178 = 0; 2179 } 2180 2181 //B46 2182 if ((keysB[2][3] == 0) and (lastB[2][3] == 0)) { 2183 2184 MidiSend(noteOn2, 46, velocity); 2185 lastB[2][3] = 7; 2186 } 2187 //Write 2188 Midi Note Off 2189 if ((keysB[2][3] == 1) and (lastB[2][3] == 7)) { 2190 MidiSend(noteOff2, 2191 46, velocity); 2192 lastB[2][3] = 0; 2193 } 2194 2195 //B47 2196 if ((keysB[2][4] 2197 == 0) and (lastB[2][4] == 0)) { 2198 MidiSend(noteOn2, 47, velocity); 2199 lastB[2][4] 2200 = 7; 2201 } 2202 //Write Midi Note Off 2203 if ((keysB[2][4] == 1) and (lastB[2][4] 2204 == 7)) { 2205 MidiSend(noteOff2, 47, velocity); 2206 lastB[2][4] = 0; 2207 } 2208 2209 2210 //B48 2211 if ((keysB[2][5] == 0) and (lastB[2][5] == 0)) { 2212 MidiSend(noteOn2, 2213 48, velocity); 2214 lastB[2][5] = 7; 2215 } 2216 //Write Midi Note Off 2217 if 2218 ((keysB[2][5] == 1) and (lastB[2][5] == 7)) { 2219 MidiSend(noteOff2, 48, velocity); 2220 2221 lastB[2][5] = 0; 2222 } 2223 2224 //B49 2225 if ((keysB[3][0] == 0) and (lastB[3][0] 2226 == 0)) { 2227 MidiSend(noteOn2, 49, velocity); 2228 lastB[3][0] = 7; 2229 } 2230 2231 //Write Midi Note Off 2232 if ((keysB[3][0] == 1) and (lastB[3][0] == 7)) { 2233 2234 MidiSend(noteOff2, 49, velocity); 2235 lastB[3][0] = 0; 2236 } 2237 2238 //B50 2239 2240 if ((keysB[3][1] == 0) and (lastB[3][1] == 0)) { 2241 MidiSend(noteOn2, 50, 2242 velocity); 2243 lastB[3][1] = 7; 2244 } 2245 //Write Midi Note Off 2246 if ((keysB[3][1] 2247 == 1) and (lastB[3][1] == 7)) { 2248 MidiSend(noteOff2, 50, velocity); 2249 lastB[3][1] 2250 = 0; 2251 } 2252 2253 //B51 2254 if ((keysB[3][2] == 0) and (lastB[3][2] == 0)) { 2255 2256 MidiSend(noteOn2, 51, velocity); 2257 lastB[3][2] = 7; 2258 } 2259 //Write 2260 Midi Note Off 2261 if ((keysB[3][2] == 1) and (lastB[3][2] == 7)) { 2262 MidiSend(noteOff2, 2263 51, velocity); 2264 lastB[3][2] = 0; 2265 } 2266 2267 //B52 2268 if ((keysB[3][3] 2269 == 0) and (lastB[3][3] == 0)) { 2270 MidiSend(noteOn2, 52, velocity); 2271 lastB[3][3] 2272 = 7; 2273 } 2274 //Write Midi Note Off 2275 if ((keysB[3][3] == 1) and (lastB[3][3] 2276 == 7)) { 2277 MidiSend(noteOff2, 52, velocity); 2278 lastB[3][3] = 0; 2279 } 2280 2281 2282 //B53 2283 if ((keysB[3][4] == 0) and (lastB[3][4] == 0)) { 2284 MidiSend(noteOn2, 2285 53, velocity); 2286 lastB[3][4] = 7; 2287 } 2288 //Write Midi Note Off 2289 if 2290 ((keysB[3][4] == 1) and (lastB[3][4] == 7)) { 2291 MidiSend(noteOff2, 53, velocity); 2292 2293 lastB[3][4] = 0; 2294 } 2295 2296 //B54 2297 if ((keysB[3][5] == 0) and (lastB[3][5] 2298 == 0)) { 2299 MidiSend(noteOn2, 54, velocity); 2300 lastB[3][5] = 7; 2301 } 2302 2303 //Write Midi Note Off 2304 if ((keysB[3][5] == 1) and (lastB[3][5] == 7)) { 2305 2306 MidiSend(noteOff2, 54, velocity); 2307 lastB[3][5] = 0; 2308 } 2309 2310 //B55 2311 2312 if ((keysB[4][0] == 0) and (lastB[4][0] == 0)) { 2313 MidiSend(noteOn2, 55, 2314 velocity); 2315 lastB[4][0] = 7; 2316 } 2317 //Write Midi Note Off 2318 if ((keysB[4][0] 2319 == 1) and (lastB[4][0] == 7)) { 2320 MidiSend(noteOff2, 55, velocity); 2321 lastB[4][0] 2322 = 0; 2323 } 2324 2325 //B56 2326 if ((keysB[4][1] == 0) and (lastB[4][1] == 0)) { 2327 2328 MidiSend(noteOn2, 56, velocity); 2329 lastB[4][1] = 7; 2330 } 2331 //Write 2332 Midi Note Off 2333 if ((keysB[4][1] == 1) and (lastB[4][1] == 7)) { 2334 MidiSend(noteOff2, 2335 56, velocity); 2336 lastB[4][1] = 0; 2337 } 2338 2339 //B57 2340 if ((keysB[4][2] 2341 == 0) and (lastB[4][2] == 0)) { 2342 MidiSend(noteOn2, 57, velocity); 2343 lastB[4][2] 2344 = 7; 2345 } 2346 //Write Midi Note Off 2347 if ((keysB[4][2] == 1) and (lastB[4][2] 2348 == 7)) { 2349 MidiSend(noteOff2, 57, velocity); 2350 lastB[4][2] = 0; 2351 } 2352 2353 2354 //B58 2355 if ((keysB[4][3] == 0) and (lastB[4][3] == 0)) { 2356 MidiSend(noteOn2, 2357 58, velocity); 2358 lastB[4][3] = 7; 2359 } 2360 //Write Midi Note Off 2361 if 2362 ((keysB[4][3] == 1) and (lastB[4][3] == 7)) { 2363 MidiSend(noteOff2, 58, velocity); 2364 2365 lastB[4][3] = 0; 2366 } 2367 2368 //B59 2369 if ((keysB[4][4] == 0) and (lastB[4][4] 2370 == 0)) { 2371 MidiSend(noteOn2, 59, velocity); 2372 lastB[4][4] = 7; 2373 } 2374 2375 //Write Midi Note Off 2376 if ((keysB[4][4] == 1) and (lastB[4][4] == 7)) { 2377 2378 MidiSend(noteOff2, 59, velocity); 2379 lastB[4][4] = 0; 2380 } 2381 2382 //B60 2383 2384 if ((keysB[4][5] == 0) and (lastB[4][5] == 0)) { 2385 MidiSend(noteOn2, 60, 2386 velocity); 2387 lastB[4][5] = 7; 2388 } 2389 //Write Midi Note Off 2390 if ((keysB[4][5] 2391 == 1) and (lastB[4][5] == 7)) { 2392 MidiSend(noteOff2, 60, velocity); 2393 lastB[4][5] 2394 = 0; 2395 } 2396 2397 //B61 2398 if ((keysB[5][0] == 0) and (lastB[5][0] == 0)) { 2399 2400 MidiSend(noteOn2, 61, velocity); 2401 lastB[5][0] = 7; 2402 } 2403 //Write 2404 Midi Note Off 2405 if ((keysB[5][0] == 1) and (lastB[5][0] == 7)) { 2406 MidiSend(noteOff2, 2407 61, velocity); 2408 lastB[5][0] = 0; 2409 } 2410 2411 //B62 2412 if ((keysB[5][1] 2413 == 0) and (lastB[5][1] == 0)) { 2414 MidiSend(noteOn2, 62, velocity); 2415 lastB[5][1] 2416 = 7; 2417 } 2418 //Write Midi Note Off 2419 if ((keysB[5][1] == 1) and (lastB[5][1] 2420 == 7)) { 2421 MidiSend(noteOff2, 62, velocity); 2422 lastB[5][1] = 0; 2423 } 2424 2425 2426 //B63 2427 if ((keysB[5][2] == 0) and (lastB[5][2] == 0)) { 2428 MidiSend(noteOn2, 2429 63, velocity); 2430 lastB[5][2] = 7; 2431 } 2432 //Write Midi Note Off 2433 if 2434 ((keysB[5][2] == 1) and (lastB[5][2] == 7)) { 2435 MidiSend(noteOff2, 63, velocity); 2436 2437 lastB[5][2] = 0; 2438 } 2439 2440 //B64 2441 if ((keysB[5][3] == 0) and (lastB[5][3] 2442 == 0)) { 2443 MidiSend(noteOn2, 64, velocity); 2444 lastB[5][3] = 7; 2445 } 2446 2447 //Write Midi Note Off 2448 if ((keysB[5][3] == 1) and (lastB[5][3] == 7)) { 2449 2450 MidiSend(noteOff2, 64, velocity); 2451 lastB[5][3] = 0; 2452 } 2453 2454 //B65 2455 2456 if ((keysB[5][4] == 0) and (lastB[5][4] == 0)) { 2457 MidiSend(noteOn2, 65, 2458 velocity); 2459 lastB[5][4] = 7; 2460 } 2461 //Write Midi Note Off 2462 if ((keysB[5][4] 2463 == 1) and (lastB[5][4] == 7)) { 2464 MidiSend(noteOff2, 65, velocity); 2465 lastB[5][4] 2466 = 0; 2467 } 2468 2469 //B66 2470 if ((keysB[5][5] == 0) and (lastB[5][5] == 0)) { 2471 2472 MidiSend(noteOn2, 66, velocity); 2473 lastB[5][5] = 7; 2474 } 2475 //Write 2476 Midi Note Off 2477 if ((keysB[5][5] == 1) and (lastB[5][5] == 7)) { 2478 MidiSend(noteOff2, 2479 66, velocity); 2480 lastB[5][5] = 0; 2481 } 2482 2483 //B67 2484 if ((keysB[6][0] 2485 == 0) and (lastB[6][0] == 0)) { 2486 MidiSend(noteOn2, 67, velocity); 2487 lastB[6][0] 2488 = 7; 2489 } 2490 //Write Midi Note Off 2491 if ((keysB[6][0] == 1) and (lastB[6][0] 2492 == 7)) { 2493 MidiSend(noteOff2, 67, velocity); 2494 lastB[6][0] = 0; 2495 } 2496 2497 2498 //B68 2499 if ((keysB[6][1] == 0) and (lastB[6][1] == 0)) { 2500 MidiSend(noteOn2, 2501 68, velocity); 2502 lastB[6][1] = 7; 2503 } 2504 //Write Midi Note Off 2505 if 2506 ((keysB[6][1] == 1) and (lastB[6][1] == 7)) { 2507 MidiSend(noteOff2, 68, velocity); 2508 2509 lastB[6][1] = 0; 2510 } 2511 2512 //B69 2513 if ((keysB[6][2] == 0) and (lastB[6][2] 2514 == 0)) { 2515 MidiSend(noteOn2, 69, velocity); 2516 lastB[6][2] = 7; 2517 } 2518 2519 //Write Midi Note Off 2520 if ((keysB[6][2] == 1) and (lastB[6][2] == 7)) { 2521 2522 MidiSend(noteOff2, 69, velocity); 2523 lastB[6][2] = 0; 2524 } 2525 2526 //B70 2527 2528 if ((keysB[6][3] == 0) and (lastB[6][3] == 0)) { 2529 MidiSend(noteOn2, 70, 2530 velocity); 2531 lastB[6][3] = 7; 2532 } 2533 //Write Midi Note Off 2534 if ((keysB[6][3] 2535 == 1) and (lastB[6][3] == 7)) { 2536 MidiSend(noteOff2, 70, velocity); 2537 lastB[6][3] 2538 = 0; 2539 } 2540 2541 //B71 2542 if ((keysB[6][4] == 0) and (lastB[6][4] == 0)) { 2543 2544 MidiSend(noteOn2, 71, velocity); 2545 lastB[6][4] = 7; 2546 } 2547 //Write 2548 Midi Note Off 2549 if ((keysB[6][4] == 1) and (lastB[6][4] == 7)) { 2550 MidiSend(noteOff2, 2551 71, velocity); 2552 lastB[6][4] = 0; 2553 } 2554 2555 //B72 2556 if ((keysB[6][5] 2557 == 0) and (lastB[6][5] == 0)) { 2558 MidiSend(noteOn2, 72, velocity); 2559 lastB[6][5] 2560 = 7; 2561 } 2562 //Write Midi Note Off 2563 if ((keysB[6][5] == 1) and (lastB[6][5] 2564 == 7)) { 2565 MidiSend(noteOff2, 72, velocity); 2566 lastB[6][5] = 0; 2567 } 2568 2569 2570 //B73 2571 if ((keysB[7][0] == 0) and (lastB[7][0] == 0)) { 2572 MidiSend(noteOn2, 2573 73, velocity); 2574 lastB[7][0] = 7; 2575 } 2576 //Write Midi Note Off 2577 if 2578 ((keysB[7][0] == 1) and (lastB[7][0] == 7)) { 2579 MidiSend(noteOff2, 73, velocity); 2580 2581 lastB[7][0] = 0; 2582 } 2583 2584 //B74 2585 if ((keysB[7][1] == 0) and (lastB[7][1] 2586 == 0)) { 2587 MidiSend(noteOn2, 74, velocity); 2588 lastB[7][1] = 7; 2589 } 2590 2591 //Write Midi Note Off 2592 if ((keysB[7][1] == 1) and (lastB[7][1] == 7)) { 2593 2594 MidiSend(noteOff2, 74, velocity); 2595 lastB[7][1] = 0; 2596 } 2597 2598 //B75 2599 2600 if ((keysB[7][2] == 0) and (lastB[7][2] == 0)) { 2601 MidiSend(noteOn2, 75, 2602 velocity); 2603 lastB[7][2] = 7; 2604 } 2605 //Write Midi Note Off 2606 if ((keysB[7][2] 2607 == 1) and (lastB[7][2] == 7)) { 2608 MidiSend(noteOff2, 75, velocity); 2609 lastB[7][2] 2610 = 0; 2611 } 2612 2613 //B76 2614 if ((keysB[7][3] == 0) and (lastB[7][3] == 0)) { 2615 2616 MidiSend(noteOn2, 76, velocity); 2617 lastB[7][3] = 7; 2618 } 2619 //Write 2620 Midi Note Off 2621 if ((keysB[7][3] == 1) and (lastB[7][3] == 7)) { 2622 MidiSend(noteOff2, 2623 76, velocity); 2624 lastB[7][3] = 0; 2625 } 2626 2627 //B77 2628 if ((keysB[7][4] 2629 == 0) and (lastB[7][4] == 0)) { 2630 MidiSend(noteOn2, 77, velocity); 2631 lastB[7][4] 2632 = 7; 2633 } 2634 //Write Midi Note Off 2635 if ((keysB[7][4] == 1) and (lastB[7][4] 2636 == 7)) { 2637 MidiSend(noteOff2, 77, velocity); 2638 lastB[7][4] = 0; 2639 } 2640 2641 2642 //B78 2643 if ((keysB[7][5] == 0) and (lastB[7][5] == 0)) { 2644 MidiSend(noteOn2, 2645 78, velocity); 2646 lastB[7][5] = 7; 2647 } 2648 //Write Midi Note Off 2649 if 2650 ((keysB[7][5] == 1) and (lastB[7][5] == 7)) { 2651 MidiSend(noteOff2, 78, velocity); 2652 2653 lastB[7][5] = 0; 2654 } 2655 2656 //B79 2657 if ((keysB[8][0] == 0) and (lastB[8][0] 2658 == 0)) { 2659 MidiSend(noteOn2, 79, velocity); 2660 lastB[8][0] = 7; 2661 } 2662 2663 //Write Midi Note Off 2664 if ((keysB[8][0] == 1) and (lastB[8][0] == 7)) { 2665 2666 MidiSend(noteOff2, 79, velocity); 2667 lastB[8][0] = 0; 2668 } 2669 2670 //B80 2671 2672 if ((keysB[8][1] == 0) and (lastB[8][1] == 0)) { 2673 MidiSend(noteOn2, 80, 2674 velocity); 2675 lastB[8][1] = 7; 2676 } 2677 //Write Midi Note Off 2678 if ((keysB[8][1] 2679 == 1) and (lastB[8][1] == 7)) { 2680 MidiSend(noteOff2, 80, velocity); 2681 lastB[8][1] 2682 = 0; 2683 } 2684 2685 //B81 2686 if ((keysB[8][2] == 0) and (lastB[8][2] == 0)) { 2687 2688 MidiSend(noteOn2, 81, velocity); 2689 lastB[8][2] = 7; 2690 } 2691 //Write 2692 Midi Note Off 2693 if ((keysB[8][2] == 1) and (lastB[8][2] == 7)) { 2694 MidiSend(noteOff2, 2695 81, velocity); 2696 lastB[8][2] = 0; 2697 } 2698 2699 //B82 2700 if ((keysB[8][3] 2701 == 0) and (lastB[8][3] == 0)) { 2702 MidiSend(noteOn2, 82, velocity); 2703 lastB[8][3] 2704 = 7; 2705 } 2706 //Write Midi Note Off 2707 if ((keysB[8][3] == 1) and (lastB[8][3] 2708 == 7)) { 2709 MidiSend(noteOff2, 82, velocity); 2710 lastB[8][3] = 0; 2711 } 2712 2713 2714 //B83 2715 if ((keysB[8][4] == 0) and (lastB[8][4] == 0)) { 2716 MidiSend(noteOn2, 2717 83, velocity); 2718 lastB[8][4] = 7; 2719 } 2720 //Write Midi Note Off 2721 if 2722 ((keysB[8][4] == 1) and (lastB[8][4] == 7)) { 2723 MidiSend(noteOff2, 83, velocity); 2724 2725 lastB[8][4] = 0; 2726 } 2727 2728 //B84 2729 if ((keysB[8][5] == 0) and (lastB[8][5] 2730 == 0)) { 2731 MidiSend(noteOn2, 84, velocity); 2732 lastB[8][5] = 7; 2733 } 2734 2735 //Write Midi Note Off 2736 if ((keysB[8][5] == 1) and (lastB[8][5] == 7)) { 2737 2738 MidiSend(noteOff2, 84, velocity); 2739 lastB[8][5] = 0; 2740 } 2741 2742 //B85 2743 2744 if ((keysB[9][0] == 0) and (lastB[9][0] == 0)) { 2745 MidiSend(noteOn2, 85, 2746 velocity); 2747 lastB[9][0] = 7; 2748 } 2749 //Write Midi Note Off 2750 if ((keysB[9][0] 2751 == 1) and (lastB[9][0] == 7)) { 2752 MidiSend(noteOff2, 85, velocity); 2753 lastB[9][0] 2754 = 0; 2755 } 2756 2757 //B86 2758 if ((keysB[9][1] == 0) and (lastB[9][1] == 0)) { 2759 2760 MidiSend(noteOn2, 86, velocity); 2761 lastB[9][1] = 7; 2762 } 2763 //Write 2764 Midi Note Off 2765 if ((keysB[9][1] == 1) and (lastB[9][1] == 7)) { 2766 MidiSend(noteOff2, 2767 86, velocity); 2768 lastB[9][1] = 0; 2769 } 2770 2771 //B87 2772 if ((keysB[9][2] 2773 == 0) and (lastB[9][2] == 0)) { 2774 MidiSend(noteOn2, 87, velocity); 2775 lastB[9][2] 2776 = 7; 2777 } 2778 //Write Midi Note Off 2779 if ((keysB[9][2] == 1) and (lastB[9][2] 2780 == 7)) { 2781 MidiSend(noteOff2, 87, velocity); 2782 lastB[9][2] = 0; 2783 } 2784 2785 2786 //B88 2787 if ((keysB[9][3] == 0) and (lastB[9][3] == 0)) { 2788 MidiSend(noteOn2, 2789 88, velocity); 2790 lastB[9][3] = 7; 2791 } 2792 //Write Midi Note Off 2793 if 2794 ((keysB[9][3] == 1) and (lastB[9][3] == 7)) { 2795 MidiSend(noteOff2, 88, velocity); 2796 2797 lastB[9][3] = 0; 2798 } 2799 2800 //B89 2801 if ((keysB[9][4] == 0) and (lastB[9][4] 2802 == 0)) { 2803 MidiSend(noteOn2, 89, velocity); 2804 lastB[9][4] = 7; 2805 } 2806 2807 //Write Midi Note Off 2808 if ((keysB[9][4] == 1) and (lastB[9][4] == 7)) { 2809 2810 MidiSend(noteOff2, 89, velocity); 2811 lastB[9][4] = 0; 2812 } 2813 2814 //B90 2815 2816 if ((keysB[9][5] == 0) and (lastB[9][5] == 0)) { 2817 MidiSend(noteOn2, 90, 2818 velocity); 2819 lastB[9][5] = 7; 2820 } 2821 //Write Midi Note Off 2822 if ((keysB[9][5] 2823 == 1) and (lastB[9][5] == 7)) { 2824 MidiSend(noteOff2, 90, velocity); 2825 lastB[9][5] 2826 = 0; 2827 } 2828 2829 //B91 2830 if ((keysB[10][0] == 0) and (lastB[10][0] == 0)) 2831 { 2832 MidiSend(noteOn2, 91, velocity); 2833 lastB[10][0] = 7; 2834 } 2835 //Write 2836 Midi Note Off 2837 if ((keysB[10][0] == 1) and (lastB[10][0] == 7)) { 2838 MidiSend(noteOff2, 2839 91, velocity); 2840 lastB[10][0] = 0; 2841 } 2842 2843 //B92 2844 if ((keysB[10][1] 2845 == 0) and (lastB[10][1] == 0)) { 2846 MidiSend(noteOn2, 92, velocity); 2847 lastB[10][1] 2848 = 7; 2849 } 2850 //Write Midi Note Off 2851 if ((keysB[10][1] == 1) and (lastB[10][1] 2852 == 7)) { 2853 MidiSend(noteOff2, 92, velocity); 2854 lastB[10][1] = 0; 2855 } 2856 2857 2858 //B93 2859 if ((keysB[10][2] == 0) and (lastB[10][2] == 0)) { 2860 MidiSend(noteOn2, 2861 93, velocity); 2862 lastB[10][2] = 7; 2863 } 2864 //Write Midi Note Off 2865 if 2866 ((keysB[10][2] == 1) and (lastB[10][2] == 7)) { 2867 MidiSend(noteOff2, 93, velocity); 2868 2869 lastB[10][2] = 0; 2870 } 2871 2872 //B94 2873 if ((keysB[10][3] == 0) and (lastB[10][3] 2874 == 0)) { 2875 MidiSend(noteOn2, 94, velocity); 2876 lastB[10][3] = 7; 2877 } 2878 2879 //Write Midi Note Off 2880 if ((keysB[10][3] == 1) and (lastB[10][3] == 7)) { 2881 2882 MidiSend(noteOff2, 94, velocity); 2883 lastB[10][3] = 0; 2884 } 2885 2886 //B95 2887 2888 if ((keysB[10][4] == 0) and (lastB[10][4] == 0)) { 2889 MidiSend(noteOn2, 95, 2890 velocity); 2891 lastB[10][4] = 7; 2892 } 2893 //Write Midi Note Off 2894 if ((keysB[10][4] 2895 == 1) and (lastB[10][4] == 7)) { 2896 MidiSend(noteOff2, 95, velocity); 2897 lastB[10][4] 2898 = 0; 2899 } 2900 2901 //B96 2902 if ((keysB[10][5] == 0) and (lastB[10][5] == 0)) 2903 { 2904 MidiSend(noteOn2, 96, velocity); 2905 lastB[10][5] = 7; 2906 } 2907 //Write 2908 Midi Note Off 2909 if ((keysB[10][5] == 1) and (lastB[10][5] == 7)) { 2910 MidiSend(noteOff2, 2911 96, velocity); 2912 lastB[10][5] = 0; 2913 } 2914 2915 //Write Keyboard C 2916 2917 2918 //C36 2919 if ((keysC[0][0] == 0) and (lastC[0][0] == 0)) { 2920 MidiSend(noteOn3, 2921 36, velocity); 2922 lastC[0][0] = 7; 2923 } 2924 if ((keysC[0][0] == 1) and (lastC[0][0] 2925 == 7)) { 2926 MidiSend(noteOff3, 36, velocity); 2927 lastC[0][0] = 0; 2928 } 2929 2930 2931 //C37 2932 if ((keysC[1][0] == 0) and (lastC[1][0] == 0)) { 2933 MidiSend(noteOn3, 2934 37, velocity); 2935 lastC[1][0] = 7; 2936 } 2937 if ((keysC[1][0] == 1) and (lastC[1][0] 2938 == 7)) { 2939 MidiSend(noteOff3, 37, velocity); 2940 lastC[1][0] = 0; 2941 } 2942 2943 2944 //C38 2945 if ((keysC[1][1] == 0) and (lastC[1][1] == 0)) { 2946 MidiSend(noteOn3, 2947 38, velocity); 2948 lastC[1][1] = 7; 2949 } 2950 //Write Midi Note Off 2951 if 2952 ((keysC[1][1] == 1) and (lastC[1][1] == 7)) { 2953 MidiSend(noteOff3, 38, velocity); 2954 2955 lastC[1][1] = 0; 2956 } 2957 2958 //C39 2959 if ((keysC[1][2] == 0) and (lastC[1][2] 2960 == 0)) { 2961 MidiSend(noteOn3, 39, velocity); 2962 lastC[1][2] = 7; 2963 } 2964 2965 //Write Midi Note Off 2966 if ((keysC[1][2] == 1) and (lastC[1][2] == 7)) { 2967 2968 MidiSend(noteOff3, 39, velocity); 2969 lastC[1][2] = 0; 2970 } 2971 2972 //C40 2973 2974 if ((keysC[1][3] == 0) and (lastC[1][3] == 0)) { 2975 MidiSend(noteOn3, 40, 2976 velocity); 2977 lastC[1][3] = 7; 2978 } 2979 //Write Midi Note Off 2980 if ((keysC[1][3] 2981 == 1) and (lastC[1][3] == 7)) { 2982 MidiSend(noteOff3, 40, velocity); 2983 lastC[1][3] 2984 = 0; 2985 } 2986 2987 //C41 2988 if ((keysC[1][4] == 0) and (lastC[1][4] == 0)) { 2989 2990 MidiSend(noteOn3, 41, velocity); 2991 lastC[1][4] = 7; 2992 } 2993 //Write 2994 Midi Note Off 2995 if ((keysC[1][4] == 1) and (lastC[1][4] == 7)) { 2996 MidiSend(noteOff3, 2997 41, velocity); 2998 lastC[1][4] = 0; 2999 } 3000 3001 //C42 3002 if ((keysC[1][5] 3003 == 0) and (lastC[1][5] == 0)) { 3004 MidiSend(noteOn3, 42, velocity); 3005 lastC[1][5] 3006 = 7; 3007 } 3008 //Write Midi Note Off 3009 if ((keysC[1][5] == 1) and (lastC[1][5] 3010 == 7)) { 3011 MidiSend(noteOff3, 42, velocity); 3012 lastC[1][5] = 0; 3013 } 3014 3015 3016 //C43 3017 if ((keysC[2][0] == 0) and (lastC[2][0] == 0)) { 3018 MidiSend(noteOn3, 3019 43, velocity); 3020 lastC[2][0] = 7; 3021 } 3022 //Write Midi Note Off 3023 if 3024 ((keysC[2][0] == 1) and (lastC[2][0] == 7)) { 3025 MidiSend(noteOff3, 43, velocity); 3026 3027 lastC[2][0] = 0; 3028 } 3029 3030 //C44 3031 if ((keysC[2][1] == 0) and (lastC[2][1] 3032 == 0)) { 3033 MidiSend(noteOn3, 44, velocity); 3034 lastC[2][1] = 7; 3035 } 3036 3037 //Write Midi Note Off 3038 if ((keysC[2][1] == 1) and (lastC[2][1] == 7)) { 3039 3040 MidiSend(noteOff3, 44, velocity); 3041 lastC[2][1] = 0; 3042 } 3043 3044 //B45 3045 3046 if ((keysC[2][2] == 0) and (lastC[2][2] == 0)) { 3047 MidiSend(noteOn3, 45, 3048 velocity); 3049 lastC[2][2] = 7; 3050 } 3051 //Write Midi Note Off 3052 if ((keysC[2][2] 3053 == 1) and (lastC[2][2] == 7)) { 3054 MidiSend(noteOff3, 45, velocity); 3055 lastC[2][2] 3056 = 0; 3057 } 3058 3059 //C46 3060 if ((keysC[2][3] == 0) and (lastC[2][3] == 0)) { 3061 3062 MidiSend(noteOn3, 46, velocity); 3063 lastC[2][3] = 7; 3064 } 3065 //Write 3066 Midi Note Off 3067 if ((keysC[2][3] == 1) and (lastC[2][3] == 7)) { 3068 MidiSend(noteOff3, 3069 46, velocity); 3070 lastC[2][3] = 0; 3071 } 3072 3073 //C47 3074 if ((keysC[2][4] 3075 == 0) and (lastC[2][4] == 0)) { 3076 MidiSend(noteOn3, 47, velocity); 3077 lastC[2][4] 3078 = 7; 3079 } 3080 //Write Midi Note Off 3081 if ((keysC[2][4] == 1) and (lastC[2][4] 3082 == 7)) { 3083 MidiSend(noteOff3, 47, velocity); 3084 lastC[2][4] = 0; 3085 } 3086 3087 3088 //C48 3089 if ((keysC[2][5] == 0) and (lastC[2][5] == 0)) { 3090 MidiSend(noteOn3, 3091 48, velocity); 3092 lastC[2][5] = 7; 3093 } 3094 //Write Midi Note Off 3095 if 3096 ((keysC[2][5] == 1) and (lastC[2][5] == 7)) { 3097 MidiSend(noteOff3, 48, velocity); 3098 3099 lastC[2][5] = 0; 3100 } 3101 3102 //C49 3103 if ((keysC[3][0] == 0) and (lastC[3][0] 3104 == 0)) { 3105 MidiSend(noteOn3, 49, velocity); 3106 lastC[3][0] = 7; 3107 } 3108 3109 //Write Midi Note Off 3110 if ((keysC[3][0] == 1) and (lastC[3][0] == 7)) { 3111 3112 MidiSend(noteOff3, 49, velocity); 3113 lastC[3][0] = 0; 3114 } 3115 3116 //C50 3117 3118 if ((keysC[3][1] == 0) and (lastC[3][1] == 0)) { 3119 MidiSend(noteOn3, 50, 3120 velocity); 3121 lastC[3][1] = 7; 3122 } 3123 //Write Midi Note Off 3124 if ((keysC[3][1] 3125 == 1) and (lastC[3][1] == 7)) { 3126 MidiSend(noteOff3, 50, velocity); 3127 lastC[3][1] 3128 = 0; 3129 } 3130 3131 //C51 3132 if ((keysC[3][2] == 0) and (lastC[3][2] == 0)) { 3133 3134 MidiSend(noteOn3, 51, velocity); 3135 lastC[3][2] = 7; 3136 } 3137 //Write 3138 Midi Note Off 3139 if ((keysC[3][2] == 1) and (lastC[3][2] == 7)) { 3140 MidiSend(noteOff3, 3141 51, velocity); 3142 lastC[3][2] = 0; 3143 } 3144 3145 //C52 3146 if ((keysC[3][3] 3147 == 0) and (lastC[3][3] == 0)) { 3148 MidiSend(noteOn3, 52, velocity); 3149 lastC[3][3] 3150 = 7; 3151 } 3152 //Write Midi Note Off 3153 if ((keysC[3][3] == 1) and (lastC[3][3] 3154 == 7)) { 3155 MidiSend(noteOff3, 52, velocity); 3156 lastC[3][3] = 0; 3157 } 3158 3159 3160 //C53 3161 if ((keysC[3][4] == 0) and (lastC[3][4] == 0)) { 3162 MidiSend(noteOn3, 3163 53, velocity); 3164 lastC[3][4] = 7; 3165 } 3166 //Write Midi Note Off 3167 if 3168 ((keysC[3][4] == 1) and (lastC[3][4] == 7)) { 3169 MidiSend(noteOff3, 53, velocity); 3170 3171 lastC[3][4] = 0; 3172 } 3173 3174 //C54 3175 if ((keysC[3][5] == 0) and (lastC[3][5] 3176 == 0)) { 3177 MidiSend(noteOn3, 54, velocity); 3178 lastC[3][5] = 7; 3179 } 3180 3181 //Write Midi Note Off 3182 if ((keysC[3][5] == 1) and (lastC[3][5] == 7)) { 3183 3184 MidiSend(noteOff3, 54, velocity); 3185 lastC[3][5] = 0; 3186 } 3187 3188 //C55 3189 3190 if ((keysC[4][0] == 0) and (lastC[4][0] == 0)) { 3191 MidiSend(noteOn3, 55, 3192 velocity); 3193 lastC[4][0] = 7; 3194 } 3195 //Write Midi Note Off 3196 if ((keysC[4][0] 3197 == 1) and (lastC[4][0] == 7)) { 3198 MidiSend(noteOff3, 55, velocity); 3199 lastC[4][0] 3200 = 0; 3201 } 3202 3203 //C56 3204 if ((keysC[4][1] == 0) and (lastC[4][1] == 0)) { 3205 3206 MidiSend(noteOn3, 56, velocity); 3207 lastC[4][1] = 7; 3208 } 3209 //Write 3210 Midi Note Off 3211 if ((keysC[4][1] == 1) and (lastC[4][1] == 7)) { 3212 MidiSend(noteOff3, 3213 56, velocity); 3214 lastC[4][1] = 0; 3215 } 3216 3217 //C57 3218 if ((keysC[4][2] 3219 == 0) and (lastC[4][2] == 0)) { 3220 MidiSend(noteOn3, 57, velocity); 3221 lastC[4][2] 3222 = 7; 3223 } 3224 //Write Midi Note Off 3225 if ((keysC[4][2] == 1) and (lastC[4][2] 3226 == 7)) { 3227 MidiSend(noteOff3, 57, velocity); 3228 lastC[4][2] = 0; 3229 } 3230 3231 3232 //C58 3233 if ((keysC[4][3] == 0) and (lastC[4][3] == 0)) { 3234 MidiSend(noteOn3, 3235 58, velocity); 3236 lastC[4][3] = 7; 3237 } 3238 //Write Midi Note Off 3239 if 3240 ((keysC[4][3] == 1) and (lastC[4][3] == 7)) { 3241 MidiSend(noteOff3, 58, velocity); 3242 3243 lastC[4][3] = 0; 3244 } 3245 3246 //C59 3247 if ((keysC[4][4] == 0) and (lastC[4][4] 3248 == 0)) { 3249 MidiSend(noteOn3, 59, velocity); 3250 lastC[4][4] = 7; 3251 } 3252 3253 //Write Midi Note Off 3254 if ((keysC[4][4] == 1) and (lastC[4][4] == 7)) { 3255 3256 MidiSend(noteOff3, 59, velocity); 3257 lastC[4][4] = 0; 3258 } 3259 3260 //C60 3261 3262 if ((keysC[4][5] == 0) and (lastC[4][5] == 0)) { 3263 MidiSend(noteOn3, 60, 3264 velocity); 3265 lastC[4][5] = 7; 3266 } 3267 //Write Midi Note Off 3268 if ((keysC[4][5] 3269 == 1) and (lastC[4][5] == 7)) { 3270 MidiSend(noteOff3, 60, velocity); 3271 lastC[4][5] 3272 = 0; 3273 } 3274 3275 //C61 3276 if ((keysC[5][0] == 0) and (lastC[5][0] == 0)) { 3277 3278 MidiSend(noteOn3, 61, velocity); 3279 lastC[5][0] = 7; 3280 } 3281 //Write 3282 Midi Note Off 3283 if ((keysC[5][0] == 1) and (lastC[5][0] == 7)) { 3284 MidiSend(noteOff3, 3285 61, velocity); 3286 lastC[5][0] = 0; 3287 } 3288 3289 //C62 3290 if ((keysC[5][1] 3291 == 0) and (lastC[5][1] == 0)) { 3292 MidiSend(noteOn3, 62, velocity); 3293 lastC[5][1] 3294 = 7; 3295 } 3296 //Write Midi Note Off 3297 if ((keysC[5][1] == 1) and (lastC[5][1] 3298 == 7)) { 3299 MidiSend(noteOff3, 62, velocity); 3300 lastC[5][1] = 0; 3301 } 3302 3303 3304 //C63 3305 if ((keysC[5][2] == 0) and (lastC[5][2] == 0)) { 3306 MidiSend(noteOn3, 3307 63, velocity); 3308 lastC[5][2] = 7; 3309 } 3310 //Write Midi Note Off 3311 if 3312 ((keysC[5][2] == 1) and (lastC[5][2] == 7)) { 3313 MidiSend(noteOff3, 63, velocity); 3314 3315 lastC[5][2] = 0; 3316 } 3317 3318 //C64 3319 if ((keysC[5][3] == 0) and (lastC[5][3] 3320 == 0)) { 3321 MidiSend(noteOn3, 64, velocity); 3322 lastC[5][3] = 7; 3323 } 3324 3325 //Write Midi Note Off 3326 if ((keysC[5][3] == 1) and (lastC[5][3] == 7)) { 3327 3328 MidiSend(noteOff3, 64, velocity); 3329 lastC[5][3] = 0; 3330 } 3331 3332 //C65 3333 3334 if ((keysC[5][4] == 0) and (lastC[5][4] == 0)) { 3335 MidiSend(noteOn3, 65, 3336 velocity); 3337 lastC[5][4] = 7; 3338 } 3339 //Write Midi Note Off 3340 if ((keysC[5][4] 3341 == 1) and (lastC[5][4] == 7)) { 3342 MidiSend(noteOff3, 65, velocity); 3343 lastC[5][4] 3344 = 0; 3345 } 3346 3347 //C66 3348 if ((keysC[5][5] == 0) and (lastC[5][5] == 0)) { 3349 3350 MidiSend(noteOn3, 66, velocity); 3351 lastC[5][5] = 7; 3352 } 3353 //Write 3354 Midi Note Off 3355 if ((keysC[5][5] == 1) and (lastC[5][5] == 7)) { 3356 MidiSend(noteOff3, 3357 66, velocity); 3358 lastC[5][5] = 0; 3359 } 3360 3361 //C67 3362 if ((keysC[6][0] 3363 == 0) and (lastC[6][0] == 0)) { 3364 MidiSend(noteOn3, 67, velocity); 3365 lastC[6][0] 3366 = 7; 3367 } 3368 //Write Midi Note Off 3369 if ((keysC[6][0] == 1) and (lastC[6][0] 3370 == 7)) { 3371 MidiSend(noteOff3, 67, velocity); 3372 lastC[6][0] = 0; 3373 } 3374 3375 3376 //C68 3377 if ((keysC[6][1] == 0) and (lastC[6][1] == 0)) { 3378 MidiSend(noteOn3, 3379 68, velocity); 3380 lastC[6][1] = 7; 3381 } 3382 //Write Midi Note Off 3383 if 3384 ((keysC[6][1] == 1) and (lastC[6][1] == 7)) { 3385 MidiSend(noteOff3, 68, velocity); 3386 3387 lastC[6][1] = 0; 3388 } 3389 3390 //C69 3391 if ((keysC[6][2] == 0) and (lastC[6][2] 3392 == 0)) { 3393 MidiSend(noteOn3, 69, velocity); 3394 lastC[6][2] = 7; 3395 } 3396 3397 //Write Midi Note Off 3398 if ((keysC[6][2] == 1) and (lastC[6][2] == 7)) { 3399 3400 MidiSend(noteOff3, 69, velocity); 3401 lastC[6][2] = 0; 3402 } 3403 3404 //C70 3405 3406 if ((keysC[6][3] == 0) and (lastC[6][3] == 0)) { 3407 MidiSend(noteOn3, 70, 3408 velocity); 3409 lastC[6][3] = 7; 3410 } 3411 //Write Midi Note Off 3412 if ((keysC[6][3] 3413 == 1) and (lastC[6][3] == 7)) { 3414 MidiSend(noteOff3, 70, velocity); 3415 lastC[6][3] 3416 = 0; 3417 } 3418 3419 //C71 3420 if ((keysC[6][4] == 0) and (lastC[6][4] == 0)) { 3421 3422 MidiSend(noteOn3, 71, velocity); 3423 lastC[6][4] = 7; 3424 } 3425 //Write 3426 Midi Note Off 3427 if ((keysC[6][4] == 1) and (lastC[6][4] == 7)) { 3428 MidiSend(noteOff3, 3429 71, velocity); 3430 lastC[6][4] = 0; 3431 } 3432 3433 //C72 3434 if ((keysC[6][5] 3435 == 0) and (lastC[6][5] == 0)) { 3436 MidiSend(noteOn3, 72, velocity); 3437 lastC[6][5] 3438 = 7; 3439 } 3440 //Write Midi Note Off 3441 if ((keysC[6][5] == 1) and (lastC[6][5] 3442 == 7)) { 3443 MidiSend(noteOff3, 72, velocity); 3444 lastC[6][5] = 0; 3445 } 3446 3447 3448 //C73 3449 if ((keysC[7][0] == 0) and (lastC[7][0] == 0)) { 3450 MidiSend(noteOn3, 3451 73, velocity); 3452 lastC[7][0] = 7; 3453 } 3454 //Write Midi Note Off 3455 if 3456 ((keysC[7][0] == 1) and (lastC[7][0] == 7)) { 3457 MidiSend(noteOff3, 73, velocity); 3458 3459 lastC[7][0] = 0; 3460 } 3461 3462 //C74 3463 if ((keysC[7][1] == 0) and (lastC[7][1] 3464 == 0)) { 3465 MidiSend(noteOn3, 74, velocity); 3466 lastC[7][1] = 7; 3467 } 3468 3469 //Write Midi Note Off 3470 if ((keysC[7][1] == 1) and (lastC[7][1] == 7)) { 3471 3472 MidiSend(noteOff3, 74, velocity); 3473 lastC[7][1] = 0; 3474 } 3475 3476 //C75 3477 3478 if ((keysC[7][2] == 0) and (lastC[7][2] == 0)) { 3479 MidiSend(noteOn3, 75, 3480 velocity); 3481 lastC[7][2] = 7; 3482 } 3483 //Write Midi Note Off 3484 if ((keysC[7][2] 3485 == 1) and (lastC[7][2] == 7)) { 3486 MidiSend(noteOff3, 75, velocity); 3487 lastC[7][2] 3488 = 0; 3489 } 3490 3491 //C76 3492 if ((keysC[7][3] == 0) and (lastC[7][3] == 0)) { 3493 3494 MidiSend(noteOn3, 76, velocity); 3495 lastC[7][3] = 7; 3496 } 3497 //Write 3498 Midi Note Off 3499 if ((keysC[7][3] == 1) and (lastC[7][3] == 7)) { 3500 MidiSend(noteOff3, 3501 76, velocity); 3502 lastC[7][3] = 0; 3503 } 3504 3505 //C77 3506 if ((keysC[7][4] 3507 == 0) and (lastC[7][4] == 0)) { 3508 MidiSend(noteOn3, 77, velocity); 3509 lastC[7][4] 3510 = 7; 3511 } 3512 //Write Midi Note Off 3513 if ((keysC[7][4] == 1) and (lastC[7][4] 3514 == 7)) { 3515 MidiSend(noteOff3, 77, velocity); 3516 lastC[7][4] = 0; 3517 } 3518 3519 3520 //C78 3521 if ((keysC[7][5] == 0) and (lastC[7][5] == 0)) { 3522 MidiSend(noteOn3, 3523 78, velocity); 3524 lastC[7][5] = 7; 3525 } 3526 //Write Midi Note Off 3527 if 3528 ((keysC[7][5] == 1) and (lastC[7][5] == 7)) { 3529 MidiSend(noteOff3, 78, velocity); 3530 3531 lastC[7][5] = 0; 3532 } 3533 3534 //C79 3535 if ((keysC[8][0] == 0) and (lastC[8][0] 3536 == 0)) { 3537 MidiSend(noteOn3, 79, velocity); 3538 lastC[8][0] = 7; 3539 } 3540 3541 //Write Midi Note Off 3542 if ((keysC[8][0] == 1) and (lastC[8][0] == 7)) { 3543 3544 MidiSend(noteOff2, 79, velocity); 3545 lastC[8][0] = 0; 3546 } 3547 3548 //C80 3549 3550 if ((keysC[8][1] == 0) and (lastC[8][1] == 0)) { 3551 MidiSend(noteOn3, 80, 3552 velocity); 3553 lastC[8][1] = 7; 3554 } 3555 //Write Midi Note Off 3556 if ((keysC[8][1] 3557 == 1) and (lastC[8][1] == 7)) { 3558 MidiSend(noteOff3, 80, velocity); 3559 lastC[8][1] 3560 = 0; 3561 } 3562 3563 //C81 3564 if ((keysC[8][2] == 0) and (lastC[8][2] == 0)) { 3565 3566 MidiSend(noteOn3, 81, velocity); 3567 lastC[8][2] = 7; 3568 } 3569 //Write 3570 Midi Note Off 3571 if ((keysC[8][2] == 1) and (lastC[8][2] == 7)) { 3572 MidiSend(noteOff3, 3573 81, velocity); 3574 lastC[8][2] = 0; 3575 } 3576 3577 //C82 3578 if ((keysC[8][3] 3579 == 0) and (lastC[8][3] == 0)) { 3580 MidiSend(noteOn3, 82, velocity); 3581 lastC[8][3] 3582 = 7; 3583 } 3584 //Write Midi Note Off 3585 if ((keysC[8][3] == 1) and (lastC[8][3] 3586 == 7)) { 3587 MidiSend(noteOff3, 82, velocity); 3588 lastC[8][3] = 0; 3589 } 3590 3591 3592 //C83 3593 if ((keysC[8][4] == 0) and (lastC[8][4] == 0)) { 3594 MidiSend(noteOn3, 3595 83, velocity); 3596 lastC[8][4] = 7; 3597 } 3598 //Write Midi Note Off 3599 if 3600 ((keysC[8][4] == 1) and (lastC[8][4] == 7)) { 3601 MidiSend(noteOff3, 83, velocity); 3602 3603 lastC[8][4] = 0; 3604 } 3605 3606 //C84 3607 if ((keysC[8][5] == 0) and (lastC[8][5] 3608 == 0)) { 3609 MidiSend(noteOn3, 84, velocity); 3610 lastC[8][5] = 7; 3611 } 3612 3613 //Write Midi Note Off 3614 if ((keysC[8][5] == 1) and (lastC[8][5] == 7)) { 3615 3616 MidiSend(noteOff3, 84, velocity); 3617 lastC[8][5] = 0; 3618 } 3619 3620 //C85 3621 3622 if ((keysC[9][0] == 0) and (lastC[9][0] == 0)) { 3623 MidiSend(noteOn3, 85, 3624 velocity); 3625 lastC[9][0] = 7; 3626 } 3627 //Write Midi Note Off 3628 if ((keysC[9][0] 3629 == 1) and (lastC[9][0] == 7)) { 3630 MidiSend(noteOff3, 85, velocity); 3631 lastC[9][0] 3632 = 0; 3633 } 3634 3635 //C86 3636 if ((keysC[9][1] == 0) and (lastC[9][1] == 0)) { 3637 3638 MidiSend(noteOn2, 86, velocity); 3639 lastC[9][1] = 7; 3640 } 3641 //Write 3642 Midi Note Off 3643 if ((keysC[9][1] == 1) and (lastC[9][1] == 7)) { 3644 MidiSend(noteOff3, 3645 86, velocity); 3646 lastC[9][1] = 0; 3647 } 3648 3649 //C87 3650 if ((keysC[9][2] 3651 == 0) and (lastC[9][2] == 0)) { 3652 MidiSend(noteOn3, 87, velocity); 3653 lastC[9][2] 3654 = 7; 3655 } 3656 //Write Midi Note Off 3657 if ((keysC[9][2] == 1) and (lastC[9][2] 3658 == 7)) { 3659 MidiSend(noteOff3, 87, velocity); 3660 lastC[9][2] = 0; 3661 } 3662 3663 3664 //C88 3665 if ((keysC[9][3] == 0) and (lastC[9][3] == 0)) { 3666 MidiSend(noteOn3, 3667 88, velocity); 3668 lastC[9][3] = 7; 3669 } 3670 //Write Midi Note Off 3671 if 3672 ((keysC[9][3] == 1) and (lastC[9][3] == 7)) { 3673 MidiSend(noteOff3, 88, velocity); 3674 3675 lastC[9][3] = 0; 3676 } 3677 3678 //C89 3679 if ((keysC[9][4] == 0) and (lastC[9][4] 3680 == 0)) { 3681 MidiSend(noteOn3, 89, velocity); 3682 lastC[9][4] = 7; 3683 } 3684 3685 //Write Midi Note Off 3686 if ((keysC[9][4] == 1) and (lastC[9][4] == 7)) { 3687 3688 MidiSend(noteOff3, 89, velocity); 3689 lastC[9][4] = 0; 3690 } 3691 3692 //C90 3693 3694 if ((keysC[9][5] == 0) and (lastC[9][5] == 0)) { 3695 MidiSend(noteOn3, 90, 3696 velocity); 3697 lastC[9][5] = 7; 3698 } 3699 //Write Midi Note Off 3700 if ((keysC[9][5] 3701 == 1) and (lastC[9][5] == 7)) { 3702 MidiSend(noteOff3, 90, velocity); 3703 lastC[9][5] 3704 = 0; 3705 } 3706 3707 //C91 3708 if ((keysC[10][0] == 0) and (lastC[10][0] == 0)) 3709 { 3710 MidiSend(noteOn3, 91, velocity); 3711 lastC[10][0] = 7; 3712 } 3713 //Write 3714 Midi Note Off 3715 if ((keysC[10][0] == 1) and (lastC[10][0] == 7)) { 3716 MidiSend(noteOff3, 3717 91, velocity); 3718 lastC[10][0] = 0; 3719 } 3720 3721 //C92 3722 if ((keysC[10][1] 3723 == 0) and (lastC[10][1] == 0)) { 3724 MidiSend(noteOn3, 92, velocity); 3725 lastC[10][1] 3726 = 7; 3727 } 3728 //Write Midi Note Off 3729 if ((keysC[10][1] == 1) and (lastC[10][1] 3730 == 7)) { 3731 MidiSend(noteOff3, 92, velocity); 3732 lastC[10][1] = 0; 3733 } 3734 3735 3736 //C93 3737 if ((keysC[10][2] == 0) and (lastC[10][2] == 0)) { 3738 MidiSend(noteOn3, 3739 93, velocity); 3740 lastC[10][2] = 7; 3741 } 3742 //Write Midi Note Off 3743 if 3744 ((keysC[10][2] == 1) and (lastC[10][2] == 7)) { 3745 MidiSend(noteOff3, 93, velocity); 3746 3747 lastC[10][2] = 0; 3748 } 3749 3750 //C94 3751 if ((keysC[10][3] == 0) and (lastC[10][3] 3752 == 0)) { 3753 MidiSend(noteOn3, 94, velocity); 3754 lastC[10][3] = 7; 3755 } 3756 3757 //Write Midi Note Off 3758 if ((keysC[10][3] == 1) and (lastC[10][3] == 7)) { 3759 3760 MidiSend(noteOff3, 94, velocity); 3761 lastC[10][3] = 0; 3762 } 3763 3764 //C95 3765 3766 if ((keysC[10][4] == 0) and (lastC[10][4] == 0)) { 3767 MidiSend(noteOn3, 95, 3768 velocity); 3769 lastC[10][4] = 7; 3770 } 3771 //Write Midi Note Off 3772 if ((keysC[10][4] 3773 == 1) and (lastC[10][4] == 7)) { 3774 MidiSend(noteOff3, 95, velocity); 3775 lastC[10][4] 3776 = 0; 3777 } 3778 3779 //C96 3780 if ((keysC[10][5] == 0) and (lastC[10][5] == 0)) 3781 { 3782 MidiSend(noteOn3, 96, velocity); 3783 lastC[10][5] = 7; 3784 } 3785 //Write 3786 Midi Note Off 3787 if ((keysC[10][5] == 1) and (lastC[10][5] == 7)) { 3788 MidiSend(noteOff3, 3789 96, velocity); 3790 lastC[10][5] = 0; 3791 } 3792 3793 //Write Keyboard D 3794 3795 3796 //D36 3797 if ((keysD[0][0] == 0) and (lastD[0][0] == 0)) { 3798 MidiSend(noteOn4, 3799 36, velocity); 3800 lastD[0][0] = 7; 3801 } 3802 if ((keysD[0][0] == 1) and (lastD[0][0] 3803 == 7)) { 3804 MidiSend(noteOff4, 36, velocity); 3805 lastD[0][0] = 0; 3806 } 3807 3808 3809 //D37 3810 if ((keysD[1][0] == 0) and (lastD[1][0] == 0)) { 3811 MidiSend(noteOn4, 3812 37, velocity); 3813 lastD[1][0] = 7; 3814 } 3815 if ((keysD[1][0] == 1) and (lastD[1][0] 3816 == 7)) { 3817 MidiSend(noteOff4, 37, velocity); 3818 lastD[1][0] = 0; 3819 } 3820 3821 3822 //D38 3823 if ((keysD[1][1] == 0) and (lastD[1][1] == 0)) { 3824 MidiSend(noteOn4, 3825 38, velocity); 3826 lastD[1][1] = 7; 3827 } 3828 //Write Midi Note Off 3829 if 3830 ((keysD[1][1] == 1) and (lastD[1][1] == 7)) { 3831 MidiSend(noteOff4, 38, velocity); 3832 3833 lastD[1][1] = 0; 3834 } 3835 3836 //D39 3837 if ((keysD[1][2] == 0) and (lastD[1][2] 3838 == 0)) { 3839 MidiSend(noteOn4, 39, velocity); 3840 lastD[1][2] = 7; 3841 } 3842 3843 //Write Midi Note Off 3844 if ((keysD[1][2] == 1) and (lastD[1][2] == 7)) { 3845 3846 MidiSend(noteOff4, 39, velocity); 3847 lastD[1][2] = 0; 3848 } 3849 3850 //D40 3851 3852 if ((keysD[1][3] == 0) and (lastD[1][3] == 0)) { 3853 MidiSend(noteOn4, 40, 3854 velocity); 3855 lastD[1][3] = 7; 3856 } 3857 //Write Midi Note Off 3858 if ((keysD[1][3] 3859 == 1) and (lastD[1][3] == 7)) { 3860 MidiSend(noteOff4, 40, velocity); 3861 lastD[1][3] 3862 = 0; 3863 } 3864 3865 //D41 3866 if ((keysD[1][4] == 0) and (lastD[1][4] == 0)) { 3867 3868 MidiSend(noteOn4, 41, velocity); 3869 lastD[1][4] = 7; 3870 } 3871 //Write 3872 Midi Note Off 3873 if ((keysD[1][4] == 1) and (lastD[1][4] == 7)) { 3874 MidiSend(noteOff4, 3875 41, velocity); 3876 lastD[1][4] = 0; 3877 } 3878 3879 //D42 3880 if ((keysD[1][5] 3881 == 0) and (lastD[1][5] == 0)) { 3882 MidiSend(noteOn4, 42, velocity); 3883 lastD[1][5] 3884 = 7; 3885 } 3886 //Write Midi Note Off 3887 if ((keysD[1][5] == 1) and (lastD[1][5] 3888 == 7)) { 3889 MidiSend(noteOff4, 42, velocity); 3890 lastD[1][5] = 0; 3891 } 3892 3893 3894 //D43 3895 if ((keysD[2][0] == 0) and (lastD[2][0] == 0)) { 3896 MidiSend(noteOn4, 3897 43, velocity); 3898 lastD[2][0] = 7; 3899 } 3900 //Write Midi Note Off 3901 if 3902 ((keysD[2][0] == 1) and (lastD[2][0] == 7)) { 3903 MidiSend(noteOff4, 43, velocity); 3904 3905 lastD[2][0] = 0; 3906 } 3907 3908 //B44 3909 if ((keysD[2][1] == 0) and (lastD[2][1] 3910 == 0)) { 3911 MidiSend(noteOn4, 44, velocity); 3912 lastD[2][1] = 7; 3913 } 3914 3915 //Write Midi Note Off 3916 if ((keysD[2][1] == 1) and (lastD[2][1] == 7)) { 3917 3918 MidiSend(noteOff4, 44, velocity); 3919 lastD[2][1] = 0; 3920 } 3921 3922 //D45 3923 3924 if ((keysD[2][2] == 0) and (lastD[2][2] == 0)) { 3925 MidiSend(noteOn4, 45, 3926 velocity); 3927 lastD[2][2] = 7; 3928 } 3929 //Write Midi Note Off 3930 if ((keysD[2][2] 3931 == 1) and (lastD[2][2] == 7)) { 3932 MidiSend(noteOff4, 45, velocity); 3933 lastD[2][2] 3934 = 0; 3935 } 3936 3937 //D46 3938 if ((keysD[2][3] == 0) and (lastD[2][3] == 0)) { 3939 3940 MidiSend(noteOn4, 46, velocity); 3941 lastD[2][3] = 7; 3942 } 3943 //Write 3944 Midi Note Off 3945 if ((keysD[2][3] == 1) and (lastD[2][3] == 7)) { 3946 MidiSend(noteOff4, 3947 46, velocity); 3948 lastD[2][3] = 0; 3949 } 3950 3951 //D47 3952 if ((keysD[2][4] 3953 == 0) and (lastD[2][4] == 0)) { 3954 MidiSend(noteOn4, 47, velocity); 3955 lastD[2][4] 3956 = 7; 3957 } 3958 //Write Midi Note Off 3959 if ((keysD[2][4] == 1) and (lastD[2][4] 3960 == 7)) { 3961 MidiSend(noteOff4, 47, velocity); 3962 lastD[2][4] = 0; 3963 } 3964 3965 3966 //D48 3967 if ((keysD[2][5] == 0) and (lastD[2][5] == 0)) { 3968 MidiSend(noteOn4, 3969 48, velocity); 3970 lastD[2][5] = 7; 3971 } 3972 //Write Midi Note Off 3973 if 3974 ((keysD[2][5] == 1) and (lastD[2][5] == 7)) { 3975 MidiSend(noteOff4, 48, velocity); 3976 3977 lastD[2][5] = 0; 3978 } 3979 3980 //D49 3981 if ((keysD[3][0] == 0) and (lastD[3][0] 3982 == 0)) { 3983 MidiSend(noteOn4, 49, velocity); 3984 lastD[3][0] = 7; 3985 } 3986 3987 //Write Midi Note Off 3988 if ((keysD[3][0] == 1) and (lastD[3][0] == 7)) { 3989 3990 MidiSend(noteOff4, 49, velocity); 3991 lastD[3][0] = 0; 3992 } 3993 3994 //D50 3995 3996 if ((keysD[3][1] == 0) and (lastD[3][1] == 0)) { 3997 MidiSend(noteOn4, 50, 3998 velocity); 3999 lastD[3][1] = 7; 4000 } 4001 //Write Midi Note Off 4002 if ((keysD[3][1] 4003 == 1) and (lastD[3][1] == 7)) { 4004 MidiSend(noteOff4, 50, velocity); 4005 lastD[3][1] 4006 = 0; 4007 } 4008 4009 //D51 4010 if ((keysD[3][2] == 0) and (lastD[3][2] == 0)) { 4011 4012 MidiSend(noteOn4, 51, velocity); 4013 lastD[3][2] = 7; 4014 } 4015 //Write 4016 Midi Note Off 4017 if ((keysD[3][2] == 1) and (lastD[3][2] == 7)) { 4018 MidiSend(noteOff4, 4019 51, velocity); 4020 lastD[3][2] = 0; 4021 } 4022 4023 //D52 4024 if ((keysD[3][3] 4025 == 0) and (lastD[3][3] == 0)) { 4026 MidiSend(noteOn4, 52, velocity); 4027 lastD[3][3] 4028 = 7; 4029 } 4030 //Write Midi Note Off 4031 if ((keysD[3][3] == 1) and (lastD[3][3] 4032 == 7)) { 4033 MidiSend(noteOff4, 52, velocity); 4034 lastD[3][3] = 0; 4035 } 4036 4037 4038 //D53 4039 if ((keysD[3][4] == 0) and (lastD[3][4] == 0)) { 4040 MidiSend(noteOn4, 4041 53, velocity); 4042 lastD[3][4] = 7; 4043 } 4044 //Write Midi Note Off 4045 if 4046 ((keysD[3][4] == 1) and (lastD[3][4] == 7)) { 4047 MidiSend(noteOff4, 53, velocity); 4048 4049 lastD[3][4] = 0; 4050 } 4051 4052 //D54 4053 if ((keysD[3][5] == 0) and (lastD[3][5] 4054 == 0)) { 4055 MidiSend(noteOn4, 54, velocity); 4056 lastD[3][5] = 7; 4057 } 4058 4059 //Write Midi Note Off 4060 if ((keysD[3][5] == 1) and (lastD[3][5] == 7)) { 4061 4062 MidiSend(noteOff4, 54, velocity); 4063 lastD[3][5] = 0; 4064 } 4065 4066 //D55 4067 4068 if ((keysD[4][0] == 0) and (lastD[4][0] == 0)) { 4069 MidiSend(noteOn4, 55, 4070 velocity); 4071 lastD[4][0] = 7; 4072 } 4073 //Write Midi Note Off 4074 if ((keysD[4][0] 4075 == 1) and (lastD[4][0] == 7)) { 4076 MidiSend(noteOff4, 55, velocity); 4077 lastD[4][0] 4078 = 0; 4079 } 4080 4081 //D56 4082 if ((keysD[4][1] == 0) and (lastD[4][1] == 0)) { 4083 4084 MidiSend(noteOn4, 56, velocity); 4085 lastD[4][1] = 7; 4086 } 4087 //Write 4088 Midi Note Off 4089 if ((keysD[4][1] == 1) and (lastD[4][1] == 7)) { 4090 MidiSend(noteOff4, 4091 56, velocity); 4092 lastD[4][1] = 0; 4093 } 4094 4095 //D57 4096 if ((keysD[4][2] 4097 == 0) and (lastD[4][2] == 0)) { 4098 MidiSend(noteOn4, 57, velocity); 4099 lastD[4][2] 4100 = 7; 4101 } 4102 //Write Midi Note Off 4103 if ((keysD[4][2] == 1) and (lastD[4][2] 4104 == 7)) { 4105 MidiSend(noteOff4, 57, velocity); 4106 lastD[4][2] = 0; 4107 } 4108 4109 4110 //D58 4111 if ((keysD[4][3] == 0) and (lastD[4][3] == 0)) { 4112 MidiSend(noteOn4, 4113 58, velocity); 4114 lastD[4][3] = 7; 4115 } 4116 //Write Midi Note Off 4117 if 4118 ((keysD[4][3] == 1) and (lastD[4][3] == 7)) { 4119 MidiSend(noteOff4, 58, velocity); 4120 4121 lastD[4][3] = 0; 4122 } 4123 4124 //D59 4125 if ((keysD[4][4] == 0) and (lastD[4][4] 4126 == 0)) { 4127 MidiSend(noteOn4, 59, velocity); 4128 lastD[4][4] = 7; 4129 } 4130 4131 //Write Midi Note Off 4132 if ((keysD[4][4] == 1) and (lastD[4][4] == 7)) { 4133 4134 MidiSend(noteOff4, 59, velocity); 4135 lastD[4][4] = 0; 4136 } 4137 4138 //D60 4139 4140 if ((keysD[4][5] == 0) and (lastD[4][5] == 0)) { 4141 MidiSend(noteOn4, 60, 4142 velocity); 4143 lastD[4][5] = 7; 4144 } 4145 //Write Midi Note Off 4146 if ((keysD[4][5] 4147 == 1) and (lastD[4][5] == 7)) { 4148 MidiSend(noteOff4, 60, velocity); 4149 lastD[4][5] 4150 = 0; 4151 } 4152 4153 //D61 4154 if ((keysD[5][0] == 0) and (lastD[5][0] == 0)) { 4155 4156 MidiSend(noteOn4, 61, velocity); 4157 lastD[5][0] = 7; 4158 } 4159 //Write 4160 Midi Note Off 4161 if ((keysD[5][0] == 1) and (lastD[5][0] == 7)) { 4162 MidiSend(noteOff4, 4163 61, velocity); 4164 lastD[5][0] = 0; 4165 } 4166 4167 //D62 4168 if ((keysD[5][1] 4169 == 0) and (lastD[5][1] == 0)) { 4170 MidiSend(noteOn4, 62, velocity); 4171 lastD[5][1] 4172 = 7; 4173 } 4174 //Write Midi Note Off 4175 if ((keysD[5][1] == 1) and (lastD[5][1] 4176 == 7)) { 4177 MidiSend(noteOff4, 62, velocity); 4178 lastD[5][1] = 0; 4179 } 4180 4181 4182 //D63 4183 if ((keysD[5][2] == 0) and (lastD[5][2] == 0)) { 4184 MidiSend(noteOn4, 4185 63, velocity); 4186 lastD[5][2] = 7; 4187 } 4188 //Write Midi Note Off 4189 if 4190 ((keysD[5][2] == 1) and (lastD[5][2] == 7)) { 4191 MidiSend(noteOff4, 63, velocity); 4192 4193 lastD[5][2] = 0; 4194 } 4195 4196 //D64 4197 if ((keysD[5][3] == 0) and (lastD[5][3] 4198 == 0)) { 4199 MidiSend(noteOn4, 64, velocity); 4200 lastD[5][3] = 7; 4201 } 4202 4203 //Write Midi Note Off 4204 if ((keysD[5][3] == 1) and (lastD[5][3] == 7)) { 4205 4206 MidiSend(noteOff4, 64, velocity); 4207 lastD[5][3] = 0; 4208 } 4209 4210 //D65 4211 4212 if ((keysD[5][4] == 0) and (lastD[5][4] == 0)) { 4213 MidiSend(noteOn4, 65, 4214 velocity); 4215 lastD[5][4] = 7; 4216 } 4217 //Write Midi Note Off 4218 if ((keysD[5][4] 4219 == 1) and (lastD[5][4] == 7)) { 4220 MidiSend(noteOff4, 65, velocity); 4221 lastD[5][4] 4222 = 0; 4223 } 4224 4225 //D66 4226 if ((keysD[5][5] == 0) and (lastD[5][5] == 0)) { 4227 4228 MidiSend(noteOn4, 66, velocity); 4229 lastD[5][5] = 7; 4230 } 4231 //Write 4232 Midi Note Off 4233 if ((keysD[5][5] == 1) and (lastD[5][5] == 7)) { 4234 MidiSend(noteOff4, 4235 66, velocity); 4236 lastD[5][5] = 0; 4237 } 4238 4239 //D67 4240 if ((keysD[6][0] 4241 == 0) and (lastD[6][0] == 0)) { 4242 MidiSend(noteOn4, 67, velocity); 4243 lastD[6][0] 4244 = 7; 4245 } 4246 //Write Midi Note Off 4247 if ((keysD[6][0] == 1) and (lastD[6][0] 4248 == 7)) { 4249 MidiSend(noteOff4, 67, velocity); 4250 lastD[6][0] = 0; 4251 } 4252 4253 4254 //D68 4255 if ((keysD[6][1] == 0) and (lastD[6][1] == 0)) { 4256 MidiSend(noteOn4, 4257 68, velocity); 4258 lastD[6][1] = 7; 4259 } 4260 //Write Midi Note Off 4261 if 4262 ((keysD[6][1] == 1) and (lastD[6][1] == 7)) { 4263 MidiSend(noteOff4, 68, velocity); 4264 4265 lastD[6][1] = 0; 4266 } 4267 4268 //D69 4269 if ((keysD[6][2] == 0) and (lastD[6][2] 4270 == 0)) { 4271 MidiSend(noteOn4, 69, velocity); 4272 lastD[6][2] = 7; 4273 } 4274 4275 //Write Midi Note Off 4276 if ((keysD[6][2] == 1) and (lastD[6][2] == 7)) { 4277 4278 MidiSend(noteOff4, 69, velocity); 4279 lastD[6][2] = 0; 4280 } 4281 4282 //D70 4283 4284 if ((keysD[6][3] == 0) and (lastD[6][3] == 0)) { 4285 MidiSend(noteOn4, 70, 4286 velocity); 4287 lastD[6][3] = 7; 4288 } 4289 //Write Midi Note Off 4290 if ((keysD[6][3] 4291 == 1) and (lastD[6][3] == 7)) { 4292 MidiSend(noteOff4, 70, velocity); 4293 lastD[6][3] 4294 = 0; 4295 } 4296 4297 //D71 4298 if ((keysD[6][4] == 0) and (lastD[6][4] == 0)) { 4299 4300 MidiSend(noteOn4, 71, velocity); 4301 lastD[6][4] = 7; 4302 } 4303 //Write 4304 Midi Note Off 4305 if ((keysD[6][4] == 1) and (lastD[6][4] == 7)) { 4306 MidiSend(noteOff4, 4307 71, velocity); 4308 lastD[6][4] = 0; 4309 } 4310 4311 //D72 4312 if ((keysD[6][5] 4313 == 0) and (lastD[6][5] == 0)) { 4314 MidiSend(noteOn4, 72, velocity); 4315 lastD[6][5] 4316 = 7; 4317 } 4318 //Write Midi Note Off 4319 if ((keysD[6][5] == 1) and (lastD[6][5] 4320 == 7)) { 4321 MidiSend(noteOff4, 72, velocity); 4322 lastD[6][5] = 0; 4323 } 4324 4325 4326 //D73 4327 if ((keysD[7][0] == 0) and (lastD[7][0] == 0)) { 4328 MidiSend(noteOn4, 4329 73, velocity); 4330 lastD[7][0] = 7; 4331 } 4332 //Write Midi Note Off 4333 if 4334 ((keysD[7][0] == 1) and (lastD[7][0] == 7)) { 4335 MidiSend(noteOff4, 73, velocity); 4336 4337 lastD[7][0] = 0; 4338 } 4339 4340 //D74 4341 if ((keysD[7][1] == 0) and (lastD[7][1] 4342 == 0)) { 4343 MidiSend(noteOn4, 74, velocity); 4344 lastD[7][1] = 7; 4345 } 4346 4347 //Write Midi Note Off 4348 if ((keysD[7][1] == 1) and (lastD[7][1] == 7)) { 4349 4350 MidiSend(noteOff4, 74, velocity); 4351 lastD[7][1] = 0; 4352 } 4353 4354 //D75 4355 4356 if ((keysD[7][2] == 0) and (lastD[7][2] == 0)) { 4357 MidiSend(noteOn4, 75, 4358 velocity); 4359 lastD[7][2] = 7; 4360 } 4361 //Write Midi Note Off 4362 if ((keysD[7][2] 4363 == 1) and (lastD[7][2] == 7)) { 4364 MidiSend(noteOff4, 75, velocity); 4365 lastD[7][2] 4366 = 0; 4367 } 4368 4369 //D76 4370 if ((keysD[7][3] == 0) and (lastD[7][3] == 0)) { 4371 4372 MidiSend(noteOn4, 76, velocity); 4373 lastD[7][3] = 7; 4374 } 4375 //Write 4376 Midi Note Off 4377 if ((keysD[7][3] == 1) and (lastD[7][3] == 7)) { 4378 MidiSend(noteOff4, 4379 76, velocity); 4380 lastD[7][3] = 0; 4381 } 4382 4383 //D77 4384 if ((keysD[7][4] 4385 == 0) and (lastD[7][4] == 0)) { 4386 MidiSend(noteOn4, 77, velocity); 4387 lastD[7][4] 4388 = 7; 4389 } 4390 //Write Midi Note Off 4391 if ((keysD[7][4] == 1) and (lastD[7][4] 4392 == 7)) { 4393 MidiSend(noteOff4, 77, velocity); 4394 lastD[7][4] = 0; 4395 } 4396 4397 4398 //D78 4399 if ((keysD[7][5] == 0) and (lastD[7][5] == 0)) { 4400 MidiSend(noteOn4, 4401 78, velocity); 4402 lastD[7][5] = 7; 4403 } 4404 //Write Midi Note Off 4405 if 4406 ((keysD[7][5] == 1) and (lastD[7][5] == 7)) { 4407 MidiSend(noteOff4, 78, velocity); 4408 4409 lastD[7][5] = 0; 4410 } 4411 4412 //D79 4413 if ((keysD[8][0] == 0) and (lastD[8][0] 4414 == 0)) { 4415 MidiSend(noteOn4, 79, velocity); 4416 lastD[8][0] = 7; 4417 } 4418 4419 //Write Midi Note Off 4420 if ((keysD[8][0] == 1) and (lastD[8][0] == 7)) { 4421 4422 MidiSend(noteOff4, 79, velocity); 4423 lastD[8][0] = 0; 4424 } 4425 4426 //D80 4427 4428 if ((keysD[8][1] == 0) and (lastD[8][1] == 0)) { 4429 MidiSend(noteOn4, 80, 4430 velocity); 4431 lastD[8][1] = 7; 4432 } 4433 //Write Midi Note Off 4434 if ((keysD[8][1] 4435 == 1) and (lastD[8][1] == 7)) { 4436 MidiSend(noteOff4, 80, velocity); 4437 lastD[8][1] 4438 = 0; 4439 } 4440 4441 //D81 4442 if ((keysD[8][2] == 0) and (lastD[8][2] == 0)) { 4443 4444 MidiSend(noteOn4, 81, velocity); 4445 lastD[8][2] = 7; 4446 } 4447 //Write 4448 Midi Note Off 4449 if ((keysD[8][2] == 1) and (lastD[8][2] == 7)) { 4450 MidiSend(noteOff4, 4451 81, velocity); 4452 lastD[8][2] = 0; 4453 } 4454 4455 //D82 4456 if ((keysD[8][3] 4457 == 0) and (lastD[8][3] == 0)) { 4458 MidiSend(noteOn4, 82, velocity); 4459 lastD[8][3] 4460 = 7; 4461 } 4462 //Write Midi Note Off 4463 if ((keysD[8][3] == 1) and (lastD[8][3] 4464 == 7)) { 4465 MidiSend(noteOff4, 82, velocity); 4466 lastD[8][3] = 0; 4467 } 4468 4469 4470 //D83 4471 if ((keysD[8][4] == 0) and (lastD[8][4] == 0)) { 4472 MidiSend(noteOn4, 4473 83, velocity); 4474 lastD[8][4] = 7; 4475 } 4476 //Write Midi Note Off 4477 if 4478 ((keysD[8][4] == 1) and (lastD[8][4] == 7)) { 4479 MidiSend(noteOff4, 83, velocity); 4480 4481 lastD[8][4] = 0; 4482 } 4483 4484 //D84 4485 if ((keysD[8][5] == 0) and (lastD[8][5] 4486 == 0)) { 4487 MidiSend(noteOn4, 84, velocity); 4488 lastD[8][5] = 7; 4489 } 4490 4491 //Write Midi Note Off 4492 if ((keysD[8][5] == 1) and (lastD[8][5] == 7)) { 4493 4494 MidiSend(noteOff4, 84, velocity); 4495 lastD[8][5] = 0; 4496 } 4497 4498 //D85 4499 4500 if ((keysD[9][0] == 0) and (lastD[9][0] == 0)) { 4501 MidiSend(noteOn4, 85, 4502 velocity); 4503 lastD[9][0] = 7; 4504 } 4505 //Write Midi Note Off 4506 if ((keysD[9][0] 4507 == 1) and (lastD[9][0] == 7)) { 4508 MidiSend(noteOff4, 85, velocity); 4509 lastD[9][0] 4510 = 0; 4511 } 4512 4513 //D86 4514 if ((keysD[9][1] == 0) and (lastD[9][1] == 0)) { 4515 4516 MidiSend(noteOn4, 86, velocity); 4517 lastD[9][1] = 7; 4518 } 4519 //Write 4520 Midi Note Off 4521 if ((keysD[9][1] == 1) and (lastD[9][1] == 7)) { 4522 MidiSend(noteOff4, 4523 86, velocity); 4524 lastD[9][1] = 0; 4525 } 4526 4527 //D87 4528 if ((keysD[9][2] 4529 == 0) and (lastD[9][2] == 0)) { 4530 MidiSend(noteOn4, 87, velocity); 4531 lastD[9][2] 4532 = 7; 4533 } 4534 //Write Midi Note Off 4535 if ((keysD[9][2] == 1) and (lastD[9][2] 4536 == 7)) { 4537 MidiSend(noteOff4, 87, velocity); 4538 lastD[9][2] = 0; 4539 } 4540 4541 4542 //D88 4543 if ((keysD[9][3] == 0) and (lastD[9][3] == 0)) { 4544 MidiSend(noteOn4, 4545 88, velocity); 4546 lastD[9][3] = 7; 4547 } 4548 //Write Midi Note Off 4549 if 4550 ((keysD[9][3] == 1) and (lastD[9][3] == 7)) { 4551 MidiSend(noteOff4, 88, velocity); 4552 4553 lastD[9][3] = 0; 4554 } 4555 4556 //D89 4557 if ((keysD[9][4] == 0) and (lastD[9][4] 4558 == 0)) { 4559 MidiSend(noteOn4, 89, velocity); 4560 lastD[9][4] = 7; 4561 } 4562 4563 //Write Midi Note Off 4564 if ((keysD[9][4] == 1) and (lastD[9][4] == 7)) { 4565 4566 MidiSend(noteOff4, 89, velocity); 4567 lastD[9][4] = 0; 4568 } 4569 4570 //D90 4571 4572 if ((keysD[9][5] == 0) and (lastD[9][5] == 0)) { 4573 MidiSend(noteOn4, 90, 4574 velocity); 4575 lastD[9][5] = 7; 4576 } 4577 //Write Midi Note Off 4578 if ((keysD[9][5] 4579 == 1) and (lastD[9][5] == 7)) { 4580 MidiSend(noteOff4, 90, velocity); 4581 lastD[9][5] 4582 = 0; 4583 } 4584 4585 //D91 4586 if ((keysD[10][0] == 0) and (lastD[10][0] == 0)) 4587 { 4588 MidiSend(noteOn4, 91, velocity); 4589 lastD[10][0] = 7; 4590 } 4591 //Write 4592 Midi Note Off 4593 if ((keysD[10][0] == 1) and (lastD[10][0] == 7)) { 4594 MidiSend(noteOff4, 4595 91, velocity); 4596 lastD[10][0] = 0; 4597 } 4598 4599 //D92 4600 if ((keysD[10][1] 4601 == 0) and (lastD[10][1] == 0)) { 4602 MidiSend(noteOn4, 92, velocity); 4603 lastD[10][1] 4604 = 7; 4605 } 4606 //Write Midi Note Off 4607 if ((keysD[10][1] == 1) and (lastD[10][1] 4608 == 7)) { 4609 MidiSend(noteOff4, 92, velocity); 4610 lastD[10][1] = 0; 4611 } 4612 4613 4614 //D93 4615 if ((keysD[10][2] == 0) and (lastD[10][2] == 0)) { 4616 MidiSend(noteOn4, 4617 93, velocity); 4618 lastD[10][2] = 7; 4619 } 4620 //Write Midi Note Off 4621 if 4622 ((keysD[10][2] == 1) and (lastD[10][2] == 7)) { 4623 MidiSend(noteOff4, 93, velocity); 4624 4625 lastD[10][2] = 0; 4626 } 4627 4628 //D94 4629 if ((keysD[10][3] == 0) and (lastD[10][3] 4630 == 0)) { 4631 MidiSend(noteOn4, 94, velocity); 4632 lastD[10][3] = 7; 4633 } 4634 4635 //Write Midi Note Off 4636 if ((keysD[10][3] == 1) and (lastD[10][3] == 7)) { 4637 4638 MidiSend(noteOff4, 94, velocity); 4639 lastD[10][3] = 0; 4640 } 4641 4642 //D95 4643 4644 if ((keysD[10][4] == 0) and (lastD[10][4] == 0)) { 4645 MidiSend(noteOn4, 95, 4646 velocity); 4647 lastD[10][4] = 7; 4648 } 4649 //Write Midi Note Off 4650 if ((keysD[10][4] 4651 == 1) and (lastD[10][4] == 7)) { 4652 MidiSend(noteOff4, 95, velocity); 4653 lastD[10][4] 4654 = 0; 4655 } 4656 4657 //D96 4658 if ((keysD[10][5] == 0) and (lastD[10][5] == 0)) 4659 { 4660 MidiSend(noteOn4, 96, velocity); 4661 lastD[10][5] = 7; 4662 } 4663 //Write 4664 Midi Note Off 4665 if ((keysD[10][5] == 1) and (lastD[10][5] == 7)) { 4666 MidiSend(noteOff4, 4667 96, velocity); 4668 lastD[10][5] = 0; 4669 } 4670 4671 //Write Keyboard C, only 4672 for inverted switches, first 32 notes only. 4673 /* 4674 //C36 4675 if ((keysC[0][0] 4676 == 0) and (lastC[0][0] == 0)) { 4677 MidiSend(noteOff3, 36, velocity); 4678 lastC[0][0] 4679 = 7; 4680 } 4681 if ((keysC[0][0] == 1) and (lastC[0][0] == 7)) { 4682 MidiSend(noteOn3, 4683 36, velocity); 4684 lastC[0][0] = 0; 4685 } 4686 4687 //C37 4688 if ((keysC[1][0] 4689 == 0) and (lastC[1][0] == 0)) { 4690 MidiSend(noteOff3, 37, velocity); 4691 lastC[1][0] 4692 = 7; 4693 } 4694 if ((keysC[1][0] == 1) and (lastC[1][0] == 7)) { 4695 MidiSend(noteOn3, 4696 37, velocity); 4697 lastC[1][0] = 0; 4698 } 4699 4700 //C38 4701 if ((keysC[1][1] 4702 == 0) and (lastC[1][1] == 0)) { 4703 MidiSend(noteOff3, 38, velocity); 4704 lastC[1][1] 4705 = 7; 4706 } 4707 //Write Midi Note Off 4708 if ((keysC[1][1] == 1) and (lastC[1][1] 4709 == 7)) { 4710 MidiSend(noteOn3, 38, velocity); 4711 lastC[1][1] = 0; 4712 } 4713 4714 4715 //C39 4716 if ((keysC[1][2] == 0) and (lastC[1][2] == 0)) { 4717 MidiSend(noteOff3, 4718 39, velocity); 4719 lastC[1][2] = 7; 4720 } 4721 //Write Midi Note Off 4722 if 4723 ((keysC[1][2] == 1) and (lastC[1][2] == 7)) { 4724 MidiSend(noteOn3, 39, velocity); 4725 4726 lastC[1][2] = 0; 4727 } 4728 4729 //C40 4730 if ((keysC[1][3] == 0) and (lastC[1][3] 4731 == 0)) { 4732 MidiSend(noteOff3, 40, velocity); 4733 lastC[1][3] = 7; 4734 } 4735 4736 //Write Midi Note Off 4737 if ((keysC[1][3] == 1) and (lastC[1][3] == 7)) { 4738 4739 MidiSend(noteOn3, 40, velocity); 4740 lastC[1][3] = 0; 4741 } 4742 4743 //C41 4744 4745 if ((keysC[1][4] == 0) and (lastC[1][4] == 0)) { 4746 MidiSend(noteOff3, 41, 4747 velocity); 4748 lastC[1][4] = 7; 4749 } 4750 //Write Midi Note Off 4751 if ((keysC[1][4] 4752 == 1) and (lastC[1][4] == 7)) { 4753 MidiSend(noteOn3, 41, velocity); 4754 lastC[1][4] 4755 = 0; 4756 } 4757 4758 //C42 4759 if ((keysC[1][5] == 0) and (lastC[1][5] == 0)) { 4760 4761 MidiSend(noteOff3, 42, velocity); 4762 lastC[1][5] = 7; 4763 } 4764 //Write 4765 Midi Note Off 4766 if ((keysC[1][5] == 1) and (lastC[1][5] == 7)) { 4767 MidiSend(noteOn3, 4768 42, velocity); 4769 lastC[1][5] = 0; 4770 } 4771 4772 //C43 4773 if ((keysC[2][0] 4774 == 0) and (lastC[2][0] == 0)) { 4775 MidiSend(noteOff3, 43, velocity); 4776 lastC[2][0] 4777 = 7; 4778 } 4779 //Write Midi Note Off 4780 if ((keysC[2][0] == 1) and (lastC[2][0] 4781 == 7)) { 4782 MidiSend(noteOn3, 43, velocity); 4783 lastC[2][0] = 0; 4784 } 4785 4786 4787 //C44 4788 if ((keysC[2][1] == 0) and (lastC[2][1] == 0)) { 4789 MidiSend(noteOff3, 4790 44, velocity); 4791 lastC[2][1] = 7; 4792 } 4793 //Write Midi Note Off 4794 if 4795 ((keysC[2][1] == 1) and (lastC[2][1] == 7)) { 4796 MidiSend(noteOn3, 44, velocity); 4797 4798 lastC[2][1] = 0; 4799 } 4800 4801 //C45 4802 if ((keysC[2][2] == 0) and (lastC[2][2] 4803 == 0)) { 4804 MidiSend(noteOff3, 45, velocity); 4805 lastC[2][2] = 7; 4806 } 4807 4808 //Write Midi Note Off 4809 if ((keysC[2][2] == 1) and (lastC[2][2] == 7)) { 4810 4811 MidiSend(noteOn3, 45, velocity); 4812 lastC[2][2] = 0; 4813 } 4814 4815 //C46 4816 4817 if ((keysC[2][3] == 0) and (lastC[2][3] == 0)) { 4818 MidiSend(noteOff3, 46, 4819 velocity); 4820 lastC[2][3] = 7; 4821 } 4822 //Write Midi Note Off 4823 if ((keysC[2][3] 4824 == 1) and (lastC[2][3] == 7)) { 4825 MidiSend(noteOn3, 46, velocity); 4826 lastC[2][3] 4827 = 0; 4828 } 4829 4830 //C47 4831 if ((keysC[2][4] == 0) and (lastC[2][4] == 0)) { 4832 4833 MidiSend(noteOff3, 47, velocity); 4834 lastC[2][4] = 7; 4835 } 4836 //Write 4837 Midi Note Off 4838 if ((keysC[2][4] == 1) and (lastC[2][4] == 7)) { 4839 MidiSend(noteOn3, 4840 47, velocity); 4841 lastC[2][4] = 0; 4842 } 4843 4844 //C48 4845 if ((keysC[2][5] 4846 == 0) and (lastC[2][5] == 0)) { 4847 MidiSend(noteOff3, 48, velocity); 4848 lastC[2][5] 4849 = 7; 4850 } 4851 //Write Midi Note Off 4852 if ((keysC[2][5] == 1) and (lastC[2][5] 4853 == 7)) { 4854 MidiSend(noteOn3, 48, velocity); 4855 lastC[2][5] = 0; 4856 } 4857 4858 4859 //C49 4860 if ((keysC[3][0] == 0) and (lastC[3][0] == 0)) { 4861 MidiSend(noteOff3, 4862 49, velocity); 4863 lastC[3][0] = 7; 4864 } 4865 //Write Midi Note Off 4866 if 4867 ((keysC[3][0] == 1) and (lastC[3][0] == 7)) { 4868 MidiSend(noteOn3, 49, velocity); 4869 4870 lastC[3][0] = 0; 4871 } 4872 4873 //C50 4874 if ((keysC[3][1] == 0) and (lastC[3][1] 4875 == 0)) { 4876 MidiSend(noteOff3, 50, velocity); 4877 lastC[3][1] = 7; 4878 } 4879 4880 //Write Midi Note Off 4881 if ((keysC[3][1] == 1) and (lastC[3][1] == 7)) { 4882 4883 MidiSend(noteOn3, 50, velocity); 4884 lastC[3][1] = 0; 4885 } 4886 4887 //C51 4888 4889 if ((keysC[3][2] == 0) and (lastC[3][2] == 0)) { 4890 MidiSend(noteOff3, 51, 4891 velocity); 4892 lastC[3][2] = 7; 4893 } 4894 //Write Midi Note Off 4895 if ((keysC[3][2] 4896 == 1) and (lastC[3][2] == 7)) { 4897 MidiSend(noteOn3, 51, velocity); 4898 lastC[3][2] 4899 = 0; 4900 } 4901 4902 //C52 4903 if ((keysC[3][3] == 0) and (lastC[3][3] == 0)) { 4904 4905 MidiSend(noteOff3, 52, velocity); 4906 lastC[3][3] = 7; 4907 } 4908 //Write 4909 Midi Note Off 4910 if ((keysC[3][3] == 1) and (lastC[3][3] == 7)) { 4911 MidiSend(noteOn3, 4912 52, velocity); 4913 lastC[3][3] = 0; 4914 } 4915 4916 //C53 4917 if ((keysC[3][4] 4918 == 0) and (lastC[3][4] == 0)) { 4919 MidiSend(noteOff3, 53, velocity); 4920 lastC[3][4] 4921 = 7; 4922 } 4923 //Write Midi Note Off 4924 if ((keysC[3][4] == 1) and (lastC[3][4] 4925 == 7)) { 4926 MidiSend(noteOn3, 53, velocity); 4927 lastC[3][4] = 0; 4928 } 4929 4930 4931 //C54 4932 if ((keysC[3][5] == 0) and (lastC[3][5] == 0)) { 4933 MidiSend(noteOff3, 4934 54, velocity); 4935 lastC[3][5] = 7; 4936 } 4937 //Write Midi Note Off 4938 if 4939 ((keysC[3][5] == 1) and (lastC[3][5] == 7)) { 4940 MidiSend(noteOn3, 54, velocity); 4941 4942 lastC[3][5] = 0; 4943 } 4944 4945 //C55 4946 if ((keysC[4][0] == 0) and (lastC[4][0] 4947 == 0)) { 4948 MidiSend(noteOff3, 55, velocity); 4949 lastC[4][0] = 7; 4950 } 4951 4952 //Write Midi Note Off 4953 if ((keysC[4][0] == 1) and (lastC[4][0] == 7)) { 4954 4955 MidiSend(noteOn3, 55, velocity); 4956 lastC[4][0] = 0; 4957 } 4958 4959 //C56 4960 4961 if ((keysC[4][1] == 0) and (lastC[4][1] == 0)) { 4962 MidiSend(noteOff3, 56, 4963 velocity); 4964 lastC[4][1] = 7; 4965 } 4966 //Write Midi Note Off 4967 if ((keysC[4][1] 4968 == 1) and (lastC[4][1] == 7)) { 4969 MidiSend(noteOn3, 56, velocity); 4970 lastC[4][1] 4971 = 0; 4972 } 4973 4974 //C57 4975 if ((keysC[4][2] == 0) and (lastC[4][2] == 0)) { 4976 4977 MidiSend(noteOff3, 57, velocity); 4978 lastC[4][2] = 7; 4979 } 4980 //Write 4981 Midi Note Off 4982 if ((keysC[4][2] == 1) and (lastC[4][2] == 7)) { 4983 MidiSend(noteOn3, 4984 57, velocity); 4985 lastC[4][2] = 0; 4986 } 4987 4988 //C58 4989 if ((keysC[4][3] 4990 == 0) and (lastC[4][3] == 0)) { 4991 MidiSend(noteOff3, 58, velocity); 4992 lastC[4][3] 4993 = 7; 4994 } 4995 //Write Midi Note Off 4996 if ((keysC[4][3] == 1) and (lastC[4][3] 4997 == 7)) { 4998 MidiSend(noteOn3, 58, velocity); 4999 lastC[4][3] = 0; 5000 } 5001 5002 5003 //C59 5004 if ((keysC[4][4] == 0) and (lastC[4][4] == 0)) { 5005 MidiSend(noteOff3, 5006 59, velocity); 5007 lastC[4][4] = 7; 5008 } 5009 //Write Midi Note Off 5010 if 5011 ((keysC[4][4] == 1) and (lastC[4][4] == 7)) { 5012 MidiSend(noteOn3, 59, velocity); 5013 5014 lastC[4][4] = 0; 5015 } 5016 5017 //C60 5018 if ((keysC[4][5] == 0) and (lastC[4][5] 5019 == 0)) { 5020 MidiSend(noteOff3, 60, velocity); 5021 lastC[4][5] = 7; 5022 } 5023 5024 //Write Midi Note Off 5025 if ((keysC[4][5] == 1) and (lastC[4][5] == 7)) { 5026 5027 MidiSend(noteOn3, 60, velocity); 5028 lastC[4][5] = 0; 5029 } 5030 5031 //C61 5032 5033 if ((keysC[5][0] == 0) and (lastC[5][0] == 0)) { 5034 MidiSend(noteOff3, 61, 5035 velocity); 5036 lastC[5][0] = 7; 5037 } 5038 //Write Midi Note Off 5039 if ((keysC[5][0] 5040 == 1) and (lastC[5][0] == 7)) { 5041 MidiSend(noteOn3, 61, velocity); 5042 lastC[5][0] 5043 = 0; 5044 } 5045 5046 //C62 5047 if ((keysC[5][1] == 0) and (lastC[5][1] == 0)) { 5048 5049 MidiSend(noteOff3, 62, velocity); 5050 lastC[5][1] = 7; 5051 } 5052 //Write 5053 Midi Note Off 5054 if ((keysC[5][1] == 1) and (lastC[5][1] == 7)) { 5055 MidiSend(noteOn3, 5056 62, velocity); 5057 lastC[5][1] = 0; 5058 } 5059 5060 //C63 5061 if ((keysC[5][2] 5062 == 0) and (lastC[5][2] == 0)) { 5063 MidiSend(noteOff3, 63, velocity); 5064 lastC[5][2] 5065 = 7; 5066 } 5067 //Write Midi Note Off 5068 if ((keysC[5][2] == 1) and (lastC[5][2] 5069 == 7)) { 5070 MidiSend(noteOn3, 63, velocity); 5071 lastC[5][2] = 0; 5072 } 5073 5074 5075 //C64 5076 if ((keysC[5][3] == 0) and (lastC[5][3] == 0)) { 5077 MidiSend(noteOff3, 5078 64, velocity); 5079 lastC[5][3] = 7; 5080 } 5081 //Write Midi Note Off 5082 if 5083 ((keysC[5][3] == 1) and (lastC[5][3] == 7)) { 5084 MidiSend(noteOn3, 64, velocity); 5085 5086 lastC[5][3] = 0; 5087 } 5088 5089 //C65 5090 if ((keysC[5][4] == 0) and (lastC[5][4] 5091 == 0)) { 5092 MidiSend(noteOff3, 65, velocity); 5093 lastC[5][4] = 7; 5094 } 5095 5096 //Write Midi Note Off 5097 if ((keysC[5][4] == 1) and (lastC[5][4] == 7)) { 5098 5099 MidiSend(noteOn3, 65, velocity); 5100 lastC[5][4] = 0; 5101 } 5102 5103 //C66 5104 5105 if ((keysC[5][5] == 0) and (lastC[5][5] == 0)) { 5106 MidiSend(noteOff3, 66, 5107 velocity); 5108 lastC[5][5] = 7; 5109 } 5110 //Write Midi Note Off 5111 if ((keysC[5][5] 5112 == 1) and (lastC[5][5] == 7)) { 5113 MidiSend(noteOn3, 66, velocity); 5114 lastC[5][5] 5115 = 0; 5116 } 5117 5118 //C67 5119 if ((keysC[6][0] == 0) and (lastC[6][0] == 0)) { 5120 5121 MidiSend(noteOff3, 67, velocity); 5122 lastC[6][0] = 7; 5123 } 5124 //Write 5125 Midi Note Off 5126 if ((keysC[6][0] == 1) and (lastC[6][0] == 7)) { 5127 MidiSend(noteOn3, 5128 67, velocity); 5129 lastC[6][0] = 0; 5130 } 5131 */ 5132 5133 //Expression Pedal 5134 controls 5135 5136 //Expression pedal on analog pin A13 to Channel 6 5137 5138 int 5139 Cur6 = analogRead(13); 5140 int Map6 = map(Cur6, 0, 1023, 0, 127); 5141 5142 if (abs(Cur6 5143 - LastPot6) >= 8) { 5144 MidiSend(chan6,Exp,Map6); 5145 LastPot6 = Cur6; 5146 } 5147 5148 5149 //Expression pedal on analog pin A14 to Channel 7 5150 5151 int Cur7 = analogRead(14); 5152 5153 int Map7 = map(Cur7, 0, 1023, 0, 127); 5154 5155 if (abs(Cur7 - LastPot7) >= 8) 5156 { 5157 MidiSend(chan7,Exp,Map7); 5158 LastPot7 = Cur7; 5159 } 5160 5161 //Expression 5162 pedal on analog pin A15 to Channel 8 5163 5164 int Cur8 = analogRead(15); 5165 int 5166 Map8 = map(Cur8, 0, 1023, 0, 127); 5167 5168 if (abs(Cur8 - LastPot8) >= 8) { 5169 5170 MidiSend(chan8,Exp,Map8); 5171 LastPot8 = Cur8; 5172 } 5173} 5174 5175void MidiSend(int 5176 one, int two, int three) { 5177 Serial.write(one); 5178 Serial.write(two); 5179 Serial.write(three); 5180 5181 }
Matrixed Keyboard code
arduino
Code to upload to the Arduino when you are following Matrixed Keyboard schematic.
1// Name: Arduino Mega Midi Controller v21 2// Created: Feb 4, 2021 3// Author: Larason2 4// Acknowledgements: Bald Engineer, Amanda Ghassaei, jeffb42, GrumpyMike 5 6byte keysA[11][6]; 7byte keysB[11][6]; 8byte keysC[7][6]; 9 10byte lastA[11][6]; 11byte lastB[11][6]; 12byte lastC[7][6]; 13 14int noteOn1 = 144; 15int noteOff1 = 128; 16int noteOn2 = 145; 17int noteOff2 = 129; 18int noteOn3 = 146; 19int noteOff3 = 130; 20int velocity = 100; 21int chan6 = 181; 22int chan7 = 182; 23int Exp = 11; 24 25int LastPot6 = 1; 26int LastPot7 = 1; 27 28void setup() { 29 // Start Serial 30 Serial.begin(31250); 31 32 //Initialize Keyboard A 33 pinMode(2, INPUT); 34 pinMode(22, INPUT); 35 pinMode(24, INPUT); 36 pinMode(26, INPUT); 37 pinMode(28, INPUT); 38 pinMode(30, INPUT); 39 40 pinMode(32, INPUT); 41 pinMode(34, INPUT); 42 pinMode(36, INPUT); 43 pinMode(38, INPUT); 44 pinMode(40, INPUT); 45 pinMode(42, INPUT); 46 pinMode(44, INPUT); 47 pinMode(46, INPUT); 48 pinMode(48, INPUT); 49 pinMode(50, INPUT); 50 pinMode(52, INPUT); 51 52 //Initialize Keyboard B 53 pinMode(3, INPUT); 54 pinMode(23, INPUT); 55 pinMode(25, INPUT); 56 pinMode(27, INPUT); 57 pinMode(29, INPUT); 58 pinMode(31, INPUT); 59 60 pinMode(33, INPUT); 61 pinMode(35, INPUT); 62 pinMode(37, INPUT); 63 pinMode(39, INPUT); 64 pinMode(41, INPUT); 65 pinMode(43, INPUT); 66 pinMode(45, INPUT); 67 pinMode(47, INPUT); 68 pinMode(49, INPUT); 69 pinMode(51, INPUT); 70 pinMode(52, INPUT); 71 72 //Initialize Keyboard C 73 pinMode(A2, INPUT); 74 pinMode(A3, INPUT); 75 pinMode(A4, INPUT); 76 pinMode(A5, INPUT); 77 pinMode(A6, INPUT); 78 pinMode(A7, INPUT); 79 80 pinMode(A8, INPUT); 81 pinMode(A9, INPUT); 82 pinMode(A10, INPUT); 83 pinMode(A11, INPUT); 84 pinMode(A12, INPUT); 85 pinMode(A13, INPUT); 86 pinMode(A14, INPUT); 87} 88 89void loop() { 90 91 // Read Keyboard A 92 93 pinMode(22, INPUT_PULLUP); 94 pinMode(24, INPUT_PULLUP); 95 pinMode(26, INPUT_PULLUP); 96 pinMode(28, INPUT_PULLUP); 97 pinMode(30, INPUT_PULLUP); 98 pinMode(2, INPUT_PULLUP); 99 100 pinMode(32, OUTPUT); 101 digitalWrite(32, LOW); 102 keysA[0][0] = digitalRead(2); 103 pinMode(32, INPUT); 104 105 pinMode(34, OUTPUT); 106 digitalWrite(34, LOW); 107 keysA[1][0] = digitalRead(22); 108 keysA[1][1] = digitalRead(24); 109 keysA[1][2] = digitalRead(26); 110 keysA[1][3] = digitalRead(28); 111 keysA[1][4] = digitalRead(30); 112 keysA[1][5] = digitalRead(2); 113 pinMode(34, INPUT); 114 115 pinMode(36, OUTPUT); 116 digitalWrite(36, LOW); 117 keysA[2][0] = digitalRead(22); 118 keysA[2][1] = digitalRead(24); 119 keysA[2][2] = digitalRead(26); 120 keysA[2][3] = digitalRead(28); 121 keysA[2][4] = digitalRead(30); 122 keysA[2][5] = digitalRead(2); 123 pinMode(36, INPUT); 124 125 pinMode(38, OUTPUT); 126 digitalWrite(38, LOW); 127 keysA[3][0] = digitalRead(22); 128 keysA[3][1] = digitalRead(24); 129 keysA[3][2] = digitalRead(26); 130 keysA[3][3] = digitalRead(28); 131 keysA[3][4] = digitalRead(30); 132 keysA[3][5] = digitalRead(2); 133 pinMode(38, INPUT); 134 135 pinMode(40, OUTPUT); 136 digitalWrite(40, LOW); 137 keysA[4][0] = digitalRead(22); 138 keysA[4][1] = digitalRead(24); 139 keysA[4][2] = digitalRead(26); 140 keysA[4][3] = digitalRead(28); 141 keysA[4][4] = digitalRead(30); 142 keysA[4][5] = digitalRead(2); 143 pinMode(40, INPUT); 144 145 pinMode(42, OUTPUT); 146 digitalWrite(42, LOW); 147 keysA[5][0] = digitalRead(22); 148 keysA[5][1] = digitalRead(24); 149 keysA[5][2] = digitalRead(26); 150 keysA[5][3] = digitalRead(28); 151 keysA[5][4] = digitalRead(30); 152 keysA[5][5] = digitalRead(2); 153 pinMode(42, INPUT); 154 155 pinMode(44, OUTPUT); 156 digitalWrite(44, LOW); 157 keysA[6][0] = digitalRead(22); 158 keysA[6][1] = digitalRead(24); 159 keysA[6][2] = digitalRead(26); 160 keysA[6][3] = digitalRead(28); 161 keysA[6][4] = digitalRead(30); 162 keysA[6][5] = digitalRead(2); 163 pinMode(44, INPUT); 164 165 pinMode(46, OUTPUT); 166 digitalWrite(46, LOW); 167 keysA[7][0] = digitalRead(22); 168 keysA[7][1] = digitalRead(24); 169 keysA[7][2] = digitalRead(26); 170 keysA[7][3] = digitalRead(28); 171 keysA[7][4] = digitalRead(30); 172 keysA[7][5] = digitalRead(2); 173 pinMode(46, INPUT); 174 175 pinMode(48, OUTPUT); 176 digitalWrite(48, LOW); 177 keysA[8][0] = digitalRead(22); 178 keysA[8][1] = digitalRead(24); 179 keysA[8][2] = digitalRead(26); 180 keysA[8][3] = digitalRead(28); 181 keysA[8][4] = digitalRead(30); 182 keysA[8][5] = digitalRead(2); 183 pinMode(48, INPUT); 184 185 pinMode(50, OUTPUT); 186 digitalWrite(50, LOW); 187 keysA[9][0] = digitalRead(22); 188 keysA[9][1] = digitalRead(24); 189 keysA[9][2] = digitalRead(26); 190 keysA[9][3] = digitalRead(28); 191 keysA[9][4] = digitalRead(30); 192 keysA[9][5] = digitalRead(2); 193 pinMode(50, INPUT); 194 195 pinMode(52, OUTPUT); 196 digitalWrite(52, LOW); 197 keysA[10][0] = digitalRead(22); 198 keysA[10][1] = digitalRead(24); 199 keysA[10][2] = digitalRead(26); 200 keysA[10][3] = digitalRead(28); 201 keysA[10][4] = digitalRead(30); 202 keysA[10][5] = digitalRead(2); 203 pinMode(52, INPUT); 204 205 pinMode(22, INPUT); 206 pinMode(24, INPUT); 207 pinMode(26, INPUT); 208 pinMode(28, INPUT); 209 pinMode(30, INPUT); 210 pinMode(2, INPUT); 211 212 // Read Keyboard B 213 214 pinMode(23, INPUT_PULLUP); 215 pinMode(25, INPUT_PULLUP); 216 pinMode(27, INPUT_PULLUP); 217 pinMode(29, INPUT_PULLUP); 218 pinMode(31, INPUT_PULLUP); 219 pinMode(3, INPUT_PULLUP); 220 221 pinMode(33, OUTPUT); 222 digitalWrite(33, LOW); 223 keysB[0][0] = digitalRead(3); 224 pinMode(33, INPUT); 225 226 pinMode(35, OUTPUT); 227 digitalWrite(35, LOW); 228 keysB[1][0] = digitalRead(23); 229 keysB[1][1] = digitalRead(25); 230 keysB[1][2] = digitalRead(27); 231 keysB[1][3] = digitalRead(29); 232 keysB[1][4] = digitalRead(31); 233 keysB[1][5] = digitalRead(3); 234 pinMode(35, INPUT); 235 236 pinMode(37, OUTPUT); 237 digitalWrite(37, LOW); 238 keysB[2][0] = digitalRead(23); 239 keysB[2][1] = digitalRead(25); 240 keysB[2][2] = digitalRead(27); 241 keysB[2][3] = digitalRead(29); 242 keysB[2][4] = digitalRead(31); 243 keysB[2][5] = digitalRead(3); 244 pinMode(37, INPUT); 245 246 pinMode(39, OUTPUT); 247 digitalWrite(39, LOW); 248 keysB[3][0] = digitalRead(23); 249 keysB[3][1] = digitalRead(25); 250 keysB[3][2] = digitalRead(27); 251 keysB[3][3] = digitalRead(29); 252 keysB[3][4] = digitalRead(31); 253 keysB[3][5] = digitalRead(3); 254 pinMode(39, INPUT); 255 256 pinMode(41, OUTPUT); 257 digitalWrite(41, LOW); 258 keysB[4][0] = digitalRead(23); 259 keysB[4][1] = digitalRead(25); 260 keysB[4][2] = digitalRead(27); 261 keysB[4][3] = digitalRead(29); 262 keysB[4][4] = digitalRead(31); 263 keysB[4][5] = digitalRead(3); 264 pinMode(41, INPUT); 265 266 pinMode(43, OUTPUT); 267 digitalWrite(43, LOW); 268 keysB[5][0] = digitalRead(23); 269 keysB[5][1] = digitalRead(25); 270 keysB[5][2] = digitalRead(27); 271 keysB[5][3] = digitalRead(29); 272 keysB[5][4] = digitalRead(31); 273 keysB[5][5] = digitalRead(3); 274 pinMode(43, INPUT); 275 276 pinMode(45, OUTPUT); 277 digitalWrite(45, LOW); 278 keysB[6][0] = digitalRead(23); 279 keysB[6][1] = digitalRead(25); 280 keysB[6][2] = digitalRead(27); 281 keysB[6][3] = digitalRead(29); 282 keysB[6][4] = digitalRead(31); 283 keysB[6][5] = digitalRead(3); 284 pinMode(45, INPUT); 285 286 pinMode(47, OUTPUT); 287 digitalWrite(47, LOW); 288 keysB[7][0] = digitalRead(23); 289 keysB[7][1] = digitalRead(25); 290 keysB[7][2] = digitalRead(27); 291 keysB[7][3] = digitalRead(29); 292 keysB[7][4] = digitalRead(31); 293 keysB[7][5] = digitalRead(3); 294 pinMode(47, INPUT); 295 296 pinMode(49, OUTPUT); 297 digitalWrite(49, LOW); 298 keysB[8][0] = digitalRead(23); 299 keysB[8][1] = digitalRead(25); 300 keysB[8][2] = digitalRead(27); 301 keysB[8][3] = digitalRead(29); 302 keysB[8][4] = digitalRead(31); 303 keysB[8][5] = digitalRead(3); 304 pinMode(49, INPUT); 305 306 pinMode(51, OUTPUT); 307 digitalWrite(51, LOW); 308 keysB[9][0] = digitalRead(23); 309 keysB[9][1] = digitalRead(25); 310 keysB[9][2] = digitalRead(27); 311 keysB[9][3] = digitalRead(29); 312 keysB[9][4] = digitalRead(31); 313 keysB[9][5] = digitalRead(3); 314 pinMode(51, INPUT); 315 316 pinMode(53, OUTPUT); 317 digitalWrite(53, LOW); 318 keysB[10][0] = digitalRead(23); 319 keysB[10][1] = digitalRead(25); 320 keysB[10][2] = digitalRead(27); 321 keysB[10][3] = digitalRead(29); 322 keysB[10][4] = digitalRead(31); 323 keysB[10][5] = digitalRead(3); 324 pinMode(53, INPUT); 325 326 pinMode(23, INPUT); 327 pinMode(25, INPUT); 328 pinMode(27, INPUT); 329 pinMode(29, INPUT); 330 pinMode(31, INPUT); 331 pinMode(3, INPUT); 332 333 // Read Keyboard C 334 335 //Set Row pins to read 336 pinMode(A3, INPUT_PULLUP); 337 pinMode(A4, INPUT_PULLUP); 338 pinMode(A5, INPUT_PULLUP); 339 pinMode(A6, INPUT_PULLUP); 340 pinMode(A7, INPUT_PULLUP); 341 pinMode(A2, INPUT_PULLUP); 342 343 pinMode(A8, OUTPUT); 344 digitalWrite(A8, LOW); 345 keysC[0][0] = digitalRead(A2); 346 pinMode(A8, INPUT); 347 348 pinMode(A9, OUTPUT); 349 digitalWrite(A9, LOW); 350 keysC[1][0] = digitalRead(A3); 351 keysC[1][1] = digitalRead(A4); 352 keysC[1][2] = digitalRead(A5); 353 keysC[1][3] = digitalRead(A6); 354 keysC[1][4] = digitalRead(A7); 355 keysC[1][5] = digitalRead(A2); 356 pinMode(A9, INPUT); 357 358 pinMode(A10, OUTPUT); 359 digitalWrite(A10, LOW); 360 keysC[2][0] = digitalRead(A3); 361 keysC[2][1] = digitalRead(A4); 362 keysC[2][2] = digitalRead(A5); 363 keysC[2][3] = digitalRead(A6); 364 keysC[2][4] = digitalRead(A7); 365 keysC[2][5] = digitalRead(A2); 366 pinMode(A10, INPUT); 367 368 pinMode(A11, OUTPUT); 369 digitalWrite(A11, LOW); 370 keysC[3][0] = digitalRead(A3); 371 keysC[3][1] = digitalRead(A4); 372 keysC[3][2] = digitalRead(A5); 373 keysC[3][3] = digitalRead(A6); 374 keysC[3][4] = digitalRead(A7); 375 keysC[3][5] = digitalRead(A2); 376 pinMode(A11, INPUT); 377 378 pinMode(A12, OUTPUT); 379 digitalWrite(A12, LOW); 380 keysC[4][0] = digitalRead(A3); 381 keysC[4][1] = digitalRead(A4); 382 keysC[4][2] = digitalRead(A5); 383 keysC[4][3] = digitalRead(A6); 384 keysC[4][4] = digitalRead(A7); 385 keysC[4][5] = digitalRead(A2); 386 pinMode(A12, INPUT); 387 388 pinMode(A13, OUTPUT); 389 digitalWrite(A13, LOW); 390 keysC[5][0] = digitalRead(A3); 391 keysC[5][1] = digitalRead(A4); 392 keysC[5][2] = digitalRead(A5); 393 keysC[5][3] = digitalRead(A6); 394 keysC[5][4] = digitalRead(A7); 395 keysC[5][5] = digitalRead(A2); 396 pinMode(A13, INPUT); 397 398 pinMode(A14, OUTPUT); 399 digitalWrite(A14, LOW); 400 keysC[6][0] = digitalRead(A3); 401 pinMode(A14, INPUT); 402 403 pinMode(A3, INPUT); 404 pinMode(A4, INPUT); 405 pinMode(A5, INPUT); 406 pinMode(A6, INPUT); 407 pinMode(A7, INPUT); 408 pinMode(A2, INPUT); 409 410 411 //Invert Keyboard C data 412 //(For switches that are Normally Closed) 413 414 //Column 1 415 416 if (keysC[0][0] == 0) { 417 keysC[0][0] = 1; 418 } 419 else 420 if (keysC[0][0] == 1) { 421 keysC[0][0] = 0; 422 } 423 424 //Column 2 425 426 if (keysC[1][0] == 0) { 427 keysC[1][0] = 1; 428 } 429 else 430 if (keysC[1][0] == 1) { 431 keysC[1][0] = 0; 432 } 433 if (keysC[1][1] == 0) { 434 keysC[1][1] = 1; 435 } 436 else 437 if (keysC[1][1] == 1) { 438 keysC[1][1] = 0; 439 } 440 if (keysC[1][2] == 0) { 441 keysC[1][2] = 1; 442 } 443 else 444 if (keysC[1][2] == 1) { 445 keysC[1][2] = 0; 446 } 447 if (keysC[1][3] == 0) { 448 keysC[1][3] = 1; 449 } 450 else 451 if (keysC[1][3] == 1) { 452 keysC[1][3] = 0; 453 } 454 if (keysC[1][4] == 0) { 455 keysC[1][4] = 1; 456 } 457 else 458 if (keysC[1][4] == 1) { 459 keysC[1][4] = 0; 460 } 461 if (keysC[1][5] == 0) { 462 keysC[1][5] = 1; 463 } 464 else 465 if (keysC[1][5] == 1) { 466 keysC[1][5] = 0; 467 } 468 469 //Column 3 470 471 if (keysC[2][0] == 0) { 472 keysC[2][0] = 1; 473 } 474 else 475 if (keysC[2][0] == 1) { 476 keysC[2][0] = 0; 477 } 478 if (keysC[2][1] == 0) { 479 keysC[2][1] = 1; 480 } 481 else 482 if (keysC[2][1] == 1) { 483 keysC[2][1] = 0; 484 } 485 if (keysC[2][2] == 0) { 486 keysC[2][2] = 1; 487 } 488 else 489 if (keysC[2][2] == 1) { 490 keysC[2][2] = 0; 491 } 492 if (keysC[2][3] == 0) { 493 keysC[2][3] = 1; 494 } 495 else 496 if (keysC[2][3] == 1) { 497 keysC[2][3] = 0; 498 } 499 if (keysC[2][4] == 0) { 500 keysC[2][4] = 1; 501 } 502 else 503 if (keysC[2][4] == 1) { 504 keysC[2][4] = 0; 505 } 506 if (keysC[2][5] == 0) { 507 keysC[2][5] = 1; 508 } 509 else 510 if (keysC[2][5] == 1) { 511 keysC[2][5] = 0; 512 } 513 514 //Column 4 515 516 if (keysC[3][0] == 0) { 517 keysC[3][0] = 1; 518 } 519 else 520 if (keysC[3][0] == 1) { 521 keysC[3][0] = 0; 522 } 523 if (keysC[3][1] == 0) { 524 keysC[3][1] = 1; 525 } 526 else 527 if (keysC[3][1] == 1) { 528 keysC[3][1] = 0; 529 } 530 if (keysC[3][2] == 0) { 531 keysC[3][2] = 1; 532 } 533 else 534 if (keysC[3][2] == 1) { 535 keysC[3][2] = 0; 536 } 537 if (keysC[3][3] == 0) { 538 keysC[3][3] = 1; 539 } 540 else 541 if (keysC[3][3] == 1) { 542 keysC[3][3] = 0; 543 } 544 if (keysC[3][4] == 0) { 545 keysC[3][4] = 1; 546 } 547 else 548 if (keysC[3][4] == 1) { 549 keysC[3][4] = 0; 550 } 551 if (keysC[3][5] == 0) { 552 keysC[3][5] = 1; 553 } 554 else 555 if (keysC[3][5] == 1) { 556 keysC[3][5] = 0; 557 } 558 559 //Column 5 560 561 if (keysC[4][0] == 0) { 562 keysC[4][0] = 1; 563 } 564 else 565 if (keysC[4][0] == 1) { 566 keysC[4][0] = 0; 567 } 568 if (keysC[4][1] == 0) { 569 keysC[4][1] = 1; 570 } 571 else 572 if (keysC[4][1] == 1) { 573 keysC[4][1] = 0; 574 } 575 if (keysC[4][2] == 0) { 576 keysC[4][2] = 1; 577 } 578 else 579 if (keysC[4][2] == 1) { 580 keysC[4][2] = 0; 581 } 582 if (keysC[4][3] == 0) { 583 keysC[4][3] = 1; 584 } 585 else 586 if (keysC[4][3] == 1) { 587 keysC[4][3] = 0; 588 } 589 if (keysC[4][4] == 0) { 590 keysC[4][4] = 1; 591 } 592 else 593 if (keysC[4][4] == 1) { 594 keysC[4][4] = 0; 595 } 596 if (keysC[4][5] == 0) { 597 keysC[4][5] = 1; 598 } 599 else 600 if (keysC[4][5] == 1) { 601 keysC[4][5] = 0; 602 } 603 604 //Column 6 605 606 if (keysC[5][0] == 0) { 607 keysC[5][0] = 1; 608 } 609 else 610 if (keysC[5][0] == 1) { 611 keysC[5][0] = 0; 612 } 613 if (keysC[5][1] == 0) { 614 keysC[5][1] = 1; 615 } 616 else 617 if (keysC[5][1] == 1) { 618 keysC[5][1] = 0; 619 } 620 if (keysC[5][2] == 0) { 621 keysC[5][2] = 1; 622 } 623 else 624 if (keysC[5][2] == 1) { 625 keysC[5][2] = 0; 626 } 627 if (keysC[5][3] == 0) { 628 keysC[5][3] = 1; 629 } 630 else 631 if (keysC[5][3] == 1) { 632 keysC[5][3] = 0; 633 } 634 if (keysC[5][4] == 0) { 635 keysC[5][4] = 1; 636 } 637 else 638 if (keysC[5][4] == 1) { 639 keysC[5][4] = 0; 640 } 641 if (keysC[5][5] == 0) { 642 keysC[5][5] = 1; 643 } 644 else 645 if (keysC[5][5] == 1) { 646 keysC[5][5] = 0; 647 } 648 649 //Column 7 650 651 if (keysC[6][0] == 0) { 652 keysC[6][0] = 1; 653 } 654 else 655 if (keysC[6][0] == 1) { 656 keysC[6][0] = 0; 657 } 658 659 660 //Write Keyboard A 661 662 //A36 663 if ((keysA[0][0] == 0) and (lastA[0][0] == 0)) { 664 MidiSend(noteOn1, 36, velocity); 665 lastA[0][0] = 7; 666 } 667 if ((keysA[0][0] == 1) and (lastA[0][0] == 7)) { 668 MidiSend(noteOff1, 36, velocity); 669 lastA[0][0] = 0; 670 } 671 672 //A37 673 if ((keysA[1][0] == 0) and (lastA[1][0] == 0)) { 674 MidiSend(noteOn1, 37, velocity); 675 lastA[1][0] = 7; 676 } 677 if ((keysA[1][0] == 1) and (lastA[1][0] == 7)) { 678 MidiSend(noteOff1, 37, velocity); 679 lastA[1][0] = 0; 680 } 681 682 //A38 683 if ((keysA[1][1] == 0) and (lastA[1][1] == 0)) { 684 MidiSend(noteOn1, 38, velocity); 685 lastA[1][1] = 7; 686 } 687 //Write Midi Note Off 688 if ((keysA[1][1] == 1) and (lastA[1][1] == 7)) { 689 MidiSend(noteOff1, 38, velocity); 690 lastA[1][1] = 0; 691 } 692 693 //A39 694 if ((keysA[1][2] == 0) and (lastA[1][2] == 0)) { 695 MidiSend(noteOn1, 39, velocity); 696 lastA[1][2] = 7; 697 } 698 //Write Midi Note Off 699 if ((keysA[1][2] == 1) and (lastA[1][2] == 7)) { 700 MidiSend(noteOff1, 39, velocity); 701 lastA[1][2] = 0; 702 } 703 704 //A40 705 if ((keysA[1][3] == 0) and (lastA[1][3] == 0)) { 706 MidiSend(noteOn1, 40, velocity); 707 lastA[1][3] = 7; 708 } 709 //Write Midi Note Off 710 if ((keysA[1][3] == 1) and (lastA[1][3] == 7)) { 711 MidiSend(noteOff1, 40, velocity); 712 lastA[1][3] = 0; 713 } 714 715 //A41 716 if ((keysA[1][4] == 0) and (lastA[1][4] == 0)) { 717 MidiSend(noteOn1, 41, velocity); 718 lastA[1][4] = 7; 719 } 720 //Write Midi Note Off 721 if ((keysA[1][4] == 1) and (lastA[1][4] == 7)) { 722 MidiSend(noteOff1, 41, velocity); 723 lastA[1][4] = 0; 724 } 725 726 //A42 727 if ((keysA[1][5] == 0) and (lastA[1][5] == 0)) { 728 MidiSend(noteOn1, 42, velocity); 729 lastA[1][5] = 7; 730 } 731 //Write Midi Note Off 732 if ((keysA[1][5] == 1) and (lastA[1][5] == 7)) { 733 MidiSend(noteOff1, 42, velocity); 734 lastA[1][5] = 0; 735 } 736 737 //A43 738 if ((keysA[2][0] == 0) and (lastA[2][0] == 0)) { 739 MidiSend(noteOn1, 43, velocity); 740 lastA[2][0] = 7; 741 } 742 //Write Midi Note Off 743 if ((keysA[2][0] == 1) and (lastA[2][0] == 7)) { 744 MidiSend(noteOff1, 43, velocity); 745 lastA[2][0] = 0; 746 } 747 748 //A44 749 if ((keysA[2][1] == 0) and (lastA[2][1] == 0)) { 750 MidiSend(noteOn1, 44, velocity); 751 lastA[2][1] = 7; 752 } 753 //Write Midi Note Off 754 if ((keysA[2][1] == 1) and (lastA[2][1] == 7)) { 755 MidiSend(noteOff1, 44, velocity); 756 lastA[2][1] = 0; 757 } 758 759 //A45 760 if ((keysA[2][2] == 0) and (lastA[2][2] == 0)) { 761 MidiSend(noteOn1, 45, velocity); 762 lastA[2][2] = 7; 763 } 764 //Write Midi Note Off 765 if ((keysA[2][2] == 1) and (lastA[2][2] == 7)) { 766 MidiSend(noteOff1, 45, velocity); 767 lastA[2][2] = 0; 768 } 769 770 //A46 771 if ((keysA[2][3] == 0) and (lastA[2][3] == 0)) { 772 MidiSend(noteOn1, 46, velocity); 773 lastA[2][3] = 7; 774 } 775 //Write Midi Note Off 776 if ((keysA[2][3] == 1) and (lastA[2][3] == 7)) { 777 MidiSend(noteOff1, 46, velocity); 778 lastA[2][3] = 0; 779 } 780 781 //A47 782 if ((keysA[2][4] == 0) and (lastA[2][4] == 0)) { 783 MidiSend(noteOn1, 47, velocity); 784 lastA[2][4] = 7; 785 } 786 //Write Midi Note Off 787 if ((keysA[2][4] == 1) and (lastA[2][4] == 7)) { 788 MidiSend(noteOff1, 47, velocity); 789 lastA[2][4] = 0; 790 } 791 792 //A48 793 if ((keysA[2][5] == 0) and (lastA[2][5] == 0)) { 794 MidiSend(noteOn1, 48, velocity); 795 lastA[2][5] = 7; 796 } 797 //Write Midi Note Off 798 if ((keysA[2][5] == 1) and (lastA[2][5] == 7)) { 799 MidiSend(noteOff1, 48, velocity); 800 lastA[2][5] = 0; 801 } 802 803 //A49 804 if ((keysA[3][0] == 0) and (lastA[3][0] == 0)) { 805 MidiSend(noteOn1, 49, velocity); 806 lastA[3][0] = 7; 807 } 808 //Write Midi Note Off 809 if ((keysA[3][0] == 1) and (lastA[3][0] == 7)) { 810 MidiSend(noteOff1, 49, velocity); 811 lastA[3][0] = 0; 812 } 813 814 //A50 815 if ((keysA[3][1] == 0) and (lastA[3][1] == 0)) { 816 MidiSend(noteOn1, 50, velocity); 817 lastA[3][1] = 7; 818 } 819 //Write Midi Note Off 820 if ((keysA[3][1] == 1) and (lastA[3][1] == 7)) { 821 MidiSend(noteOff1, 50, velocity); 822 lastA[3][1] = 0; 823 } 824 825 //A51 826 if ((keysA[3][2] == 0) and (lastA[3][2] == 0)) { 827 MidiSend(noteOn1, 51, velocity); 828 lastA[3][2] = 7; 829 } 830 //Write Midi Note Off 831 if ((keysA[3][2] == 1) and (lastA[3][2] == 7)) { 832 MidiSend(noteOff1, 51, velocity); 833 lastA[3][2] = 0; 834 } 835 836 //A52 837 if ((keysA[3][3] == 0) and (lastA[3][3] == 0)) { 838 MidiSend(noteOn1, 52, velocity); 839 lastA[3][3] = 7; 840 } 841 //Write Midi Note Off 842 if ((keysA[3][3] == 1) and (lastA[3][3] == 7)) { 843 MidiSend(noteOff1, 52, velocity); 844 lastA[3][3] = 0; 845 } 846 847 //A53 848 if ((keysA[3][4] == 0) and (lastA[3][4] == 0)) { 849 MidiSend(noteOn1, 53, velocity); 850 lastA[3][4] = 7; 851 } 852 //Write Midi Note Off 853 if ((keysA[3][4] == 1) and (lastA[3][4] == 7)) { 854 MidiSend(noteOff1, 53, velocity); 855 lastA[3][4] = 0; 856 } 857 858 //A54 859 if ((keysA[3][5] == 0) and (lastA[3][5] == 0)) { 860 MidiSend(noteOn1, 54, velocity); 861 lastA[3][5] = 7; 862 } 863 //Write Midi Note Off 864 if ((keysA[3][5] == 1) and (lastA[3][5] == 7)) { 865 MidiSend(noteOff1, 54, velocity); 866 lastA[3][5] = 0; 867 } 868 869 //A55 870 if ((keysA[4][0] == 0) and (lastA[4][0] == 0)) { 871 MidiSend(noteOn1, 55, velocity); 872 lastA[4][0] = 7; 873 } 874 //Write Midi Note Off 875 if ((keysA[4][0] == 1) and (lastA[4][0] == 7)) { 876 MidiSend(noteOff1, 55, velocity); 877 lastA[4][0] = 0; 878 } 879 880 //A56 881 if ((keysA[4][1] == 0) and (lastA[4][1] == 0)) { 882 MidiSend(noteOn1, 56, velocity); 883 lastA[4][1] = 7; 884 } 885 //Write Midi Note Off 886 if ((keysA[4][1] == 1) and (lastA[4][1] == 7)) { 887 MidiSend(noteOff1, 56, velocity); 888 lastA[4][1] = 0; 889 } 890 891 //A57 892 if ((keysA[4][2] == 0) and (lastA[4][2] == 0)) { 893 MidiSend(noteOn1, 57, velocity); 894 lastA[4][2] = 7; 895 } 896 //Write Midi Note Off 897 if ((keysA[4][2] == 1) and (lastA[4][2] == 7)) { 898 MidiSend(noteOff1, 57, velocity); 899 lastA[4][2] = 0; 900 } 901 902 //A58 903 if ((keysA[4][3] == 0) and (lastA[4][3] == 0)) { 904 MidiSend(noteOn1, 58, velocity); 905 lastA[4][3] = 7; 906 } 907 //Write Midi Note Off 908 if ((keysA[4][3] == 1) and (lastA[4][3] == 7)) { 909 MidiSend(noteOff1, 58, velocity); 910 lastA[4][3] = 0; 911 } 912 913 //59 914 if ((keysA[4][4] == 0) and (lastA[4][4] == 0)) { 915 MidiSend(noteOn1, 59, velocity); 916 lastA[4][4] = 7; 917 } 918 //Write Midi Note Off 919 if ((keysA[4][4] == 1) and (lastA[4][4] == 7)) { 920 MidiSend(noteOff1, 59, velocity); 921 lastA[4][4] = 0; 922 } 923 924 //A60 925 if ((keysA[4][5] == 0) and (lastA[4][5] == 0)) { 926 MidiSend(noteOn1, 60, velocity); 927 lastA[4][5] = 7; 928 } 929 //Write Midi Note Off 930 if ((keysA[4][5] == 1) and (lastA[4][5] == 7)) { 931 MidiSend(noteOff1, 60, velocity); 932 lastA[4][5] = 0; 933 } 934 935 //A61 936 if ((keysA[5][0] == 0) and (lastA[5][0] == 0)) { 937 MidiSend(noteOn1, 61, velocity); 938 lastA[5][0] = 7; 939 } 940 //Write Midi Note Off 941 if ((keysA[5][0] == 1) and (lastA[5][0] == 7)) { 942 MidiSend(noteOff1, 61, velocity); 943 lastA[5][0] = 0; 944 } 945 946 //A62 947 if ((keysA[5][1] == 0) and (lastA[5][1] == 0)) { 948 MidiSend(noteOn1, 62, velocity); 949 lastA[5][1] = 7; 950 } 951 //Write Midi Note Off 952 if ((keysA[5][1] == 1) and (lastA[5][1] == 7)) { 953 MidiSend(noteOff1, 62, velocity); 954 lastA[5][1] = 0; 955 } 956 957 //A63 958 if ((keysA[5][2] == 0) and (lastA[5][2] == 0)) { 959 MidiSend(noteOn1, 63, velocity); 960 lastA[5][2] = 7; 961 } 962 //Write Midi Note Off 963 if ((keysA[5][2] == 1) and (lastA[5][2] == 7)) { 964 MidiSend(noteOff1, 63, velocity); 965 lastA[5][2] = 0; 966 } 967 968 //A64 969 if ((keysA[5][3] == 0) and (lastA[5][3] == 0)) { 970 MidiSend(noteOn1, 64, velocity); 971 lastA[5][3] = 7; 972 } 973 //Write Midi Note Off 974 if ((keysA[5][3] == 1) and (lastA[5][3] == 7)) { 975 MidiSend(noteOff1, 64, velocity); 976 lastA[5][3] = 0; 977 } 978 979 //A65 980 if ((keysA[5][4] == 0) and (lastA[5][4] == 0)) { 981 MidiSend(noteOn1, 65, velocity); 982 lastA[5][4] = 7; 983 } 984 //Write Midi Note Off 985 if ((keysA[5][4] == 1) and (lastA[5][4] == 7)) { 986 MidiSend(noteOff1, 65, velocity); 987 lastA[5][4] = 0; 988 } 989 990 //A66 991 if ((keysA[5][5] == 0) and (lastA[5][5] == 0)) { 992 MidiSend(noteOn1, 66, velocity); 993 lastA[5][5] = 7; 994 } 995 //Write Midi Note Off 996 if ((keysA[5][5] == 1) and (lastA[5][5] == 7)) { 997 MidiSend(noteOff1, 66, velocity); 998 lastA[5][5] = 0; 999 } 1000 1001 //A67 1002 if ((keysA[6][0] == 0) and (lastA[6][0] == 0)) { 1003 MidiSend(noteOn1, 67, velocity); 1004 lastA[6][0] = 7; 1005 } 1006 //Write Midi Note Off 1007 if ((keysA[6][0] == 1) and (lastA[6][0] == 7)) { 1008 MidiSend(noteOff1, 67, velocity); 1009 lastA[6][0] = 0; 1010 } 1011 1012 //A68 1013 if ((keysA[6][1] == 0) and (lastA[6][1] == 0)) { 1014 MidiSend(noteOn1, 68, velocity); 1015 lastA[6][1] = 7; 1016 } 1017 //Write Midi Note Off 1018 if ((keysA[6][1] == 1) and (lastA[6][1] == 7)) { 1019 MidiSend(noteOff1, 68, velocity); 1020 lastA[6][1] = 0; 1021 } 1022 1023 //A69 1024 if ((keysA[6][2] == 0) and (lastA[6][2] == 0)) { 1025 MidiSend(noteOn1, 69, velocity); 1026 lastA[6][2] = 7; 1027 } 1028 //Write Midi Note Off 1029 if ((keysA[6][2] == 1) and (lastA[6][2] == 7)) { 1030 MidiSend(noteOff1, 69, velocity); 1031 lastA[6][2] = 0; 1032 } 1033 1034 //A70 1035 if ((keysA[6][3] == 0) and (lastA[6][3] == 0)) { 1036 MidiSend(noteOn1, 70, velocity); 1037 lastA[6][3] = 7; 1038 } 1039 //Write Midi Note Off 1040 if ((keysA[6][3] == 1) and (lastA[6][3] == 7)) { 1041 MidiSend(noteOff1, 70, velocity); 1042 lastA[6][3] = 0; 1043 } 1044 1045 //A71 1046 if ((keysA[6][4] == 0) and (lastA[6][4] == 0)) { 1047 MidiSend(noteOn1, 71, velocity); 1048 lastA[6][4] = 7; 1049 } 1050 //Write Midi Note Off 1051 if ((keysA[6][4] == 1) and (lastA[6][4] == 7)) { 1052 MidiSend(noteOff1, 71, velocity); 1053 lastA[6][4] = 0; 1054 } 1055 1056 //A72 1057 if ((keysA[6][5] == 0) and (lastA[6][5] == 0)) { 1058 MidiSend(noteOn1, 72, velocity); 1059 lastA[6][5] = 7; 1060 } 1061 //Write Midi Note Off 1062 if ((keysA[6][5] == 1) and (lastA[6][5] == 7)) { 1063 MidiSend(noteOff1, 72, velocity); 1064 lastA[6][5] = 0; 1065 } 1066 1067 //A73 1068 if ((keysA[7][0] == 0) and (lastA[7][0] == 0)) { 1069 MidiSend(noteOn1, 73, velocity); 1070 lastA[7][0] = 7; 1071 } 1072 //Write Midi Note Off 1073 if ((keysA[7][0] == 1) and (lastA[7][0] == 7)) { 1074 MidiSend(noteOff1, 73, velocity); 1075 lastA[7][0] = 0; 1076 } 1077 1078 //A74 1079 if ((keysA[7][1] == 0) and (lastA[7][1] == 0)) { 1080 MidiSend(noteOn1, 74, velocity); 1081 lastA[7][1] = 7; 1082 } 1083 //Write Midi Note Off 1084 if ((keysA[7][1] == 1) and (lastA[7][1] == 7)) { 1085 MidiSend(noteOff1, 74, velocity); 1086 lastA[7][1] = 0; 1087 } 1088 1089 //A75 1090 if ((keysA[7][2] == 0) and (lastA[7][2] == 0)) { 1091 MidiSend(noteOn1, 75, velocity); 1092 lastA[7][2] = 7; 1093 } 1094 //Write Midi Note Off 1095 if ((keysA[7][2] == 1) and (lastA[7][2] == 7)) { 1096 MidiSend(noteOff1, 75, velocity); 1097 lastA[7][2] = 0; 1098 } 1099 1100 //A76 1101 if ((keysA[7][3] == 0) and (lastA[7][3] == 0)) { 1102 MidiSend(noteOn1, 76, velocity); 1103 lastA[7][3] = 7; 1104 } 1105 //Write Midi Note Off 1106 if ((keysA[7][3] == 1) and (lastA[7][3] == 7)) { 1107 MidiSend(noteOff1, 76, velocity); 1108 lastA[7][3] = 0; 1109 } 1110 1111 //A77 1112 if ((keysA[7][4] == 0) and (lastA[7][4] == 0)) { 1113 MidiSend(noteOn1, 77, velocity); 1114 lastA[7][4] = 7; 1115 } 1116 //Write Midi Note Off 1117 if ((keysA[7][4] == 1) and (lastA[7][4] == 7)) { 1118 MidiSend(noteOff1, 77, velocity); 1119 lastA[7][4] = 0; 1120 } 1121 1122 //A78 1123 if ((keysA[7][5] == 0) and (lastA[7][5] == 0)) { 1124 MidiSend(noteOn1, 78, velocity); 1125 lastA[7][5] = 7; 1126 } 1127 //Write Midi Note Off 1128 if ((keysA[7][5] == 1) and (lastA[7][5] == 7)) { 1129 MidiSend(noteOff1, 78, velocity); 1130 lastA[7][5] = 0; 1131 } 1132 1133 //A79 1134 if ((keysA[8][0] == 0) and (lastA[8][0] == 0)) { 1135 MidiSend(noteOn1, 79, velocity); 1136 lastA[8][0] = 7; 1137 } 1138 //Write Midi Note Off 1139 if ((keysA[8][0] == 1) and (lastA[8][0] == 7)) { 1140 MidiSend(noteOff1, 79, velocity); 1141 lastA[8][0] = 0; 1142 } 1143 1144 //A80 1145 if ((keysA[8][1] == 0) and (lastA[8][1] == 0)) { 1146 MidiSend(noteOn1, 80, velocity); 1147 lastA[8][1] = 7; 1148 } 1149 //Write Midi Note Off 1150 if ((keysA[8][1] == 1) and (lastA[8][1] == 7)) { 1151 MidiSend(noteOff1, 80, velocity); 1152 lastA[8][1] = 0; 1153 } 1154 1155 //A81 1156 if ((keysA[8][2] == 0) and (lastA[8][2] == 0)) { 1157 MidiSend(noteOn1, 81, velocity); 1158 lastA[8][2] = 7; 1159 } 1160 //Write Midi Note Off 1161 if ((keysA[8][2] == 1) and (lastA[8][2] == 7)) { 1162 MidiSend(noteOff1, 81, velocity); 1163 lastA[8][2] = 0; 1164 } 1165 1166 //A82 1167 if ((keysA[8][3] == 0) and (lastA[8][3] == 0)) { 1168 MidiSend(noteOn1, 82, velocity); 1169 lastA[8][3] = 7; 1170 } 1171 //Write Midi Note Off 1172 if ((keysA[8][3] == 1) and (lastA[8][3] == 7)) { 1173 MidiSend(noteOff1, 82, velocity); 1174 lastA[8][3] = 0; 1175 } 1176 1177 //A83 1178 if ((keysA[8][4] == 0) and (lastA[8][4] == 0)) { 1179 MidiSend(noteOn1, 83, velocity); 1180 lastA[8][4] = 7; 1181 } 1182 //Write Midi Note Off 1183 if ((keysA[8][4] == 1) and (lastA[8][4] == 7)) { 1184 MidiSend(noteOff1, 83, velocity); 1185 lastA[8][4] = 0; 1186 } 1187 1188 //A84 1189 if ((keysA[8][5] == 0) and (lastA[8][5] == 0)) { 1190 MidiSend(noteOn1, 84, velocity); 1191 lastA[8][5] = 7; 1192 } 1193 //Write Midi Note Off 1194 if ((keysA[8][5] == 1) and (lastA[8][5] == 7)) { 1195 MidiSend(noteOff1, 84, velocity); 1196 lastA[8][5] = 0; 1197 } 1198 1199 //A85 1200 if ((keysA[9][0] == 0) and (lastA[9][0] == 0)) { 1201 MidiSend(noteOn1, 85, velocity); 1202 lastA[9][0] = 7; 1203 } 1204 //Write Midi Note Off 1205 if ((keysA[9][0] == 1) and (lastA[9][0] == 7)) { 1206 MidiSend(noteOff1, 85, velocity); 1207 lastA[9][0] = 0; 1208 } 1209 1210 //A86 1211 if ((keysA[9][1] == 0) and (lastA[9][1] == 0)) { 1212 MidiSend(noteOn1, 86, velocity); 1213 lastA[9][1] = 7; 1214 } 1215 //Write Midi Note Off 1216 if ((keysA[9][1] == 1) and (lastA[9][1] == 7)) { 1217 MidiSend(noteOff1, 86, velocity); 1218 lastA[9][1] = 0; 1219 } 1220 1221 //A87 1222 if ((keysA[9][2] == 0) and (lastA[9][2] == 0)) { 1223 MidiSend(noteOn1, 87, velocity); 1224 lastA[9][2] = 7; 1225 } 1226 //Write Midi Note Off 1227 if ((keysA[9][2] == 1) and (lastA[9][2] == 7)) { 1228 MidiSend(noteOff1, 87, velocity); 1229 lastA[9][2] = 0; 1230 } 1231 1232 //A88 1233 if ((keysA[9][3] == 0) and (lastA[9][3] == 0)) { 1234 MidiSend(noteOn1, 88, velocity); 1235 lastA[9][3] = 7; 1236 } 1237 //Write Midi Note Off 1238 if ((keysA[9][3] == 1) and (lastA[9][3] == 7)) { 1239 MidiSend(noteOff1, 88, velocity); 1240 lastA[9][3] = 0; 1241 } 1242 1243 //A89 1244 if ((keysA[9][4] == 0) and (lastA[9][4] == 0)) { 1245 MidiSend(noteOn1, 89, velocity); 1246 lastA[9][4] = 7; 1247 } 1248 //Write Midi Note Off 1249 if ((keysA[9][4] == 1) and (lastA[9][4] == 7)) { 1250 MidiSend(noteOff1, 89, velocity); 1251 lastA[9][4] = 0; 1252 } 1253 1254 //A90 1255 if ((keysA[9][5] == 0) and (lastA[9][5] == 0)) { 1256 MidiSend(noteOn1, 90, velocity); 1257 lastA[9][5] = 7; 1258 } 1259 //Write Midi Note Off 1260 if ((keysA[9][5] == 1) and (lastA[9][5] == 7)) { 1261 MidiSend(noteOff1, 90, velocity); 1262 lastA[9][5] = 0; 1263 } 1264 1265 //A91 1266 if ((keysA[10][0] == 0) and (lastA[10][0] == 0)) { 1267 MidiSend(noteOn1, 91, velocity); 1268 lastA[10][0] = 7; 1269 } 1270 //Write Midi Note Off 1271 if ((keysA[10][0] == 1) and (lastA[10][0] == 7)) { 1272 MidiSend(noteOff1, 91, velocity); 1273 lastA[10][0] = 0; 1274 } 1275 1276 //A92 1277 if ((keysA[10][1] == 0) and (lastA[10][1] == 0)) { 1278 MidiSend(noteOn1, 92, velocity); 1279 lastA[10][1] = 7; 1280 } 1281 //Write Midi Note Off 1282 if ((keysA[10][1] == 1) and (lastA[10][1] == 7)) { 1283 MidiSend(noteOff1, 92, velocity); 1284 lastA[10][1] = 0; 1285 } 1286 1287 //A93 1288 if ((keysA[10][2] == 0) and (lastA[10][2] == 0)) { 1289 MidiSend(noteOn1, 93, velocity); 1290 lastA[10][2] = 7; 1291 } 1292 //Write Midi Note Off 1293 if ((keysA[10][2] == 1) and (lastA[10][2] == 7)) { 1294 MidiSend(noteOff1, 93, velocity); 1295 lastA[10][2] = 0; 1296 } 1297 1298 //A94 1299 if ((keysA[10][3] == 0) and (lastA[10][3] == 0)) { 1300 MidiSend(noteOn1, 94, velocity); 1301 lastA[10][3] = 7; 1302 } 1303 //Write Midi Note Off 1304 if ((keysA[10][3] == 1) and (lastA[10][3] == 7)) { 1305 MidiSend(noteOff1, 94, velocity); 1306 lastA[10][3] = 0; 1307 } 1308 1309 //A95 1310 if ((keysA[10][4] == 0) and (lastA[10][4] == 0)) { 1311 MidiSend(noteOn1, 95, velocity); 1312 lastA[10][4] = 7; 1313 } 1314 //Write Midi Note Off 1315 if ((keysA[10][4] == 1) and (lastA[10][4] == 7)) { 1316 MidiSend(noteOff1, 95, velocity); 1317 lastA[10][4] = 0; 1318 } 1319 1320 //A96 1321 if ((keysA[10][5] == 0) and (lastA[10][5] == 0)) { 1322 MidiSend(noteOn1, 96, velocity); 1323 lastA[10][5] = 7; 1324 } 1325 //Write Midi Note Off 1326 if ((keysA[10][5] == 1) and (lastA[10][5] == 7)) { 1327 MidiSend(noteOff1, 96, velocity); 1328 lastA[10][5] = 0; 1329 } 1330 1331 //Write Keyboard B 1332 1333 //B36 1334 if ((keysB[0][0] == 0) and (lastB[0][0] == 0)) { 1335 MidiSend(noteOn2, 36, velocity); 1336 lastB[0][0] = 7; 1337 } 1338 if ((keysB[0][0] == 1) and (lastB[0][0] == 7)) { 1339 MidiSend(noteOff2, 36, velocity); 1340 lastB[0][0] = 0; 1341 } 1342 1343 //B37 1344 if ((keysB[1][0] == 0) and (lastB[1][0] == 0)) { 1345 MidiSend(noteOn2, 37, velocity); 1346 lastB[1][0] = 7; 1347 } 1348 if ((keysB[1][0] == 1) and (lastB[1][0] == 7)) { 1349 MidiSend(noteOff2, 37, velocity); 1350 lastB[1][0] = 0; 1351 } 1352 1353 //B38 1354 if ((keysB[1][1] == 0) and (lastB[1][1] == 0)) { 1355 MidiSend(noteOn2, 38, velocity); 1356 lastB[1][1] = 7; 1357 } 1358 //Write Midi Note Off 1359 if ((keysB[1][1] == 1) and (lastB[1][1] == 7)) { 1360 MidiSend(noteOff2, 38, velocity); 1361 lastB[1][1] = 0; 1362 } 1363 1364 //B39 1365 if ((keysB[1][2] == 0) and (lastB[1][2] == 0)) { 1366 MidiSend(noteOn2, 39, velocity); 1367 lastB[1][2] = 7; 1368 } 1369 //Write Midi Note Off 1370 if ((keysB[1][2] == 1) and (lastB[1][2] == 7)) { 1371 MidiSend(noteOff2, 39, velocity); 1372 lastB[1][2] = 0; 1373 } 1374 1375 //B40 1376 if ((keysB[1][3] == 0) and (lastB[1][3] == 0)) { 1377 MidiSend(noteOn2, 40, velocity); 1378 lastB[1][3] = 7; 1379 } 1380 //Write Midi Note Off 1381 if ((keysB[1][3] == 1) and (lastB[1][3] == 7)) { 1382 MidiSend(noteOff2, 40, velocity); 1383 lastB[1][3] = 0; 1384 } 1385 1386 //B41 1387 if ((keysB[1][4] == 0) and (lastB[1][4] == 0)) { 1388 MidiSend(noteOn2, 41, velocity); 1389 lastB[1][4] = 7; 1390 } 1391 //Write Midi Note Off 1392 if ((keysB[1][4] == 1) and (lastB[1][4] == 7)) { 1393 MidiSend(noteOff2, 41, velocity); 1394 lastB[1][4] = 0; 1395 } 1396 1397 //B42 1398 if ((keysB[1][5] == 0) and (lastB[1][5] == 0)) { 1399 MidiSend(noteOn2, 42, velocity); 1400 lastB[1][5] = 7; 1401 } 1402 //Write Midi Note Off 1403 if ((keysB[1][5] == 1) and (lastB[1][5] == 7)) { 1404 MidiSend(noteOff2, 42, velocity); 1405 lastB[1][5] = 0; 1406 } 1407 1408 //B43 1409 if ((keysB[2][0] == 0) and (lastB[2][0] == 0)) { 1410 MidiSend(noteOn2, 43, velocity); 1411 lastB[2][0] = 7; 1412 } 1413 //Write Midi Note Off 1414 if ((keysB[2][0] == 1) and (lastB[2][0] == 7)) { 1415 MidiSend(noteOff2, 43, velocity); 1416 lastB[2][0] = 0; 1417 } 1418 1419 //B44 1420 if ((keysB[2][1] == 0) and (lastB[2][1] == 0)) { 1421 MidiSend(noteOn2, 44, velocity); 1422 lastB[2][1] = 7; 1423 } 1424 //Write Midi Note Off 1425 if ((keysB[2][1] == 1) and (lastB[2][1] == 7)) { 1426 MidiSend(noteOff2, 44, velocity); 1427 lastB[2][1] = 0; 1428 } 1429 1430 //B45 1431 if ((keysB[2][2] == 0) and (lastB[2][2] == 0)) { 1432 MidiSend(noteOn2, 45, velocity); 1433 lastB[2][2] = 7; 1434 } 1435 //Write Midi Note Off 1436 if ((keysB[2][2] == 1) and (lastB[2][2] == 7)) { 1437 MidiSend(noteOff2, 45, velocity); 1438 lastB[2][2] = 0; 1439 } 1440 1441 //B46 1442 if ((keysB[2][3] == 0) and (lastB[2][3] == 0)) { 1443 MidiSend(noteOn2, 46, velocity); 1444 lastB[2][3] = 7; 1445 } 1446 //Write Midi Note Off 1447 if ((keysB[2][3] == 1) and (lastB[2][3] == 7)) { 1448 MidiSend(noteOff2, 46, velocity); 1449 lastB[2][3] = 0; 1450 } 1451 1452 //B47 1453 if ((keysB[2][4] == 0) and (lastB[2][4] == 0)) { 1454 MidiSend(noteOn2, 47, velocity); 1455 lastB[2][4] = 7; 1456 } 1457 //Write Midi Note Off 1458 if ((keysB[2][4] == 1) and (lastB[2][4] == 7)) { 1459 MidiSend(noteOff2, 47, velocity); 1460 lastB[2][4] = 0; 1461 } 1462 1463 //B48 1464 if ((keysB[2][5] == 0) and (lastB[2][5] == 0)) { 1465 MidiSend(noteOn2, 48, velocity); 1466 lastB[2][5] = 7; 1467 } 1468 //Write Midi Note Off 1469 if ((keysB[2][5] == 1) and (lastB[2][5] == 7)) { 1470 MidiSend(noteOff2, 48, velocity); 1471 lastB[2][5] = 0; 1472 } 1473 1474 //B49 1475 if ((keysB[3][0] == 0) and (lastB[3][0] == 0)) { 1476 MidiSend(noteOn2, 49, velocity); 1477 lastB[3][0] = 7; 1478 } 1479 //Write Midi Note Off 1480 if ((keysB[3][0] == 1) and (lastB[3][0] == 7)) { 1481 MidiSend(noteOff2, 49, velocity); 1482 lastB[3][0] = 0; 1483 } 1484 1485 //B50 1486 if ((keysB[3][1] == 0) and (lastB[3][1] == 0)) { 1487 MidiSend(noteOn2, 50, velocity); 1488 lastB[3][1] = 7; 1489 } 1490 //Write Midi Note Off 1491 if ((keysB[3][1] == 1) and (lastB[3][1] == 7)) { 1492 MidiSend(noteOff2, 50, velocity); 1493 lastB[3][1] = 0; 1494 } 1495 1496 //B51 1497 if ((keysB[3][2] == 0) and (lastB[3][2] == 0)) { 1498 MidiSend(noteOn2, 51, velocity); 1499 lastB[3][2] = 7; 1500 } 1501 //Write Midi Note Off 1502 if ((keysB[3][2] == 1) and (lastB[3][2] == 7)) { 1503 MidiSend(noteOff2, 51, velocity); 1504 lastB[3][2] = 0; 1505 } 1506 1507 //B52 1508 if ((keysB[3][3] == 0) and (lastB[3][3] == 0)) { 1509 MidiSend(noteOn2, 52, velocity); 1510 lastB[3][3] = 7; 1511 } 1512 //Write Midi Note Off 1513 if ((keysB[3][3] == 1) and (lastB[3][3] == 7)) { 1514 MidiSend(noteOff2, 52, velocity); 1515 lastB[3][3] = 0; 1516 } 1517 1518 //B53 1519 if ((keysB[3][4] == 0) and (lastB[3][4] == 0)) { 1520 MidiSend(noteOn2, 53, velocity); 1521 lastB[3][4] = 7; 1522 } 1523 //Write Midi Note Off 1524 if ((keysB[3][4] == 1) and (lastB[3][4] == 7)) { 1525 MidiSend(noteOff2, 53, velocity); 1526 lastB[3][4] = 0; 1527 } 1528 1529 //B54 1530 if ((keysB[3][5] == 0) and (lastB[3][5] == 0)) { 1531 MidiSend(noteOn2, 54, velocity); 1532 lastB[3][5] = 7; 1533 } 1534 //Write Midi Note Off 1535 if ((keysB[3][5] == 1) and (lastB[3][5] == 7)) { 1536 MidiSend(noteOff2, 54, velocity); 1537 lastB[3][5] = 0; 1538 } 1539 1540 //B55 1541 if ((keysB[4][0] == 0) and (lastB[4][0] == 0)) { 1542 MidiSend(noteOn2, 55, velocity); 1543 lastB[4][0] = 7; 1544 } 1545 //Write Midi Note Off 1546 if ((keysB[4][0] == 1) and (lastB[4][0] == 7)) { 1547 MidiSend(noteOff2, 55, velocity); 1548 lastB[4][0] = 0; 1549 } 1550 1551 //B56 1552 if ((keysB[4][1] == 0) and (lastB[4][1] == 0)) { 1553 MidiSend(noteOn2, 56, velocity); 1554 lastB[4][1] = 7; 1555 } 1556 //Write Midi Note Off 1557 if ((keysB[4][1] == 1) and (lastB[4][1] == 7)) { 1558 MidiSend(noteOff2, 56, velocity); 1559 lastB[4][1] = 0; 1560 } 1561 1562 //B57 1563 if ((keysB[4][2] == 0) and (lastB[4][2] == 0)) { 1564 MidiSend(noteOn2, 57, velocity); 1565 lastB[4][2] = 7; 1566 } 1567 //Write Midi Note Off 1568 if ((keysB[4][2] == 1) and (lastB[4][2] == 7)) { 1569 MidiSend(noteOff2, 57, velocity); 1570 lastB[4][2] = 0; 1571 } 1572 1573 //B58 1574 if ((keysB[4][3] == 0) and (lastB[4][3] == 0)) { 1575 MidiSend(noteOn2, 58, velocity); 1576 lastB[4][3] = 7; 1577 } 1578 //Write Midi Note Off 1579 if ((keysB[4][3] == 1) and (lastB[4][3] == 7)) { 1580 MidiSend(noteOff2, 58, velocity); 1581 lastB[4][3] = 0; 1582 } 1583 1584 //B59 1585 if ((keysB[4][4] == 0) and (lastB[4][4] == 0)) { 1586 MidiSend(noteOn2, 59, velocity); 1587 lastB[4][4] = 7; 1588 } 1589 //Write Midi Note Off 1590 if ((keysB[4][4] == 1) and (lastB[4][4] == 7)) { 1591 MidiSend(noteOff2, 59, velocity); 1592 lastB[4][4] = 0; 1593 } 1594 1595 //B60 1596 if ((keysB[4][5] == 0) and (lastB[4][5] == 0)) { 1597 MidiSend(noteOn2, 60, velocity); 1598 lastB[4][5] = 7; 1599 } 1600 //Write Midi Note Off 1601 if ((keysB[4][5] == 1) and (lastB[4][5] == 7)) { 1602 MidiSend(noteOff2, 60, velocity); 1603 lastB[4][5] = 0; 1604 } 1605 1606 //B61 1607 if ((keysB[5][0] == 0) and (lastB[5][0] == 0)) { 1608 MidiSend(noteOn2, 61, velocity); 1609 lastB[5][0] = 7; 1610 } 1611 //Write Midi Note Off 1612 if ((keysB[5][0] == 1) and (lastB[5][0] == 7)) { 1613 MidiSend(noteOff2, 61, velocity); 1614 lastB[5][0] = 0; 1615 } 1616 1617 //B62 1618 if ((keysB[5][1] == 0) and (lastB[5][1] == 0)) { 1619 MidiSend(noteOn2, 62, velocity); 1620 lastB[5][1] = 7; 1621 } 1622 //Write Midi Note Off 1623 if ((keysB[5][1] == 1) and (lastB[5][1] == 7)) { 1624 MidiSend(noteOff2, 62, velocity); 1625 lastB[5][1] = 0; 1626 } 1627 1628 //B63 1629 if ((keysB[5][2] == 0) and (lastB[5][2] == 0)) { 1630 MidiSend(noteOn2, 63, velocity); 1631 lastB[5][2] = 7; 1632 } 1633 //Write Midi Note Off 1634 if ((keysB[5][2] == 1) and (lastB[5][2] == 7)) { 1635 MidiSend(noteOff2, 63, velocity); 1636 lastB[5][2] = 0; 1637 } 1638 1639 //B64 1640 if ((keysB[5][3] == 0) and (lastB[5][3] == 0)) { 1641 MidiSend(noteOn2, 64, velocity); 1642 lastB[5][3] = 7; 1643 } 1644 //Write Midi Note Off 1645 if ((keysB[5][3] == 1) and (lastB[5][3] == 7)) { 1646 MidiSend(noteOff2, 64, velocity); 1647 lastB[5][3] = 0; 1648 } 1649 1650 //B65 1651 if ((keysB[5][4] == 0) and (lastB[5][4] == 0)) { 1652 MidiSend(noteOn2, 65, velocity); 1653 lastB[5][4] = 7; 1654 } 1655 //Write Midi Note Off 1656 if ((keysB[5][4] == 1) and (lastB[5][4] == 7)) { 1657 MidiSend(noteOff2, 65, velocity); 1658 lastB[5][4] = 0; 1659 } 1660 1661 //B66 1662 if ((keysB[5][5] == 0) and (lastB[5][5] == 0)) { 1663 MidiSend(noteOn2, 66, velocity); 1664 lastB[5][5] = 7; 1665 } 1666 //Write Midi Note Off 1667 if ((keysB[5][5] == 1) and (lastB[5][5] == 7)) { 1668 MidiSend(noteOff2, 66, velocity); 1669 lastB[5][5] = 0; 1670 } 1671 1672 //B67 1673 if ((keysB[6][0] == 0) and (lastB[6][0] == 0)) { 1674 MidiSend(noteOn2, 67, velocity); 1675 lastB[6][0] = 7; 1676 } 1677 //Write Midi Note Off 1678 if ((keysB[6][0] == 1) and (lastB[6][0] == 7)) { 1679 MidiSend(noteOff2, 67, velocity); 1680 lastB[6][0] = 0; 1681 } 1682 1683 //B68 1684 if ((keysB[6][1] == 0) and (lastB[6][1] == 0)) { 1685 MidiSend(noteOn2, 68, velocity); 1686 lastB[6][1] = 7; 1687 } 1688 //Write Midi Note Off 1689 if ((keysB[6][1] == 1) and (lastB[6][1] == 7)) { 1690 MidiSend(noteOff2, 68, velocity); 1691 lastB[6][1] = 0; 1692 } 1693 1694 //B69 1695 if ((keysB[6][2] == 0) and (lastB[6][2] == 0)) { 1696 MidiSend(noteOn2, 69, velocity); 1697 lastB[6][2] = 7; 1698 } 1699 //Write Midi Note Off 1700 if ((keysB[6][2] == 1) and (lastB[6][2] == 7)) { 1701 MidiSend(noteOff2, 69, velocity); 1702 lastB[6][2] = 0; 1703 } 1704 1705 //B70 1706 if ((keysB[6][3] == 0) and (lastB[6][3] == 0)) { 1707 MidiSend(noteOn2, 70, velocity); 1708 lastB[6][3] = 7; 1709 } 1710 //Write Midi Note Off 1711 if ((keysB[6][3] == 1) and (lastB[6][3] == 7)) { 1712 MidiSend(noteOff2, 70, velocity); 1713 lastB[6][3] = 0; 1714 } 1715 1716 //B71 1717 if ((keysB[6][4] == 0) and (lastB[6][4] == 0)) { 1718 MidiSend(noteOn2, 71, velocity); 1719 lastB[6][4] = 7; 1720 } 1721 //Write Midi Note Off 1722 if ((keysB[6][4] == 1) and (lastB[6][4] == 7)) { 1723 MidiSend(noteOff2, 71, velocity); 1724 lastB[6][4] = 0; 1725 } 1726 1727 //B72 1728 if ((keysB[6][5] == 0) and (lastB[6][5] == 0)) { 1729 MidiSend(noteOn2, 72, velocity); 1730 lastB[6][5] = 7; 1731 } 1732 //Write Midi Note Off 1733 if ((keysB[6][5] == 1) and (lastB[6][5] == 7)) { 1734 MidiSend(noteOff2, 72, velocity); 1735 lastB[6][5] = 0; 1736 } 1737 1738 //B73 1739 if ((keysB[7][0] == 0) and (lastB[7][0] == 0)) { 1740 MidiSend(noteOn2, 73, velocity); 1741 lastB[7][0] = 7; 1742 } 1743 //Write Midi Note Off 1744 if ((keysB[7][0] == 1) and (lastB[7][0] == 7)) { 1745 MidiSend(noteOff2, 73, velocity); 1746 lastB[7][0] = 0; 1747 } 1748 1749 //B74 1750 if ((keysB[7][1] == 0) and (lastB[7][1] == 0)) { 1751 MidiSend(noteOn2, 74, velocity); 1752 lastB[7][1] = 7; 1753 } 1754 //Write Midi Note Off 1755 if ((keysB[7][1] == 1) and (lastB[7][1] == 7)) { 1756 MidiSend(noteOff2, 74, velocity); 1757 lastB[7][1] = 0; 1758 } 1759 1760 //B75 1761 if ((keysB[7][2] == 0) and (lastB[7][2] == 0)) { 1762 MidiSend(noteOn2, 75, velocity); 1763 lastB[7][2] = 7; 1764 } 1765 //Write Midi Note Off 1766 if ((keysB[7][2] == 1) and (lastB[7][2] == 7)) { 1767 MidiSend(noteOff2, 75, velocity); 1768 lastB[7][2] = 0; 1769 } 1770 1771 //B76 1772 if ((keysB[7][3] == 0) and (lastB[7][3] == 0)) { 1773 MidiSend(noteOn2, 76, velocity); 1774 lastB[7][3] = 7; 1775 } 1776 //Write Midi Note Off 1777 if ((keysB[7][3] == 1) and (lastB[7][3] == 7)) { 1778 MidiSend(noteOff2, 76, velocity); 1779 lastB[7][3] = 0; 1780 } 1781 1782 //B77 1783 if ((keysB[7][4] == 0) and (lastB[7][4] == 0)) { 1784 MidiSend(noteOn2, 77, velocity); 1785 lastB[7][4] = 7; 1786 } 1787 //Write Midi Note Off 1788 if ((keysB[7][4] == 1) and (lastB[7][4] == 7)) { 1789 MidiSend(noteOff2, 77, velocity); 1790 lastB[7][4] = 0; 1791 } 1792 1793 //B78 1794 if ((keysB[7][5] == 0) and (lastB[7][5] == 0)) { 1795 MidiSend(noteOn2, 78, velocity); 1796 lastB[7][5] = 7; 1797 } 1798 //Write Midi Note Off 1799 if ((keysB[7][5] == 1) and (lastB[7][5] == 7)) { 1800 MidiSend(noteOff2, 78, velocity); 1801 lastB[7][5] = 0; 1802 } 1803 1804 //B79 1805 if ((keysB[8][0] == 0) and (lastB[8][0] == 0)) { 1806 MidiSend(noteOn2, 79, velocity); 1807 lastB[8][0] = 7; 1808 } 1809 //Write Midi Note Off 1810 if ((keysB[8][0] == 1) and (lastB[8][0] == 7)) { 1811 MidiSend(noteOff2, 79, velocity); 1812 lastB[8][0] = 0; 1813 } 1814 1815 //B80 1816 if ((keysB[8][1] == 0) and (lastB[8][1] == 0)) { 1817 MidiSend(noteOn2, 80, velocity); 1818 lastB[8][1] = 7; 1819 } 1820 //Write Midi Note Off 1821 if ((keysB[8][1] == 1) and (lastB[8][1] == 7)) { 1822 MidiSend(noteOff2, 80, velocity); 1823 lastB[8][1] = 0; 1824 } 1825 1826 //B81 1827 if ((keysB[8][2] == 0) and (lastB[8][2] == 0)) { 1828 MidiSend(noteOn2, 81, velocity); 1829 lastB[8][2] = 7; 1830 } 1831 //Write Midi Note Off 1832 if ((keysB[8][2] == 1) and (lastB[8][2] == 7)) { 1833 MidiSend(noteOff2, 81, velocity); 1834 lastB[8][2] = 0; 1835 } 1836 1837 //B82 1838 if ((keysB[8][3] == 0) and (lastB[8][3] == 0)) { 1839 MidiSend(noteOn2, 82, velocity); 1840 lastB[8][3] = 7; 1841 } 1842 //Write Midi Note Off 1843 if ((keysB[8][3] == 1) and (lastB[8][3] == 7)) { 1844 MidiSend(noteOff2, 82, velocity); 1845 lastB[8][3] = 0; 1846 } 1847 1848 //B83 1849 if ((keysB[8][4] == 0) and (lastB[8][4] == 0)) { 1850 MidiSend(noteOn2, 83, velocity); 1851 lastB[8][4] = 7; 1852 } 1853 //Write Midi Note Off 1854 if ((keysB[8][4] == 1) and (lastB[8][4] == 7)) { 1855 MidiSend(noteOff2, 83, velocity); 1856 lastB[8][4] = 0; 1857 } 1858 1859 //B84 1860 if ((keysB[8][5] == 0) and (lastB[8][5] == 0)) { 1861 MidiSend(noteOn2, 84, velocity); 1862 lastB[8][5] = 7; 1863 } 1864 //Write Midi Note Off 1865 if ((keysB[8][5] == 1) and (lastB[8][5] == 7)) { 1866 MidiSend(noteOff2, 84, velocity); 1867 lastB[8][5] = 0; 1868 } 1869 1870 //B85 1871 if ((keysB[9][0] == 0) and (lastB[9][0] == 0)) { 1872 MidiSend(noteOn2, 85, velocity); 1873 lastB[9][0] = 7; 1874 } 1875 //Write Midi Note Off 1876 if ((keysB[9][0] == 1) and (lastB[9][0] == 7)) { 1877 MidiSend(noteOff2, 85, velocity); 1878 lastB[9][0] = 0; 1879 } 1880 1881 //B86 1882 if ((keysB[9][1] == 0) and (lastB[9][1] == 0)) { 1883 MidiSend(noteOn2, 86, velocity); 1884 lastB[9][1] = 7; 1885 } 1886 //Write Midi Note Off 1887 if ((keysB[9][1] == 1) and (lastB[9][1] == 7)) { 1888 MidiSend(noteOff2, 86, velocity); 1889 lastB[9][1] = 0; 1890 } 1891 1892 //B87 1893 if ((keysB[9][2] == 0) and (lastB[9][2] == 0)) { 1894 MidiSend(noteOn2, 87, velocity); 1895 lastB[9][2] = 7; 1896 } 1897 //Write Midi Note Off 1898 if ((keysB[9][2] == 1) and (lastB[9][2] == 7)) { 1899 MidiSend(noteOff2, 87, velocity); 1900 lastB[9][2] = 0; 1901 } 1902 1903 //B88 1904 if ((keysB[9][3] == 0) and (lastB[9][3] == 0)) { 1905 MidiSend(noteOn2, 88, velocity); 1906 lastB[9][3] = 7; 1907 } 1908 //Write Midi Note Off 1909 if ((keysB[9][3] == 1) and (lastB[9][3] == 7)) { 1910 MidiSend(noteOff2, 88, velocity); 1911 lastB[9][3] = 0; 1912 } 1913 1914 //B89 1915 if ((keysB[9][4] == 0) and (lastB[9][4] == 0)) { 1916 MidiSend(noteOn2, 89, velocity); 1917 lastB[9][4] = 7; 1918 } 1919 //Write Midi Note Off 1920 if ((keysB[9][4] == 1) and (lastB[9][4] == 7)) { 1921 MidiSend(noteOff2, 89, velocity); 1922 lastB[9][4] = 0; 1923 } 1924 1925 //B90 1926 if ((keysB[9][5] == 0) and (lastB[9][5] == 0)) { 1927 MidiSend(noteOn2, 90, velocity); 1928 lastB[9][5] = 7; 1929 } 1930 //Write Midi Note Off 1931 if ((keysB[9][5] == 1) and (lastB[9][5] == 7)) { 1932 MidiSend(noteOff2, 90, velocity); 1933 lastB[9][5] = 0; 1934 } 1935 1936 //B91 1937 if ((keysB[10][0] == 0) and (lastB[10][0] == 0)) { 1938 MidiSend(noteOn2, 91, velocity); 1939 lastB[10][0] = 7; 1940 } 1941 //Write Midi Note Off 1942 if ((keysB[10][0] == 1) and (lastB[10][0] == 7)) { 1943 MidiSend(noteOff2, 91, velocity); 1944 lastB[10][0] = 0; 1945 } 1946 1947 //B92 1948 if ((keysB[10][1] == 0) and (lastB[10][1] == 0)) { 1949 MidiSend(noteOn2, 92, velocity); 1950 lastB[10][1] = 7; 1951 } 1952 //Write Midi Note Off 1953 if ((keysB[10][1] == 1) and (lastB[10][1] == 7)) { 1954 MidiSend(noteOff2, 92, velocity); 1955 lastB[10][1] = 0; 1956 } 1957 1958 //B93 1959 if ((keysB[10][2] == 0) and (lastB[10][2] == 0)) { 1960 MidiSend(noteOn2, 93, velocity); 1961 lastB[10][2] = 7; 1962 } 1963 //Write Midi Note Off 1964 if ((keysB[10][2] == 1) and (lastB[10][2] == 7)) { 1965 MidiSend(noteOff2, 93, velocity); 1966 lastB[10][2] = 0; 1967 } 1968 1969 //B94 1970 if ((keysB[10][3] == 0) and (lastB[10][3] == 0)) { 1971 MidiSend(noteOn2, 94, velocity); 1972 lastB[10][3] = 7; 1973 } 1974 //Write Midi Note Off 1975 if ((keysB[10][3] == 1) and (lastB[10][3] == 7)) { 1976 MidiSend(noteOff2, 94, velocity); 1977 lastB[10][3] = 0; 1978 } 1979 1980 //B95 1981 if ((keysB[10][4] == 0) and (lastB[10][4] == 0)) { 1982 MidiSend(noteOn2, 95, velocity); 1983 lastB[10][4] = 7; 1984 } 1985 //Write Midi Note Off 1986 if ((keysB[10][4] == 1) and (lastB[10][4] == 7)) { 1987 MidiSend(noteOff2, 95, velocity); 1988 lastB[10][4] = 0; 1989 } 1990 1991 //B96 1992 if ((keysB[10][5] == 0) and (lastB[10][5] == 0)) { 1993 MidiSend(noteOn2, 96, velocity); 1994 lastB[10][5] = 7; 1995 } 1996 //Write Midi Note Off 1997 if ((keysB[10][5] == 1) and (lastB[10][5] == 7)) { 1998 MidiSend(noteOff2, 96, velocity); 1999 lastB[10][5] = 0; 2000 } 2001 2002 //Write Keyboard C 2003 2004 //C36 2005 if ((keysC[0][0] == 0) and (lastC[0][0] == 0)) { 2006 MidiSend(noteOff3, 36, velocity); 2007 lastC[0][0] = 7; 2008 } 2009 if ((keysC[0][0] == 1) and (lastC[0][0] == 7)) { 2010 MidiSend(noteOn3, 36, velocity); 2011 lastC[0][0] = 0; 2012 } 2013 2014 //C37 2015 if ((keysC[1][0] == 0) and (lastC[1][0] == 0)) { 2016 MidiSend(noteOff3, 37, velocity); 2017 lastC[1][0] = 7; 2018 } 2019 if ((keysC[1][0] == 1) and (lastC[1][0] == 7)) { 2020 MidiSend(noteOn3, 37, velocity); 2021 lastC[1][0] = 0; 2022 } 2023 2024 //C38 2025 if ((keysC[1][1] == 0) and (lastC[1][1] == 0)) { 2026 MidiSend(noteOff3, 38, velocity); 2027 lastC[1][1] = 7; 2028 } 2029 //Write Midi Note Off 2030 if ((keysC[1][1] == 1) and (lastC[1][1] == 7)) { 2031 MidiSend(noteOn3, 38, velocity); 2032 lastC[1][1] = 0; 2033 } 2034 2035 //C39 2036 if ((keysC[1][2] == 0) and (lastC[1][2] == 0)) { 2037 MidiSend(noteOff3, 39, velocity); 2038 lastC[1][2] = 7; 2039 } 2040 //Write Midi Note Off 2041 if ((keysC[1][2] == 1) and (lastC[1][2] == 7)) { 2042 MidiSend(noteOn3, 39, velocity); 2043 lastC[1][2] = 0; 2044 } 2045 2046 //C40 2047 if ((keysC[1][3] == 0) and (lastC[1][3] == 0)) { 2048 MidiSend(noteOff3, 40, velocity); 2049 lastC[1][3] = 7; 2050 } 2051 //Write Midi Note Off 2052 if ((keysC[1][3] == 1) and (lastC[1][3] == 7)) { 2053 MidiSend(noteOn3, 40, velocity); 2054 lastC[1][3] = 0; 2055 } 2056 2057 //C41 2058 if ((keysC[1][4] == 0) and (lastC[1][4] == 0)) { 2059 MidiSend(noteOff3, 41, velocity); 2060 lastC[1][4] = 7; 2061 } 2062 //Write Midi Note Off 2063 if ((keysC[1][4] == 1) and (lastC[1][4] == 7)) { 2064 MidiSend(noteOn3, 41, velocity); 2065 lastC[1][4] = 0; 2066 } 2067 2068 //C42 2069 if ((keysC[1][5] == 0) and (lastC[1][5] == 0)) { 2070 MidiSend(noteOff3, 42, velocity); 2071 lastC[1][5] = 7; 2072 } 2073 //Write Midi Note Off 2074 if ((keysC[1][5] == 1) and (lastC[1][5] == 7)) { 2075 MidiSend(noteOn3, 42, velocity); 2076 lastC[1][5] = 0; 2077 } 2078 2079 //C43 2080 if ((keysC[2][0] == 0) and (lastC[2][0] == 0)) { 2081 MidiSend(noteOff3, 43, velocity); 2082 lastC[2][0] = 7; 2083 } 2084 //Write Midi Note Off 2085 if ((keysC[2][0] == 1) and (lastC[2][0] == 7)) { 2086 MidiSend(noteOn3, 43, velocity); 2087 lastC[2][0] = 0; 2088 } 2089 2090 //C44 2091 if ((keysC[2][1] == 0) and (lastC[2][1] == 0)) { 2092 MidiSend(noteOff3, 44, velocity); 2093 lastC[2][1] = 7; 2094 } 2095 //Write Midi Note Off 2096 if ((keysC[2][1] == 1) and (lastC[2][1] == 7)) { 2097 MidiSend(noteOn3, 44, velocity); 2098 lastC[2][1] = 0; 2099 } 2100 2101 //C45 2102 if ((keysC[2][2] == 0) and (lastC[2][2] == 0)) { 2103 MidiSend(noteOff3, 45, velocity); 2104 lastC[2][2] = 7; 2105 } 2106 //Write Midi Note Off 2107 if ((keysC[2][2] == 1) and (lastC[2][2] == 7)) { 2108 MidiSend(noteOn3, 45, velocity); 2109 lastC[2][2] = 0; 2110 } 2111 2112 //C46 2113 if ((keysC[2][3] == 0) and (lastC[2][3] == 0)) { 2114 MidiSend(noteOff3, 46, velocity); 2115 lastC[2][3] = 7; 2116 } 2117 //Write Midi Note Off 2118 if ((keysC[2][3] == 1) and (lastC[2][3] == 7)) { 2119 MidiSend(noteOn3, 46, velocity); 2120 lastC[2][3] = 0; 2121 } 2122 2123 //C47 2124 if ((keysC[2][4] == 0) and (lastC[2][4] == 0)) { 2125 MidiSend(noteOff3, 47, velocity); 2126 lastC[2][4] = 7; 2127 } 2128 //Write Midi Note Off 2129 if ((keysC[2][4] == 1) and (lastC[2][4] == 7)) { 2130 MidiSend(noteOn3, 47, velocity); 2131 lastC[2][4] = 0; 2132 } 2133 2134 //C48 2135 if ((keysC[2][5] == 0) and (lastC[2][5] == 0)) { 2136 MidiSend(noteOff3, 48, velocity); 2137 lastC[2][5] = 7; 2138 } 2139 //Write Midi Note Off 2140 if ((keysC[2][5] == 1) and (lastC[2][5] == 7)) { 2141 MidiSend(noteOn3, 48, velocity); 2142 lastC[2][5] = 0; 2143 } 2144 2145 //C49 2146 if ((keysC[3][0] == 0) and (lastC[3][0] == 0)) { 2147 MidiSend(noteOff3, 49, velocity); 2148 lastC[3][0] = 7; 2149 } 2150 //Write Midi Note Off 2151 if ((keysC[3][0] == 1) and (lastC[3][0] == 7)) { 2152 MidiSend(noteOn3, 49, velocity); 2153 lastC[3][0] = 0; 2154 } 2155 2156 //C50 2157 if ((keysC[3][1] == 0) and (lastC[3][1] == 0)) { 2158 MidiSend(noteOff3, 50, velocity); 2159 lastC[3][1] = 7; 2160 } 2161 //Write Midi Note Off 2162 if ((keysC[3][1] == 1) and (lastC[3][1] == 7)) { 2163 MidiSend(noteOn3, 50, velocity); 2164 lastC[3][1] = 0; 2165 } 2166 2167 //C51 2168 if ((keysC[3][2] == 0) and (lastC[3][2] == 0)) { 2169 MidiSend(noteOff3, 51, velocity); 2170 lastC[3][2] = 7; 2171 } 2172 //Write Midi Note Off 2173 if ((keysC[3][2] == 1) and (lastC[3][2] == 7)) { 2174 MidiSend(noteOn3, 51, velocity); 2175 lastC[3][2] = 0; 2176 } 2177 2178 //C52 2179 if ((keysC[3][3] == 0) and (lastC[3][3] == 0)) { 2180 MidiSend(noteOff3, 52, velocity); 2181 lastC[3][3] = 7; 2182 } 2183 //Write Midi Note Off 2184 if ((keysC[3][3] == 1) and (lastC[3][3] == 7)) { 2185 MidiSend(noteOn3, 52, velocity); 2186 lastC[3][3] = 0; 2187 } 2188 2189 //C53 2190 if ((keysC[3][4] == 0) and (lastC[3][4] == 0)) { 2191 MidiSend(noteOff3, 53, velocity); 2192 lastC[3][4] = 7; 2193 } 2194 //Write Midi Note Off 2195 if ((keysC[3][4] == 1) and (lastC[3][4] == 7)) { 2196 MidiSend(noteOn3, 53, velocity); 2197 lastC[3][4] = 0; 2198 } 2199 2200 //C54 2201 if ((keysC[3][5] == 0) and (lastC[3][5] == 0)) { 2202 MidiSend(noteOff3, 54, velocity); 2203 lastC[3][5] = 7; 2204 } 2205 //Write Midi Note Off 2206 if ((keysC[3][5] == 1) and (lastC[3][5] == 7)) { 2207 MidiSend(noteOn3, 54, velocity); 2208 lastC[3][5] = 0; 2209 } 2210 2211 //C55 2212 if ((keysC[4][0] == 0) and (lastC[4][0] == 0)) { 2213 MidiSend(noteOff3, 55, velocity); 2214 lastC[4][0] = 7; 2215 } 2216 //Write Midi Note Off 2217 if ((keysC[4][0] == 1) and (lastC[4][0] == 7)) { 2218 MidiSend(noteOn3, 55, velocity); 2219 lastC[4][0] = 0; 2220 } 2221 2222 //C56 2223 if ((keysC[4][1] == 0) and (lastC[4