亿迅智能制造网
工业4.0先进制造技术信息网站!
首页 | 制造技术 | 制造设备 | 工业物联网 | 工业材料 | 设备保养维修 | 工业编程 |
home  MfgRobots >> 亿迅智能制造网 >  >> Manufacturing Technology >> 制造工艺

数字风琴的 MIDI

组件和用品

Arduino Mega 2560
× 1
DIN Midi Plug
× 1
电阻 220 ohm
× 1
USB-A 转 B 线
× 1
AWM 电缆
× 1
男性标题 40 位置 1 行 (0.1")
× 1
电位器,滑块
10K 线性
× 1
IDC 插座
(可选)
× 1
公/公跳线
(可选)
× 1

必要的工具和机器

烙铁(通用)
焊锡丝,无铅
助焊剂,焊接
剥线钳,锯齿钳头
钳子,侧切
钳子,平头

应用和在线服务

Arduino IDE

关于这个项目

该项目展示了如何转换旧的风琴控制台,以便使用单个 Arduino Mega 从手册和踏板发送硬件 MIDI 消息。

该项目开始时试图在原始声音生成仍然完好无损的情况下发送 midi 消息,但事实证明,原始电路很难进行逆向工程。在花了一些时间处理代码之后,我为总线型手册和矩阵型手册开发了代码。

备注:

  • 这个项目修改了风琴,使原来的键盘切换不再起作用。
  • 在一个旧管风琴里面,有可能很危险的电子元件。始终在拔下管风琴的情况下工作,并确保您具有安全地处理该项目的经验和技能。如有疑问,请在尝试此项目之前咨询合格的当地电子技术人员。
  • 旧器官内部的组件通常很旧并且处于故障的边缘,因此任何修改都可能导致器官损坏。遵循此处提供的说明由用户自行承担风险,本文作者不对因尝试遵循这些说明而对器官、任何设备或人员造成的任何损害承担任何责任。

第一步:检查器官

  • 我发布的第一个代码假设您要修改的风琴已经有一个矩阵键盘,并且已经安装了分立开关和二极管。自从发布第一个版本以来,我还开发了可用于总线键盘设计的代码。只需按照说明操作并使用适用于您的版本的代码(Matrixed 与 Bussed)。但是,对于这两种设计,您都需要将二极管连接到每个开关。这些可以便宜地获得。但是,上传到 Arduino Mega 的代码与矩阵设计和总线设计不同。
  • 在本例中中音的特定风琴具有用于键盘的常开 (NO) 开关和用于踏板的常闭开关 (NC)。使用万用表,您可以检查您计划转换的风琴具有哪些类型的开关。如果开关类型与为该器官所做的不同,则必须修改代码以适应开关类型(代码中给出了示例)
  • 弄清楚如何打开风琴以访问键盘和踏板触点,并寻找合适的位置将 Arduino 连接到风琴内。您可能需要钻孔或安装插头才能为 Arduino 供电,并安装 Midi 插头。在这个例子中,一个 3 插脚的电源插头连接到管风琴内部的一个小电源盒,为 Arduino 供电,并钻了一个孔,并将一个 Midi DIN 插头连接到孔上。
  • 此处显示的特定风琴有两个带有 6x11 矩阵的键盘和一个带有 6x7 矩阵的踏板。如果您打算走矩阵路线,并且特定器官已经有一个 8x8 矩阵,则需要修改代码和接线以适应 8x8 矩阵,或者必须重新连接原始矩阵以支持 6x11 矩阵。

第 2 步:连接 Arduino

- 我的 Arduino Mega 带有一个小塑料板,可以将它安装到风琴的木头上。我用 4 号小木螺钉和 4 号机械螺钉将其固定,将 Arduino 固定到板上。最好先放置 Arduino,这样您就可以估计每根电缆需要多长。这时,你也可以想办法给Arduino供电。

第 3 步:准备电缆

矩阵键盘:

每个键盘将有 61 个开关。在这里使用的示例中,每个键盘有 6 行,从每个开关的第一个端子到每隔 6 个开关的第一个端子的电线。开关的第二个端子接二极管,然后接列,其中开关分为11列用于手册,7列用于踏板。对于每个手册和踏板,需要切割两段推荐的 AWM 线,以便它们从每个分区到达 Arduino 板,最好遵循可以整齐组织的路径,并且始终留出比需要更多的余地。对于列,最好在连接到 Arduino 之前让电缆延长键盘或踏板的长度。测量每根电缆的长度,并切割成合适的尺寸。使用小钳子,将电缆末端的各个股线分开,然后使用剥线钳从电线末端剥去塑料覆盖物。

总线键盘:

键盘可以分成6条AWM线,第61开关用一根普通线。将电缆末端的单独股线分开,然后使用剥线钳剥去末端的塑料覆盖物。

第 4 步:将电缆末端焊接到公头

矩阵式和总线式键盘:将适当的电缆末端焊接到公头针脚上,或者如果使用螺钉端子板,请将适当的电缆连接到螺钉端子。

第 5 步:将电缆的另一端焊接到开关上

矩阵键盘:

- 如果管风琴的每个触点都已接线,则您必须拆焊或夹住原始电线才能使该项目正常工作。如果风琴有一个 6x11 矩阵,保留从每个开关到下一个开关 6 的行线是有意义的。因此,移除从第一组六根到原始计算机的排线,并将 6 排线焊接到其他 6 根原来所在的位置。对于列,如果它们已经安装了二极管,则将二极管另一端的引线剪断或拆焊到原始计算机,然后将连接到 Arduino 的列引线焊接到位。使用塑料扎线带,您可以整理电缆,使其沿着管风琴中其他电缆的走线整齐排列。对于上图风琴上的踏板,必须通过卸下固定在风琴上的螺钉来拆下包含簧片开关的风琴前面板,并将电缆穿过前面板中央的小孔器官。

总线键盘:

在总线键盘代码中,需要将二极管焊接到每个开关的非总线侧,然后将其焊接到电缆中的 10 根电线中的一根,然后对 6 根电缆中的每根重复,然后对最后一根电线重复(#61)

第 6 步:将电阻焊接到 MIDI 插头,然后将另一个引线焊接到 Arduino。

第 7 步:将标头连接到 Arduino

- 将所有接头插入 Arduino,如原理图所示。

- 将电线焊接到公头上的另一种解决方案是购买一些十针 IDC 插座,并将它们连接到 AWM 电缆的末端,然后使用公对公跳线连接到 Arduino。虽然此解决方案不像焊接那样永久,但如果您打算尝试修改发布的代码,以防需要重新布线,建议您这样做。

第 8 步:将软件上传到 Arduino

- 将 USB 电缆从 Arduino 连接到您的计算机,并确保您的计算机上安装了 Arduino 软件。选择适用于您的代码版本(Matrixed 与 Bussed)。运行 Arduino 软件,将提供的代码复制并粘贴到新的空白草图中。确保 Arduino 通过 USB 串行连接,然后单击草图顶部的“上传”按钮。

第 9 步:测试

  • 如果还没有完成,请将您的 MIDI 适配器连接到计算机,然后将管风琴 MIDI 输出连接到 MIDI 适配器。
  • 使用软件来监控 MIDI 信号,确保每个键和踏板在您按下琴键和按下每个琴键时发送适当的 MIDI 信息。
  • 如果您打算在不连接电脑的情况下使用,您可以将一个小型 5v 电源连接到 Arduino 的电源端口,或者将一个 USB 电源插头连接到您使用的 USB 电缆的末端,并将其插入插入墙上插座为 Arduino 供电。

备注:

  • 为总线式键盘发布的代码尚未经过测试,但预计会起作用。如果您尝试过总线代码并发现它存在一些问题,请在评论中发表。
  • 请注意,对于总线版本的代码,二极管是其正常工作所必需的。此外,将二极管焊接到开关上时,重要的是将二极管的负极朝向开关焊接。对于矩阵式设计,二极管的负极应远离开关。
  • 除了添加总线设计之外,我还更新了原始设计和代码以包含电位计,例如用于表情踏板的电位计。
  • 为了使总线设计在引脚 13 上正常工作,有必要以某种方式禁用 Arduino 的内置 LED。为此,您可以使用两个烙铁将其取下,也可以使用一对细尖的钳子小心地将其压碎。
  • 虽然总线设计适用于许多带有总线键盘的风琴,但如果总线是由“磷青铜”材料制成的,它可能无法可靠地工作。将一本手册的所有母线连在一起,将单个键的所有触点连在一起有助于防止间歇性接触,但对于磷青铜母线,建议使用12V键控(本项目无法做到这一点)去做)。

电位器的表情踏板硬件

将来,我希望添加更多关于此的细节,但现在我将简要解释上面看到的设计。与表情踏板的连接是一个便宜的“L”型支架,可以从当地的五金店买到。它在此处连接到现有支架,但也可以使用直接连接到踏板的第二个 L 支架。它通过使用锁紧螺母和两个垫圈保持略微松动的机械螺钉铰接。图中我用了一个很长的机械螺丝,但是不需要这么长的,正好我手头有。对于金属杆,我使用“JB 焊接”将吊环螺栓连接到一端,并使用适当尺寸的机械螺钉将其连接到另一端的“L”支架。

对于电位器安装本身,我购买了一些透明的亚克力板,用一把小刀在它们上划痕,然后用钳子和夹子沿线将它们折断。为了安装电位器,我做了一小块亚克力把它从大块上抬高,用砂纸打磨小块亚克力的表面,还用砂纸打磨要安装的电位器的表面,把大块的表面磨光一切都将被连接,然后应用 JB 焊缝,并使用一个小夹子将所有东西固定在一起,直到 JB 焊缝变干。用电钻和标准钻头在亚克力件上钻孔。

较大一块亚克力的底部使用#4 机螺钉固定在小家具铰链上,家具铰链的另一端使用短#4 木螺钉连接到风琴底部。我制作了一个亚克力支架来将家具铰链固定在木地板上,但根据家具铰链的设计,这可能没有必要。

杆滑过的白色块是我从机器人零件供应商处购买的 PFTE 块。使用业余锯将较大的一块切下,并使用电钻和不同尺寸的钻头钻三个孔。 PFTE 块使用机械螺钉连接到丙烯酸支架上。

表情踏板支架详细说明:

(2021 年 12 月 9 日更新)

-8x10 英寸亚克力板

-铁氟龙块

-铝棒(1/4 英寸,可在当地五金店或金属店购买)

-JB焊接

-线性电位器

-小家具铰链

-小家具支架

-小吊环螺栓

- 短 #4 木螺钉

-各种硬件:

-锁紧垫圈 X1(最好是聚四氟乙烯)和匹配的机器螺丝连接到踏板(直径和长度与当前踏板匹配)

- 机械螺丝 x2、垫圈 x4 和螺母 x2,用于将聚四氟乙烯固定到亚克力板上(直径和长度取决于钻孔的直径)

-用于将支架固定到 1/4 铝棒上的机械螺钉(直径取决于内孔的大小)

- 机械螺丝 x2、垫圈 x4 和螺母 x2,用于将铰链连接到亚克力板底部。

工具:

-爱好刀

-直边

-珠宝商的螺丝刀/普通螺丝刀(最小螺丝的珠宝商)

-月牙扳手(用于拧紧机器螺钉和螺母)

-钳子

- 电钻和钻头。

-爱好锯

-台钳

-小木夹

-细砂纸

- 冰棒棍和废纸板。

-湿布

说明:

- 检查当前踏板。如果安装支架上有一个备用孔,您可以使用它,否则您可以使用正在使用的现有孔,并获得一个比当前长的机械螺钉,但仍然可以装入孔中。

- 确保风琴的木质底座没有任何组件或电子设备,如有必要,请移动它们。

- 拆开亚克力板,使用直边和小刀,将板的两侧刻成 3" x 4.5" 的矩形,然后沿着刻痕线使用台式虎钳和钳子将其切割(确保使用护目镜!)。还要切割一块 3” x 0.5” 的部件,和一块 2.4” x 0.3” 的部件。

- 使用爱好锯将聚四氟乙烯块从末端切下大约 3/4 英寸,形成 3' x 1.5' x 3/4 英寸的块。

- 沿着大亚克力板的底部边缘钻 2 个孔,使它们与家具铰链的一侧相匹配,并在聚四氟乙烯块的 3x1.5 英寸一侧钻两个孔,以免它们挡住路径铝棒会穿过它。如果块位于大亚克力板的顶部,与先前钻的孔相对,则钻 2 个与聚四氟乙烯块中的孔匹配的孔,聚四氟乙烯块的边缘正好位于亚克力的边缘。还要在 2.4" x 0.3" 的零件上钻 2 个孔,使其与铰链另一侧的孔相匹配。

- 轻轻打磨电位器的一个表面,以及大亚克力板上要粘合的区域,以及 3x0.5 英寸亚克力片的两个表面。用湿布擦拭表面。

- 使用冰棒棒将 JB 焊缝混合在一些废纸板上,然后涂在准备好的亚克力板表面上。添加 3x0.5" 部件,然后添加更多 JB 焊缝,然后是电位计,确保 JB 焊缝连接到打磨过的表面。用小木夹轻轻夹住组件,等待 24 小时固化。

- 使用 1/4 英寸钻头钻一个略大于 1/4 英寸的孔,方法是将钻头从聚四氟乙烯块的 3/4x3 英寸一侧移动到另一侧。钻孔,使铝棒的线与电位器的运动线相匹配。

- 切割 1/4 英寸铝杆,使其在完全按下时从电位器底部到表情踏板的长度大致正确。

- 一旦 JB 焊缝固化,使用机螺钉、垫圈和螺母将铰链和聚四氟乙烯块连接到大亚克力板的侧面。将吊环螺栓放在电位器的可移动部件上,并将其连接到穿过聚四氟乙烯块的 1/4 英寸铝棒上。如果配合有点松,您也可以在前面的步骤中应用 JB 焊接时将吊环螺栓 JB 焊接到铝杆上。在这种情况下,您必须将吊环螺栓放在电位计上,将其穿过聚四氟乙烯块,然后用机螺钉将聚四氟乙烯块连接到亚克力板上。

- 用钳子将吊环螺栓固定在正确位置,使用尺寸正确的机械螺钉将家具支架连接到 1/4 英寸铝杆的另一端。拧紧时,确保吊环螺栓与家具支架的方向正确。

- 如果电位器的支架上有空孔,将新的机械螺丝穿过它,然后套上聚四氟乙烯锁紧垫圈并拧紧,直到家具支架可以自由移动。如果使用当前被先前机械螺钉占据的现有孔,请卸下旧螺钉,然后放入新的更长的螺钉,像以前一样安装它,然后在额外的长度上添加家具支架和聚四氟乙烯锁紧垫圈。

- 在管风琴底部内侧前后移动铰链底部,直到其处于 1/4 英寸铝杆笔直排列的位置,并用最小的亚克力板就位,踏板的运动最接近电位器的运动。使用 2 个小木螺钉将电位器底座的底部连接到风琴的底部,确保亚克力板位于铰链和木头之间(这确保铰链的正确行程)。

最后说明:

Arduino 项目中心似乎没有关于放置在这里的帖子和问题的通知。如果你想更快地回复你的问题,你可以在这个论坛页面上发布,它会通知我。

代码

  • 矩阵键盘代码
  • 忙碌的键盘代码
矩阵键盘代码Arduino
当您遵循矩阵式键盘原理图时上传到 Arduino 的代码。
// 名称:Arduino Mega Midi Controller v21// 创建:2021 年 2 月 4 日// 作者:Larason2// 致谢:秃头工程师,Amanda Ghassaei,jeffb42 , GrumpyMikebyte keysA[11][6];byte keysB[11][6];byte keysC[7][6];byte lastA[11][6];byte lastB[11][6];byte lastC[7] ][6];int noteOn1 =144;int noteOff1 =128;int noteOn2 =145;int noteOff2 =129;int noteOn3 =146;int noteOff3 =130;int速度 =100;int chan6 =181;int chan7 =182; int Exp =11;int LastPot6 =1;int LastPot7 =1;void setup() { // 开始串行 Serial.begin(31250); //初始化键盘A pinMode(2, INPUT); pinMode(22,输入); pinMode(24,输入); pinMode(26,输入); pinMode(28,输入); pinMode(30,输入); pinMode(32,输入); pinMode(34,输入); pinMode(36,输入); pinMode(38,输入); pinMode(40,输入); pinMode(42,输入); pinMode(44,输入); pinMode(46,输入); pinMode(48,输入); pinMode(50,输入); pinMode(52,输入); //初始化键盘B pinMode(3, INPUT); pinMode(23,输入); pinMode(25,输入); pinMode(27,输入); pinMode(29,输入); pinMode(31,输入); pinMode(33,输入); pinMode(35,输入); pinMode(37,输入); pinMode(39,输入); pinMode(41,输入); pinMode(43,输入); pinMode(45,输入); pinMode(47,输入); pinMode(49,输入); pinMode(51,输入); pinMode(52,输入); //初始化键盘C pinMode(A2, INPUT); pinMode(A3,输入); pinMode(A4,输入); pinMode(A5,输入); pinMode(A6,输入); pinMode(A7,输入); pinMode(A8,输入); pinMode(A9,输入); pinMode(A10,输入); pinMode(A11,输入); pinMode(A12,输入); pinMode(A13,输入); pinMode(A14, INPUT);}void loop() { // 读取键盘 A pinMode(22, INPUT_PULLUP); pinMode(24, INPUT_PULLUP); pinMode(26, INPUT_PULLUP); pinMode(28, INPUT_PULLUP); pinMode(30, INPUT_PULLUP); pinMode(2, INPUT_PULLUP); pinMode(32,输出);数字写入(32,低);键A[0][0] =digitalRead(2); pinMode(32,输入); pinMode(34,输出);数字写入(34,低);键A[1][0] =digitalRead(22);键A[1][1] =digitalRead(24);键A[1][2] =digitalRead(26);键A[1][3] =digitalRead(28);键A[1][4] =数字读取(30);键A[1][5] =digitalRead(2); pinMode(34,输入); pinMode(36,输出);数字写入(36,低);键A[2][0] =digitalRead(22);键A[2][1] =数字读取(24);键A[2][2] =digitalRead(26);键A[2][3] =digitalRead(28);键A[2][4] =digitalRead(30);键A[2][5] =digitalRead(2); pinMode(36,输入); pinMode(38,输出);数字写入(38,低);键A[3][0] =digitalRead(22);键A[3][1] =数字读取(24);键A[3][2] =digitalRead(26);键A[3][3] =digitalRead(28);键A[3][4] =digitalRead(30);键A[3][5] =digitalRead(2); pinMode(38,输入); pinMode(40,输出);数字写入(40,低);键A[4][0] =digitalRead(22);键A[4][1] =digitalRead(24);键A[4][2] =digitalRead(26);键A[4][3] =digitalRead(28);键A[4][4] =digitalRead(30);键A[4][5] =数字读取(2); pinMode(40,输入); pinMode(42,输出);数字写入(42,低);键A[5][0] =数字读取(22);键A[5][1] =数字读取(24);键A[5][2] =数字读取(26);键A[5][3] =digitalRead(28);键A[5][4] =digitalRead(30);键A[5][5] =digitalRead(2); pinMode(42,输入); pinMode(44,输出);数字写入(44,低);键A[6][0] =digitalRead(22);键A[6][1] =digitalRead(24);键A[6][2] =digitalRead(26);键A[6][3] =digitalRead(28);键A[6][4] =digitalRead(30);键A[6][5] =digitalRead(2); pinMode(44,输入); pinMode(46,输出);数字写入(46,低);键A[7][0] =digitalRead(22);键A[7][1] =digitalRead(24);键A[7][2] =digitalRead(26);键A[7][3] =digitalRead(28);键A[7][4] =digitalRead(30);键A[7][5] =digitalRead(2); pinMode(46,输入); pinMode(48,输出);数字写入(48,低);键A[8][0] =数字读取(22);键A[8][1] =数字读取(24);键A[8][2] =数字读取(26);键A[8][3] =digitalRead(28);键A[8][4] =digitalRead(30);键A[8][5] =digitalRead(2); pinMode(48,输入); pinMode(50,输出);数字写入(50,低);键A[9][0] =digitalRead(22);键A[9][1] =digitalRead(24);键A[9][2] =digitalRead(26);键A[9][3] =数字读取(28);键A[9][4] =数字读取(30);键A[9][5] =digitalRead(2); pinMode(50,输入); pinMode(52,输出);数字写入(52,低);键A[10][0] =digitalRead(22);键A[10][1] =digitalRead(24);键A[10][2] =digitalRead(26);键A[10][3] =digitalRead(28);键A[10][4] =digitalRead(30);键A[10][5] =digitalRead(2); pinMode(52,输入); pinMode(22,输入); pinMode(24,输入); pinMode(26,输入); pinMode(28,输入); pinMode(30,输入); pinMode(2, 输入); // 读取键盘 B pinMode(23, INPUT_PULLUP); pinMode(25, INPUT_PULLUP); pinMode(27, INPUT_PULLUP); pinMode(29, INPUT_PULLUP); pinMode(31, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); pinMode(33,输出);数字写入(33,低); keysB[0][0] =digitalRead(3); pinMode(33,输入); pinMode(35,输出);数字写入(35,低); keysB[1][0] =digitalRead(23); keysB[1][1] =digitalRead(25); keysB[1][2] =digitalRead(27); keysB[1][3] =digitalRead(29); keysB[1][4] =digitalRead(31); keysB[1][5] =digitalRead(3); pinMode(35,输入); pinMode(37,输出);数字写入(37,低); keysB[2][0] =digitalRead(23); keysB[2][1] =digitalRead(25); keysB[2][2] =digitalRead(27); keysB[2][3] =digitalRead(29); keysB[2][4] =digitalRead(31); keysB[2][5] =digitalRead(3); pinMode(37,输入); pinMode(39,输出);数字写入(39,低); keysB[3][0] =digitalRead(23); keysB[3][1] =digitalRead(25); keysB[3][2] =digitalRead(27); keysB[3][3] =digitalRead(29); keysB[3][4] =digitalRead(31); keysB[3][5] =digitalRead(3); pinMode(39,输入); pinMode(41,输出);数字写入(41,低); keysB[4][0] =digitalRead(23); keysB[4][1] =digitalRead(25); keysB[4][2] =digitalRead(27); keysB[4][3] =digitalRead(29); keysB[4][4] =digitalRead(31); keysB[4][5] =digitalRead(3); pinMode(41,输入); pinMode(43,输出);数字写入(43,低); keysB[5][0] =digitalRead(23); keysB[5][1] =digitalRead(25); keysB[5][2] =digitalRead(27); keysB[5][3] =digitalRead(29); keysB[5][4] =digitalRead(31); keysB[5][5] =digitalRead(3); pinMode(43,输入); pinMode(45,输出);数字写入(45,低); keysB[6][0] =digitalRead(23); keysB[6][1] =digitalRead(25); keysB[6][2] =digitalRead(27); keysB[6][3] =digitalRead(29); keysB[6][4] =digitalRead(31); keysB[6][5] =digitalRead(3); pinMode(45,输入); pinMode(47,输出);数字写入(47,低); keysB[7][0] =digitalRead(23); keysB[7][1] =digitalRead(25); keysB[7][2] =digitalRead(27); keysB[7][3] =digitalRead(29); keysB[7][4] =digitalRead(31); keysB[7][5] =digitalRead(3); pinMode(47,输入); pinMode(49,输出);数字写入(49,低); keysB[8][0] =digitalRead(23); keysB[8][1] =digitalRead(25); keysB[8][2] =digitalRead(27); keysB[8][3] =digitalRead(29); keysB[8][4] =digitalRead(31); keysB[8][5] =digitalRead(3); pinMode(49,输入); pinMode(51,输出);数字写入(51,低); keysB[9][0] =digitalRead(23); keysB[9][1] =digitalRead(25); keysB[9][2] =digitalRead(27); keysB[9][3] =digitalRead(29); keysB[9][4] =digitalRead(31); keysB[9][5] =digitalRead(3); pinMode(51,输入); pinMode(53,输出);数字写入(53,低); keysB[10][0] =digitalRead(23); keysB[10][1] =digitalRead(25); keysB[10][2] =digitalRead(27); keysB[10][3] =digitalRead(29); keysB[10][4] =digitalRead(31); keysB[10][5] =digitalRead(3); pinMode(53,输入); pinMode(23,输入); pinMode(25,输入); pinMode(27,输入); pinMode(29,输入); pinMode(31,输入); pinMode(3, 输入); // 读取键盘 C //设置行引脚以读取 pinMode(A3, INPUT_PULLUP); pinMode(A4, INPUT_PULLUP); pinMode(A5, INPUT_PULLUP); pinMode(A6, INPUT_PULLUP); pinMode(A7, INPUT_PULLUP); pinMode(A2, INPUT_PULLUP); pinMode(A8,输出);数字写入(A8,低); keysC[0][0] =digitalRead(A2); pinMode(A8,输入); pinMode(A9,输出);数字写入(A9,低); keysC[1][0] =digitalRead(A3); keysC[1][1] =digitalRead(A4); keysC[1][2] =digitalRead(A5); keysC[1][3] =digitalRead(A6); keysC[1][4] =digitalRead(A7); keysC[1][5] =digitalRead(A2); pinMode(A9,输入); pinMode(A10,输出);数字写入(A10,低); keysC[2][0] =digitalRead(A3); keysC[2][1] =digitalRead(A4); keysC[2][2] =digitalRead(A5); keysC[2][3] =digitalRead(A6); keysC[2][4] =digitalRead(A7); keysC[2][5] =digitalRead(A2); pinMode(A10,输入); pinMode(A11,输出);数字写入(A11,低); keysC[3][0] =digitalRead(A3); keysC[3][1] =digitalRead(A4); keysC[3][2] =digitalRead(A5); keysC[3][3] =digitalRead(A6); keysC[3][4] =digitalRead(A7); keysC[3][5] =digitalRead(A2); pinMode(A11,输入); pinMode(A12,输出);数字写入(A12,低); keysC[4][0] =digitalRead(A3); keysC[4][1] =digitalRead(A4); keysC[4][2] =digitalRead(A5); keysC[4][3] =digitalRead(A6); keysC[4][4] =digitalRead(A7); keysC[4][5] =digitalRead(A2); pinMode(A12,输入); pinMode(A13,输出);数字写入(A13,低); keysC[5][0] =digitalRead(A3); keysC[5][1] =digitalRead(A4); keysC[5][2] =digitalRead(A5); keysC[5][3] =digitalRead(A6); keysC[5][4] =digitalRead(A7); keysC[5][5] =digitalRead(A2); pinMode(A13,输入); pinMode(A14,输出);数字写入(A14,低); keysC[6][0] =digitalRead(A3); pinMode(A14,输入); pinMode(A3,输入); pinMode(A4,输入); pinMode(A5,输入); pinMode(A6,输入); pinMode(A7,输入); pinMode(A2,输入); //反转键盘C数据//(对于常闭开关)//第1列 if (keysC[0][0] ==0) { keysC[0][0] =1; } else if (keysC[0][0] ==1) { keysC[0][0] =0; } //第2列 if (keysC[1][0] ==0) { keysC[1][0] =1; } else if (keysC[1][0] ==1) { keysC[1][0] =0; } if (keysC[1][1] ==0) { keysC[1][1] =1; } else if (keysC[1][1] ==1) { keysC[1][1] =0; } if (keysC[1][2] ==0) { keysC[1][2] =1; } else if (keysC[1][2] ==1) { keysC[1][2] =0; } if (keysC[1][3] ==0) { keysC[1][3] =1; } else if (keysC[1][3] ==1) { keysC[1][3] =0; } if (keysC[1][4] ==0) { keysC[1][4] =1; } else if (keysC[1][4] ==1) { keysC[1][4] =0; } if (keysC[1][5] ==0) { keysC[1][5] =1; } else if (keysC[1][5] ==1) { keysC[1][5] =0; } //Column 3 if (keysC[2][0] ==0) { keysC[2][0] =1; } else if (keysC[2][0] ==1) { keysC[2][0] =0; } if (keysC[2][1] ==0) { keysC[2][1] =1; } else if (keysC[2][1] ==1) { keysC[2][1] =0; } if (keysC[2][2] ==0) { keysC[2][2] =1; } else if (keysC[2][2] ==1) { keysC[2][2] =0; } if (keysC[2][3] ==0) { keysC[2][3] =1; } else if (keysC[2][3] ==1) { keysC[2][3] =0; } if (keysC[2][4] ==0) { keysC[2][4] =1; } else if (keysC[2][4] ==1) { keysC[2][4] =0; } if (keysC[2][5] ==0) { keysC[2][5] =1; } else if (keysC[2][5] ==1) { keysC[2][5] =0; } //Column 4 if (keysC[3][0] ==0) { keysC[3][0] =1; } else if (keysC[3][0] ==1) { keysC[3][0] =0; } if (keysC[3][1] ==0) { keysC[3][1] =1; } else if (keysC[3][1] ==1) { keysC[3][1] =0; } if (keysC[3][2] ==0) { keysC[3][2] =1; } else if (keysC[3][2] ==1) { keysC[3][2] =0; } if (keysC[3][3] ==0) { keysC[3][3] =1; } else if (keysC[3][3] ==1) { keysC[3][3] =0; } if (keysC[3][4] ==0) { keysC[3][4] =1; } else if (keysC[3][4] ==1) { keysC[3][4] =0; } if (keysC[3][5] ==0) { keysC[3][5] =1; } else if (keysC[3][5] ==1) { keysC[3][5] =0; } //Column 5 if (keysC[4][0] ==0) { keysC[4][0] =1; } else if (keysC[4][0] ==1) { keysC[4][0] =0; } if (keysC[4][1] ==0) { keysC[4][1] =1; } else if (keysC[4][1] ==1) { keysC[4][1] =0; } if (keysC[4][2] ==0) { keysC[4][2] =1; } else if (keysC[4][2] ==1) { keysC[4][2] =0; } if (keysC[4][3] ==0) { keysC[4][3] =1; } else if (keysC[4][3] ==1) { keysC[4][3] =0; } if (keysC[4][4] ==0) { keysC[4][4] =1; } else if (keysC[4][4] ==1) { keysC[4][4] =0; } if (keysC[4][5] ==0) { keysC[4][5] =1; } else if (keysC[4][5] ==1) { keysC[4][5] =0; } //Column 6 if (keysC[5][0] ==0) { keysC[5][0] =1; } else if (keysC[5][0] ==1) { keysC[5][0] =0; } if (keysC[5][1] ==0) { keysC[5][1] =1; } else if (keysC[5][1] ==1) { keysC[5][1] =0; } if (keysC[5][2] ==0) { keysC[5][2] =1; } else if (keysC[5][2] ==1) { keysC[5][2] =0; } if (keysC[5][3] ==0) { keysC[5][3] =1; } else if (keysC[5][3] ==1) { keysC[5][3] =0; } if (keysC[5][4] ==0) { keysC[5][4] =1; } else if (keysC[5][4] ==1) { keysC[5][4] =0; } if (keysC[5][5] ==0) { keysC[5][5] =1; } else if (keysC[5][5] ==1) { keysC[5][5] =0; } //Column 7 if (keysC[6][0] ==0) { keysC[6][0] =1; } else if (keysC[6][0] ==1) { keysC[6][0] =0; } //Write Keyboard A //A36 if ((keysA[0][0] ==0) and (lastA[0][0] ==0)) { MidiSend(noteOn1, 36, velocity); lastA[0][0] =7; } if ((keysA[0][0] ==1) and (lastA[0][0] ==7)) { MidiSend(noteOff1, 36, velocity); lastA[0][0] =0; } //A37 if ((keysA[1][0] ==0) and (lastA[1][0] ==0)) { MidiSend(noteOn1, 37, velocity); lastA[1][0] =7; } if ((keysA[1][0] ==1) and (lastA[1][0] ==7)) { MidiSend(noteOff1, 37, velocity); lastA[1][0] =0; } //A38 if ((keysA[1][1] ==0) and (lastA[1][1] ==0)) { MidiSend(noteOn1, 38, velocity); lastA[1][1] =7; } //Write Midi Note Off if ((keysA[1][1] ==1) and (lastA[1][1] ==7)) { MidiSend(noteOff1, 38, velocity); lastA[1][1] =0; } //A39 if ((keysA[1][2] ==0) and (lastA[1][2] ==0)) { MidiSend(noteOn1, 39, velocity); lastA[1][2] =7; } //Write Midi Note Off if ((keysA[1][2] ==1) and (lastA[1][2] ==7)) { MidiSend(noteOff1, 39, velocity); lastA[1][2] =0; } //A40 if ((keysA[1][3] ==0) and (lastA[1][3] ==0)) { MidiSend(noteOn1, 40, velocity); lastA[1][3] =7; } //Write Midi Note Off if ((keysA[1][3] ==1) and (lastA[1][3] ==7)) { MidiSend(noteOff1, 40, velocity); lastA[1][3] =0; } //A41 if ((keysA[1][4] ==0) and (lastA[1][4] ==0)) { MidiSend(noteOn1, 41, velocity); lastA[1][4] =7; } //Write Midi Note Off if ((keysA[1][4] ==1) and (lastA[1][4] ==7)) { MidiSend(noteOff1, 41, velocity); lastA[1][4] =0; } //A42 if ((keysA[1][5] ==0) and (lastA[1][5] ==0)) { MidiSend(noteOn1, 42, velocity); lastA[1][5] =7; } //Write Midi Note Off if ((keysA[1][5] ==1) and (lastA[1][5] ==7)) { MidiSend(noteOff1, 42, velocity); lastA[1][5] =0; } //A43 if ((keysA[2][0] ==0) and (lastA[2][0] ==0)) { MidiSend(noteOn1, 43, velocity); lastA[2][0] =7; } //Write Midi Note Off if ((keysA[2][0] ==1) and (lastA[2][0] ==7)) { MidiSend(noteOff1, 43, velocity); lastA[2][0] =0; } //A44 if ((keysA[2][1] ==0) and (lastA[2][1] ==0)) { MidiSend(noteOn1, 44, velocity); lastA[2][1] =7; } //Write Midi Note Off if ((keysA[2][1] ==1) and (lastA[2][1] ==7)) { MidiSend(noteOff1, 44, velocity); lastA[2][1] =0; } //A45 if ((keysA[2][2] ==0) and (lastA[2][2] ==0)) { MidiSend(noteOn1, 45, velocity); lastA[2][2] =7; } //Write Midi Note Off if ((keysA[2][2] ==1) and (lastA[2][2] ==7)) { MidiSend(noteOff1, 45, velocity); lastA[2][2] =0; } //A46 if ((keysA[2][3] ==0) and (lastA[2][3] ==0)) { MidiSend(noteOn1, 46, velocity); lastA[2][3] =7; } //Write Midi Note Off if ((keysA[2][3] ==1) and (lastA[2][3] ==7)) { MidiSend(noteOff1, 46, velocity); lastA[2][3] =0; } //A47 if ((keysA[2][4] ==0) and (lastA[2][4] ==0)) { MidiSend(noteOn1, 47, velocity); lastA[2][4] =7; } //Write Midi Note Off if ((keysA[2][4] ==1) and (lastA[2][4] ==7)) { MidiSend(noteOff1, 47, velocity); lastA[2][4] =0; } //A48 if ((keysA[2][5] ==0) and (lastA[2][5] ==0)) { MidiSend(noteOn1, 48, velocity); lastA[2][5] =7; } //Write Midi Note Off if ((keysA[2][5] ==1) and (lastA[2][5] ==7)) { MidiSend(noteOff1, 48, velocity); lastA[2][5] =0; } //A49 if ((keysA[3][0] ==0) and (lastA[3][0] ==0)) { MidiSend(noteOn1, 49, velocity); lastA[3][0] =7; } //Write Midi Note Off if ((keysA[3][0] ==1) and (lastA[3][0] ==7)) { MidiSend(noteOff1, 49, velocity); lastA[3][0] =0; } //A50 if ((keysA[3][1] ==0) and (lastA[3][1] ==0)) { MidiSend(noteOn1, 50, velocity); lastA[3][1] =7; } //Write Midi Note Off if ((keysA[3][1] ==1) and (lastA[3][1] ==7)) { MidiSend(noteOff1, 50, velocity); lastA[3][1] =0; } //A51 if ((keysA[3][2] ==0) and (lastA[3][2] ==0)) { MidiSend(noteOn1, 51, velocity); lastA[3][2] =7; } //Write Midi Note Off if ((keysA[3][2] ==1) and (lastA[3][2] ==7)) { MidiSend(noteOff1, 51, velocity); lastA[3][2] =0; } //A52 if ((keysA[3][3] ==0) and (lastA[3][3] ==0)) { MidiSend(noteOn1, 52, velocity); lastA[3][3] =7; } //Write Midi Note Off if ((keysA[3][3] ==1) and (lastA[3][3] ==7)) { MidiSend(noteOff1, 52, velocity); lastA[3][3] =0; } //A53 if ((keysA[3][4] ==0) and (lastA[3][4] ==0)) { MidiSend(noteOn1, 53, velocity); lastA[3][4] =7; } //Write Midi Note Off if ((keysA[3][4] ==1) and (lastA[3][4] ==7)) { MidiSend(noteOff1, 53, velocity); lastA[3][4] =0; } //A54 if ((keysA[3][5] ==0) and (lastA[3][5] ==0)) { MidiSend(noteOn1, 54, velocity); lastA[3][5] =7; } //Write Midi Note Off if ((keysA[3][5] ==1) and (lastA[3][5] ==7)) { MidiSend(noteOff1, 54, velocity); lastA[3][5] =0; } //A55 if ((keysA[4][0] ==0) and (lastA[4][0] ==0)) { MidiSend(noteOn1, 55, velocity); lastA[4][0] =7; } //Write Midi Note Off if ((keysA[4][0] ==1) and (lastA[4][0] ==7)) { MidiSend(noteOff1, 55, velocity); lastA[4][0] =0; } //A56 if ((keysA[4][1] ==0) and (lastA[4][1] ==0)) { MidiSend(noteOn1, 56, velocity); lastA[4][1] =7; } //Write Midi Note Off if ((keysA[4][1] ==1) and (lastA[4][1] ==7)) { MidiSend(noteOff1, 56, velocity); lastA[4][1] =0; } //A57 if ((keysA[4][2] ==0) and (lastA[4][2] ==0)) { MidiSend(noteOn1, 57, velocity); lastA[4][2] =7; } //Write Midi Note Off if ((keysA[4][2] ==1) and (lastA[4][2] ==7)) { MidiSend(noteOff1, 57, velocity); lastA[4][2] =0; } //A58 if ((keysA[4][3] ==0) and (lastA[4][3] ==0)) { MidiSend(noteOn1, 58, velocity); lastA[4][3] =7; } //Write Midi Note Off if ((keysA[4][3] ==1) and (lastA[4][3] ==7)) { MidiSend(noteOff1, 58, velocity); lastA[4][3] =0; } //59 if ((keysA[4][4] ==0) and (lastA[4][4] ==0)) { MidiSend(noteOn1, 59, velocity); lastA[4][4] =7; } //Write Midi Note Off if ((keysA[4][4] ==1) and (lastA[4][4] ==7)) { MidiSend(noteOff1, 59, velocity); lastA[4][4] =0; } //A60 if ((keysA[4][5] ==0) and (lastA[4][5] ==0)) { MidiSend(noteOn1, 60, velocity); lastA[4][5] =7; } //Write Midi Note Off if ((keysA[4][5] ==1) and (lastA[4][5] ==7)) { MidiSend(noteOff1, 60, velocity); lastA[4][5] =0; } //A61 if ((keysA[5][0] ==0) and (lastA[5][0] ==0)) { MidiSend(noteOn1, 61, velocity); lastA[5][0] =7; } //Write Midi Note Off if ((keysA[5][0] ==1) and (lastA[5][0] ==7)) { MidiSend(noteOff1, 61, velocity); lastA[5][0] =0; } //A62 if ((keysA[5][1] ==0) and (lastA[5][1] ==0)) { MidiSend(noteOn1, 62, velocity); lastA[5][1] =7; } //Write Midi Note Off if ((keysA[5][1] ==1) and (lastA[5][1] ==7)) { MidiSend(noteOff1, 62, velocity); lastA[5][1] =0; } //A63 if ((keysA[5][2] ==0) and (lastA[5][2] ==0)) { MidiSend(noteOn1, 63, velocity); lastA[5][2] =7; } //Write Midi Note Off if ((keysA[5][2] ==1) and (lastA[5][2] ==7)) { MidiSend(noteOff1, 63, velocity); lastA[5][2] =0; } //A64 if ((keysA[5][3] ==0) and (lastA[5][3] ==0)) { MidiSend(noteOn1, 64, velocity); lastA[5][3] =7; } //Write Midi Note Off if ((keysA[5][3] ==1) and (lastA[5][3] ==7)) { MidiSend(noteOff1, 64, velocity); lastA[5][3] =0; } //A65 if ((keysA[5][4] ==0) and (lastA[5][4] ==0)) { MidiSend(noteOn1, 65, velocity); lastA[5][4] =7; } //Write Midi Note Off if ((keysA[5][4] ==1) and (lastA[5][4] ==7)) { MidiSend(noteOff1, 65, velocity); lastA[5][4] =0; } //A66 if ((keysA[5][5] ==0) and (lastA[5][5] ==0)) { MidiSend(noteOn1, 66, velocity); lastA[5][5] =7; } //Write Midi Note Off if ((keysA[5][5] ==1) and (lastA[5][5] ==7)) { MidiSend(noteOff1, 66, velocity); lastA[5][5] =0; } //A67 if ((keysA[6][0] ==0) and (lastA[6][0] ==0)) { MidiSend(noteOn1, 67, velocity); lastA[6][0] =7; } //Write Midi Note Off if ((keysA[6][0] ==1) and (lastA[6][0] ==7)) { MidiSend(noteOff1, 67, velocity); lastA[6][0] =0; } //A68 if ((keysA[6][1] ==0) and (lastA[6][1] ==0)) { MidiSend(noteOn1, 68, velocity); lastA[6][1] =7; } //Write Midi Note Off if ((keysA[6][1] ==1) and (lastA[6][1] ==7)) { MidiSend(noteOff1, 68, velocity); lastA[6][1] =0; } //A69 if ((keysA[6][2] ==0) and (lastA[6][2] ==0)) { MidiSend(noteOn1, 69, velocity); lastA[6][2] =7; } //Write Midi Note Off if ((keysA[6][2] ==1) and (lastA[6][2] ==7)) { MidiSend(noteOff1, 69, velocity); lastA[6][2] =0; } //A70 if ((keysA[6][3] ==0) and (lastA[6][3] ==0)) { MidiSend(noteOn1, 70, velocity); lastA[6][3] =7; } //Write Midi Note Off if ((keysA[6][3] ==1) and (lastA[6][3] ==7)) { MidiSend(noteOff1, 70, velocity); lastA[6][3] =0; } //A71 if ((keysA[6][4] ==0) and (lastA[6][4] ==0)) { MidiSend(noteOn1, 71, velocity); lastA[6][4] =7; } //Write Midi Note Off if ((keysA[6][4] ==1) and (lastA[6][4] ==7)) { MidiSend(noteOff1, 71, velocity); lastA[6][4] =0; } //A72 if ((keysA[6][5] ==0) and (lastA[6][5] ==0)) { MidiSend(noteOn1, 72, velocity); lastA[6][5] =7; } //Write Midi Note Off if ((keysA[6][5] ==1) and (lastA[6][5] ==7)) { MidiSend(noteOff1, 72, velocity); lastA[6][5] =0; } //A73 if ((keysA[7][0] ==0) and (lastA[7][0] ==0)) { MidiSend(noteOn1, 73, velocity); lastA[7][0] =7; } //Write Midi Note Off if ((keysA[7][0] ==1) and (lastA[7][0] ==7)) { MidiSend(noteOff1, 73, velocity); lastA[7][0] =0; } //A74 if ((keysA[7][1] ==0) and (lastA[7][1] ==0)) { MidiSend(noteOn1, 74, velocity); lastA[7][1] =7; } //Write Midi Note Off if ((keysA[7][1] ==1) and (lastA[7][1] ==7)) { MidiSend(noteOff1, 74, velocity); lastA[7][1] =0; } //A75 if ((keysA[7][2] ==0) and (lastA[7][2] ==0)) { MidiSend(noteOn1, 75, velocity); lastA[7][2] =7; } //Write Midi Note Off if ((keysA[7][2] ==1) and (lastA[7][2] ==7)) { MidiSend(noteOff1, 75, velocity); lastA[7][2] =0; } //A76 if ((keysA[7][3] ==0) and (lastA[7][3] ==0)) { MidiSend(noteOn1, 76, velocity); lastA[7][3] =7; } //Write Midi Note Off if ((keysA[7][3] ==1) and (lastA[7][3] ==7)) { MidiSend(noteOff1, 76, velocity); lastA[7][3] =0; } //A77 if ((keysA[7][4] ==0) and (lastA[7][4] ==0)) { MidiSend(noteOn1, 77, velocity); lastA[7][4] =7; } //Write Midi Note Off if ((keysA[7][4] ==1) and (lastA[7][4] ==7)) { MidiSend(noteOff1, 77, velocity); lastA[7][4] =0; } //A78 if ((keysA[7][5] ==0) and (lastA[7][5] ==0)) { MidiSend(noteOn1, 78, velocity); lastA[7][5] =7; } //Write Midi Note Off if ((keysA[7][5] ==1) and (lastA[7][5] ==7)) { MidiSend(noteOff1, 78, velocity); lastA[7][5] =0; } //A79 if ((keysA[8][0] ==0) and (lastA[8][0] ==0)) { MidiSend(noteOn1, 79, velocity); lastA[8][0] =7; } //Write Midi Note Off if ((keysA[8][0] ==1) and (lastA[8][0] ==7)) { MidiSend(noteOff1, 79, velocity); lastA[8][0] =0; } //A80 if ((keysA[8][1] ==0) and (lastA[8][1] ==0)) { MidiSend(noteOn1, 80, velocity); lastA[8][1] =7; } //Write Midi Note Off if ((keysA[8][1] ==1) and (lastA[8][1] ==7)) { MidiSend(noteOff1, 80, velocity); lastA[8][1] =0; } //A81 if ((keysA[8][2] ==0) and (lastA[8][2] ==0)) { MidiSend(noteOn1, 81, velocity); lastA[8][2] =7; } //Write Midi Note Off if ((keysA[8][2] ==1) and (lastA[8][2] ==7)) { MidiSend(noteOff1, 81, velocity); lastA[8][2] =0; } //A82 if ((keysA[8][3] ==0) and (lastA[8][3] ==0)) { MidiSend(noteOn1, 82, velocity); lastA[8][3] =7; } //Write Midi Note Off if ((keysA[8][3] ==1) and (lastA[8][3] ==7)) { MidiSend(noteOff1, 82, velocity); lastA[8][3] =0; } //A83 if ((keysA[8][4] ==0) and (lastA[8][4] ==0)) { MidiSend(noteOn1, 83, velocity); lastA[8][4] =7; } //Write Midi Note Off if ((keysA[8][4] ==1) and (lastA[8][4] ==7)) { MidiSend(noteOff1, 83, velocity); lastA[8][4] =0; } //A84 if ((keysA[8][5] ==0) and (lastA[8][5] ==0)) { MidiSend(noteOn1, 84, velocity); lastA[8][5] =7; } //Write Midi Note Off if ((keysA[8][5] ==1) and (lastA[8][5] ==7)) { MidiSend(noteOff1, 84, velocity); lastA[8][5] =0; } //A85 if ((keysA[9][0] ==0) and (lastA[9][0] ==0)) { MidiSend(noteOn1, 85, velocity); lastA[9][0] =7; } //Write Midi Note Off if ((keysA[9][0] ==1) and (lastA[9][0] ==7)) { MidiSend(noteOff1, 85, velocity); lastA[9][0] =0; } //A86 if ((keysA[9][1] ==0) and (lastA[9][1] ==0)) { MidiSend(noteOn1, 86, velocity); lastA[9][1] =7; } //Write Midi Note Off if ((keysA[9][1] ==1) and (lastA[9][1] ==7)) { MidiSend(noteOff1, 86, velocity); lastA[9][1] =0; } //A87 if ((keysA[9][2] ==0) and (lastA[9][2] ==0)) { MidiSend(noteOn1, 87, velocity); lastA[9][2] =7; } //Write Midi Note Off if ((keysA[9][2] ==1) and (lastA[9][2] ==7)) { MidiSend(noteOff1, 87, velocity); lastA[9][2] =0; } //A88 if ((keysA[9][3] ==0) and (lastA[9][3] ==0)) { MidiSend(noteOn1, 88, velocity); lastA[9][3] =7; } //Write Midi Note Off if ((keysA[9][3] ==1) and (lastA[9][3] ==7)) { MidiSend(noteOff1, 88, velocity); lastA[9][3] =0; } //A89 if ((keysA[9][4] ==0) and (lastA[9][4] ==0)) { MidiSend(noteOn1, 89, velocity); lastA[9][4] =7; } //Write Midi Note Off if ((keysA[9][4] ==1) and (lastA[9][4] ==7)) { MidiSend(noteOff1, 89, velocity); lastA[9][4] =0; } //A90 if ((keysA[9][5] ==0) and (lastA[9][5] ==0)) { MidiSend(noteOn1, 90, velocity); lastA[9][5] =7; } //Write Midi Note Off if ((keysA[9][5] ==1) and (lastA[9][5] ==7)) { MidiSend(noteOff1, 90, velocity); lastA[9][5] =0; } //A91 if ((keysA[10][0] ==0) and (lastA[10][0] ==0)) { MidiSend(noteOn1, 91, velocity); lastA[10][0] =7; } //Write Midi Note Off if ((keysA[10][0] ==1) and (lastA[10][0] ==7)) { MidiSend(noteOff1, 91, velocity); lastA[10][0] =0; } //A92 if ((keysA[10][1] ==0) and (lastA[10][1] ==0)) { MidiSend(noteOn1, 92, velocity); lastA[10][1] =7; } //Write Midi Note Off if ((keysA[10][1] ==1) and (lastA[10][1] ==7)) { MidiSend(noteOff1, 92, velocity); lastA[10][1] =0; } //A93 if ((keysA[10][2] ==0) and (lastA[10][2] ==0)) { MidiSend(noteOn1, 93, velocity); lastA[10][2] =7; } //Write Midi Note Off if ((keysA[10][2] ==1) and (lastA[10][2] ==7)) { MidiSend(noteOff1, 93, velocity); lastA[10][2] =0; } //A94 if ((keysA[10][3] ==0) and (lastA[10][3] ==0)) { MidiSend(noteOn1, 94, velocity); lastA[10][3] =7; } //Write Midi Note Off if ((keysA[10][3] ==1) and (lastA[10][3] ==7)) { MidiSend(noteOff1, 94, velocity); lastA[10][3] =0; } //A95 if ((keysA[10][4] ==0) and (lastA[10][4] ==0)) { MidiSend(noteOn1, 95, velocity); lastA[10][4] =7; } //Write Midi Note Off if ((keysA[10][4] ==1) and (lastA[10][4] ==7)) { MidiSend(noteOff1, 95, velocity); lastA[10][4] =0; } //A96 if ((keysA[10][5] ==0) and (lastA[10][5] ==0)) { MidiSend(noteOn1, 96, velocity); lastA[10][5] =7; } //Write Midi Note Off if ((keysA[10][5] ==1) and (lastA[10][5] ==7)) { MidiSend(noteOff1, 96, velocity); lastA[10][5] =0; } //Write Keyboard B //B36 if ((keysB[0][0] ==0) and (lastB[0][0] ==0)) { MidiSend(noteOn2, 36, velocity); lastB[0][0] =7; } if ((keysB[0][0] ==1) and (lastB[0][0] ==7)) { MidiSend(noteOff2, 36, velocity); lastB[0][0] =0; } //B37 if ((keysB[1][0] ==0) and (lastB[1][0] ==0)) { MidiSend(noteOn2, 37, velocity); lastB[1][0] =7; } if ((keysB[1][0] ==1) and (lastB[1][0] ==7)) { MidiSend(noteOff2, 37, velocity); lastB[1][0] =0; } //B38 if ((keysB[1][1] ==0) and (lastB[1][1] ==0)) { MidiSend(noteOn2, 38, velocity); lastB[1][1] =7; } //Write Midi Note Off if ((keysB[1][1] ==1) and (lastB[1][1] ==7)) { MidiSend(noteOff2, 38, velocity); lastB[1][1] =0; } //B39 if ((keysB[1][2] ==0) and (lastB[1][2] ==0)) { MidiSend(noteOn2, 39, velocity); lastB[1][2] =7; } //Write Midi Note Off if ((keysB[1][2] ==1) and (lastB[1][2] ==7)) { MidiSend(noteOff2, 39, velocity); lastB[1][2] =0; } //B40 if ((keysB[1][3] ==0) and (lastB[1][3] ==0)) { MidiSend(noteOn2, 40, velocity); lastB[1][3] =7; } //Write Midi Note Off if ((keysB[1][3] ==1) and (lastB[1][3] ==7)) { MidiSend(noteOff2, 40, velocity); lastB[1][3] =0; } //B41 if ((keysB[1][4] ==0) and (lastB[1][4] ==0)) { MidiSend(noteOn2, 41, velocity); lastB[1][4] =7; } //Write Midi Note Off if ((keysB[1][4] ==1) and (lastB[1][4] ==7)) { MidiSend(noteOff2, 41, velocity); lastB[1][4] =0; } //B42 if ((keysB[1][5] ==0) and (lastB[1][5] ==0)) { MidiSend(noteOn2, 42, velocity); lastB[1][5] =7; } //Write Midi Note Off if ((keysB[1][5] ==1) and (lastB[1][5] ==7)) { MidiSend(noteOff2, 42, velocity); lastB[1][5] =0; } //B43 if ((keysB[2][0] ==0) and (lastB[2][0] ==0)) { MidiSend(noteOn2, 43, velocity); lastB[2][0] =7; } //Write Midi Note Off if ((keysB[2][0] ==1) and (lastB[2][0] ==7)) { MidiSend(noteOff2, 43, velocity); lastB[2][0] =0; } //B44 if ((keysB[2][1] ==0) and (lastB[2][1] ==0)) { MidiSend(noteOn2, 44, velocity); lastB[2][1] =7; } //Write Midi Note Off if ((keysB[2][1] ==1) and (lastB[2][1] ==7)) { MidiSend(noteOff2, 44, velocity); lastB[2][1] =0; } //B45 if ((keysB[2][2] ==0) and (lastB[2][2] ==0)) { MidiSend(noteOn2, 45, velocity); lastB[2][2] =7; } //Write Midi Note Off if ((keysB[2][2] ==1) and (lastB[2][2] ==7)) { MidiSend(noteOff2, 45, velocity); lastB[2][2] =0; } //B46 if ((keysB[2][3] ==0) and (lastB[2][3] ==0)) { MidiSend(noteOn2, 46, velocity); lastB[2][3] =7; } //Write Midi Note Off if ((keysB[2][3] ==1) and (lastB[2][3] ==7)) { MidiSend(noteOff2, 46, velocity); lastB[2][3] =0; } //B47 if ((keysB[2][4] ==0) and (lastB[2][4] ==0)) { MidiSend(noteOn2, 47, velocity); lastB[2][4] =7; } //Write Midi Note Off if ((keysB[2][4] ==1) and (lastB[2][4] ==7)) { MidiSend(noteOff2, 47, velocity); lastB[2][4] =0; } //B48 if ((keysB[2][5] ==0) and (lastB[2][5] ==0)) { MidiSend(noteOn2, 48, velocity); lastB[2][5] =7; } //Write Midi Note Off if ((keysB[2][5] ==1) and (lastB[2][5] ==7)) { MidiSend(noteOff2, 48, velocity); lastB[2][5] =0; } //B49 if ((keysB[3][0] ==0) and (lastB[3][0] ==0)) { MidiSend(noteOn2, 49, velocity); lastB[3][0] =7; } //Write Midi Note Off if ((keysB[3][0] ==1) and (lastB[3][0] ==7)) { MidiSend(noteOff2, 49, velocity); lastB[3][0] =0; } //B50 if ((keysB[3][1] ==0) and (lastB[3][1] ==0)) { MidiSend(noteOn2, 50, velocity); lastB[3][1] =7; } //Write Midi Note Off if ((keysB[3][1] ==1) and (lastB[3][1] ==7)) { MidiSend(noteOff2, 50, velocity); lastB[3][1] =0; } //B51 if ((keysB[3][2] ==0) and (lastB[3][2] ==0)) { MidiSend(noteOn2, 51, velocity); lastB[3][2] =7; } //Write Midi Note Off if ((keysB[3][2] ==1) and (lastB[3][2] ==7)) { MidiSend(noteOff2, 51, velocity); lastB[3][2] =0; } //B52 if ((keysB[3][3] ==0) and (lastB[3][3] ==0)) { MidiSend(noteOn2, 52, velocity); lastB[3][3] =7; } //Write Midi Note Off if ((keysB[3][3] ==1) and (lastB[3][3] ==7)) { MidiSend(noteOff2, 52, velocity); lastB[3][3] =0; } //B53 if ((keysB[3][4] ==0) and (lastB[3][4] ==0)) { MidiSend(noteOn2, 53, velocity); lastB[3][4] =7; } //Write Midi Note Off if ((keysB[3][4] ==1) and (lastB[3][4] ==7)) { MidiSend(noteOff2, 53, velocity); lastB[3][4] =0; } //B54 if ((keysB[3][5] ==0) and (lastB[3][5] ==0)) { MidiSend(noteOn2, 54, velocity); lastB[3][5] =7; } //Write Midi Note Off if ((keysB[3][5] ==1) and (lastB[3][5] ==7)) { MidiSend(noteOff2, 54, velocity); lastB[3][5] =0; } //B55 if ((keysB[4][0] ==0) and (lastB[4][0] ==0)) { MidiSend(noteOn2, 55, velocity); lastB[4][0] =7; } //Write Midi Note Off if ((keysB[4][0] ==1) and (lastB[4][0] ==7)) { MidiSend(noteOff2, 55, velocity); lastB[4][0] =0; } //B56 if ((keysB[4][1] ==0) and (lastB[4][1] ==0)) { MidiSend(noteOn2, 56, velocity); lastB[4][1] =7; } //Write Midi Note Off if ((keysB[4][1] ==1) and (lastB[4][1] ==7)) { MidiSend(noteOff2, 56, velocity); lastB[4][1] =0; } //B57 if ((keysB[4][2] ==0) and (lastB[4][2] ==0)) { MidiSend(noteOn2, 57, velocity); lastB[4][2] =7; } //Write Midi Note Off if ((keysB[4][2] ==1) and (lastB[4][2] ==7)) { MidiSend(noteOff2, 57, velocity); lastB[4][2] =0; } //B58 if ((keysB[4][3] ==0) and (lastB[4][3] ==0)) { MidiSend(noteOn2, 58, velocity); lastB[4][3] =7; } //Write Midi Note Off if ((keysB[4][3] ==1) and (lastB[4][3] ==7)) { MidiSend(noteOff2, 58, velocity); lastB[4][3] =0; } //B59 if ((keysB[4][4] ==0) and (lastB[4][4] ==0)) { MidiSend(noteOn2, 59, velocity); lastB[4][4] =7; } //Write Midi Note Off if ((keysB[4][4] ==1) and (lastB[4][4] ==7)) { MidiSend(noteOff2, 59, velocity); lastB[4][4] =0; } //B60 if ((keysB[4][5] ==0) and (lastB[4][5] ==0)) { MidiSend(noteOn2, 60, velocity); lastB[4][5] =7; } //Write Midi Note Off if ((keysB[4][5] ==1) and (lastB[4][5] ==7)) { MidiSend(noteOff2, 60, velocity); lastB[4][5] =0; } //B61 if ((keysB[5][0] ==0) and (lastB[5][0] ==0)) { MidiSend(noteOn2, 61, velocity); lastB[5][0] =7; } //Write Midi Note Off if ((keysB[5][0] ==1) and (lastB[5][0] ==7)) { MidiSend(noteOff2, 61, velocity); lastB[5][0] =0; } //B62 if ((keysB[5][1] ==0) and (lastB[5][1] ==0)) { MidiSend(noteOn2, 62, velocity); lastB[5][1] =7; } //Write Midi Note Off if ((keysB[5][1] ==1) and (lastB[5][1] ==7)) { MidiSend(noteOff2, 62, velocity); lastB[5][1] =0; } //B63 if ((keysB[5][2] ==0) and (lastB[5][2] ==0)) { MidiSend(noteOn2, 63, velocity); lastB[5][2] =7; } //Write Midi Note Off if ((keysB[5][2] ==1) and (lastB[5][2] ==7)) { MidiSend(noteOff2, 63, velocity); lastB[5][2] =0; } //B64 if ((keysB[5][3] ==0) and (lastB[5][3] ==0)) { MidiSend(noteOn2, 64, velocity); lastB[5][3] =7; } //Write Midi Note Off if ((keysB[5][3] ==1) and (lastB[5][3] ==7)) { MidiSend(noteOff2, 64, velocity); lastB[5][3] =0; } //B65 if ((keysB[5][4] ==0) and (lastB[5][4] ==0)) { MidiSend(noteOn2, 65, velocity); lastB[5][4] =7; } //Write Midi Note Off if ((keysB[5][4] ==1) and (lastB[5][4] ==7)) { MidiSend(noteOff2, 65, velocity); lastB[5][4] =0; } //B66 if ((keysB[5][5] ==0) and (lastB[5][5] ==0)) { MidiSend(noteOn2, 66, velocity); lastB[5][5] =7; } //Write Midi Note Off if ((keysB[5][5] ==1) and (lastB[5][5] ==7)) { MidiSend(noteOff2, 66, velocity); lastB[5][5] =0; } //B67 if ((keysB[6][0] ==0) and (lastB[6][0] ==0)) { MidiSend(noteOn2, 67, velocity); lastB[6][0] =7; } //Write Midi Note Off if ((keysB[6][0] ==1) and (lastB[6][0] ==7)) { MidiSend(noteOff2, 67, velocity); lastB[6][0] =0; } //B68 if ((keysB[6][1] ==0) and (lastB[6][1] ==0)) { MidiSend(noteOn2, 68, velocity); lastB[6][1] =7; } //Write Midi Note Off if ((keysB[6][1] ==1) and (lastB[6][1] ==7)) { MidiSend(noteOff2, 68, velocity); lastB[6][1] =0; } //B69 if ((keysB[6][2] ==0) and (lastB[6][2] ==0)) { MidiSend(noteOn2, 69, velocity); lastB[6][2] =7; } //Write Midi Note Off if ((keysB[6][2] ==1) and (lastB[6][2] ==7)) { MidiSend(noteOff2, 69, velocity); lastB[6][2] =0; } //B70 if ((keysB[6][3] ==0) and (lastB[6][3] ==0)) { MidiSend(noteOn2, 70, velocity); lastB[6][3] =7; } //Write Midi Note Off if ((keysB[6][3] ==1) and (lastB[6][3] ==7)) { MidiSend(noteOff2, 70, velocity); lastB[6][3] =0; } //B71 if ((keysB[6][4] ==0) and (lastB[6][4] ==0)) { MidiSend(noteOn2, 71, velocity); lastB[6][4] =7; } //Write Midi Note Off if ((keysB[6][4] ==1) and (lastB[6][4] ==7)) { MidiSend(noteOff2, 71, velocity); lastB[6][4] =0; } //B72 if ((keysB[6][5] ==0) and (lastB[6][5] ==0)) { MidiSend(noteOn2, 72, velocity); lastB[6][5] =7; } //Write Midi Note Off if ((keysB[6][5] ==1) and (lastB[6][5] ==7)) { MidiSend(noteOff2, 72, velocity); lastB[6][5] =0; } //B73 if ((keysB[7][0] ==0) and (lastB[7][0] ==0)) { MidiSend(noteOn2, 73, velocity); lastB[7][0] =7; } //Write Midi Note Off if ((keysB[7][0] ==1) and (lastB[7][0] ==7)) { MidiSend(noteOff2, 73, velocity); lastB[7][0] =0; } //B74 if ((keysB[7][1] ==0) and (lastB[7][1] ==0)) { MidiSend(noteOn2, 74, velocity); lastB[7][1] =7; } //Write Midi Note Off if ((keysB[7][1] ==1) and (lastB[7][1] ==7)) { MidiSend(noteOff2, 74, velocity); lastB[7][1] =0; } //B75 if ((keysB[7][2] ==0) and (lastB[7][2] ==0)) { MidiSend(noteOn2, 75, velocity); lastB[7][2] =7; } //Write Midi Note Off if ((keysB[7][2] ==1) and (lastB[7][2] ==7)) { MidiSend(noteOff2, 75, velocity); lastB[7][2] =0; } //B76 if ((keysB[7][3] ==0) and (lastB[7][3] ==0)) { MidiSend(noteOn2, 76, velocity); lastB[7][3] =7; } //Write Midi Note Off if ((keysB[7][3] ==1) and (lastB[7][3] ==7)) { MidiSend(noteOff2, 76, velocity); lastB[7][3] =0; } //B77 if ((keysB[7][4] ==0) and (lastB[7][4] ==0)) { MidiSend(noteOn2, 77, velocity); lastB[7][4] =7; } //Write Midi Note Off if ((keysB[7][4] ==1) and (lastB[7][4] ==7)) { MidiSend(noteOff2, 77, velocity); lastB[7][4] =0; } //B78 if ((keysB[7][5] ==0) and (lastB[7][5] ==0)) { MidiSend(noteOn2, 78, velocity); lastB[7][5] =7; } //Write Midi Note Off if ((keysB[7][5] ==1) and (lastB[7][5] ==7)) { MidiSend(noteOff2, 78, velocity); lastB[7][5] =0; } //B79 if ((keysB[8][0] ==0) and (lastB[8][0] ==0)) { MidiSend(noteOn2, 79, velocity); lastB[8][0] =7; } //Write Midi Note Off if ((keysB[8][0] ==1) and (lastB[8][0] ==7)) { MidiSend(noteOff2, 79, velocity); lastB[8][0] =0; } //B80 if ((keysB[8][1] ==0) and (lastB[8][1] ==0)) { MidiSend(noteOn2, 80, velocity); lastB[8][1] =7; } //Write Midi Note Off if ((keysB[8][1] ==1) and (lastB[8][1] ==7)) { MidiSend(noteOff2, 80, velocity); lastB[8][1] =0; } //B81 if ((keysB[8][2] ==0) and (lastB[8][2] ==0)) { MidiSend(noteOn2, 81, velocity); lastB[8][2] =7; } //Write Midi Note Off if ((keysB[8][2] ==1) and (lastB[8][2] ==7)) { MidiSend(noteOff2, 81, velocity); lastB[8][2] =0; } //B82 if ((keysB[8][3] ==0) and (lastB[8][3] ==0)) { MidiSend(noteOn2, 82, velocity); lastB[8][3] =7; } //Write Midi Note Off if ((keysB[8][3] ==1) and (lastB[8][3] ==7)) { MidiSend(noteOff2, 82, velocity); lastB[8][3] =0; } //B83 if ((keysB[8][4] ==0) and (lastB[8][4] ==0)) { MidiSend(noteOn2, 83, velocity); lastB[8][4] =7; } //Write Midi Note Off if ((keysB[8][4] ==1) and (lastB[8][4] ==7)) { MidiSend(noteOff2, 83, velocity); lastB[8][4] =0; } //B84 if ((keysB[8][5] ==0) and (lastB[8][5] ==0)) { MidiSend(noteOn2, 84, velocity); lastB[8][5] =7; } //Write Midi Note Off if ((keysB[8][5] ==1) and (lastB[8][5] ==7)) { MidiSend(noteOff2, 84, velocity); lastB[8][5] =0; } //B85 if ((keysB[9][0] ==0) and (lastB[9][0] ==0)) { MidiSend(noteOn2, 85, velocity); lastB[9][0] =7; } //Write Midi Note Off if ((keysB[9][0] ==1) and (lastB[9][0] ==7)) { MidiSend(noteOff2, 85, velocity); lastB[9][0] =0; } //B86 if ((keysB[9][1] ==0) and (lastB[9][1] ==0)) { MidiSend(noteOn2, 86, velocity); lastB[9][1] =7; } //Write Midi Note Off if ((keysB[9][1] ==1) and (lastB[9][1] ==7)) { MidiSend(noteOff2, 86, velocity); lastB[9][1] =0; } //B87 if ((keysB[9][2] ==0) and (lastB[9][2] ==0)) { MidiSend(noteOn2, 87, velocity); lastB[9][2] =7; } //Write Midi Note Off if ((keysB[9][2] ==1) and (lastB[9][2] ==7)) { MidiSend(noteOff2, 87, velocity); lastB[9][2] =0; } //B88 if ((keysB[9][3] ==0) and (lastB[9][3] ==0)) { MidiSend(noteOn2, 88, velocity); lastB[9][3] =7; } //Write Midi Note Off if ((keysB[9][3] ==1) and (lastB[9][3] ==7)) { MidiSend(noteOff2, 88, velocity); lastB[9][3] =0; } //B89 if ((keysB[9][4] ==0) and (lastB[9][4] ==0)) { MidiSend(noteOn2, 89, velocity); lastB[9][4] =7; } //Write Midi Note Off if ((keysB[9][4] ==1) and (lastB[9][4] ==7)) { MidiSend(noteOff2, 89, velocity); lastB[9][4] =0; } //B90 if ((keysB[9][5] ==0) and (lastB[9][5] ==0)) { MidiSend(noteOn2, 90, velocity); lastB[9][5] =7; } //Write Midi Note Off if ((keysB[9][5] ==1) and (lastB[9][5] ==7)) { MidiSend(noteOff2, 90, velocity); lastB[9][5] =0; } //B91 if ((keysB[10][0] ==0) and (lastB[10][0] ==0)) { MidiSend(noteOn2, 91, velocity); lastB[10][0] =7; } //Write Midi Note Off if ((keysB[10][0] ==1) and (lastB[10][0] ==7)) { MidiSend(noteOff2, 91, velocity); lastB[10][0] =0; } //B92 if ((keysB[10][1] ==0) and (lastB[10][1] ==0)) { MidiSend(noteOn2, 92, velocity); lastB[10][1] =7; } //Write Midi Note Off if ((keysB[10][1] ==1) and (lastB[10][1] ==7)) { MidiSend(noteOff2, 92, velocity); lastB[10][1] =0; } //B93 if ((keysB[10][2] ==0) and (lastB[10][2] ==0)) { MidiSend(noteOn2, 93, velocity); lastB[10][2] =7; } //Write Midi Note Off if ((keysB[10][2] ==1) and (lastB[10][2] ==7)) { MidiSend(noteOff2, 93, velocity); lastB[10][2] =0; } //B94 if ((keysB[10][3] ==0) and (lastB[10][3] ==0)) { MidiSend(noteOn2, 94, velocity); lastB[10][3] =7; } //Write Midi Note Off if ((keysB[10][3] ==1) and (lastB[10][3] ==7)) { MidiSend(noteOff2, 94, velocity); lastB[10][3] =0; } //B95 if ((keysB[10][4] ==0) and (lastB[10][4] ==0)) { MidiSend(noteOn2, 95, velocity); lastB[10][4] =7; } //Write Midi Note Off if ((keysB[10][4] ==1) and (lastB[10][4] ==7)) { MidiSend(noteOff2, 95, velocity); lastB[10][4] =0; } //B96 if ((keysB[10][5] ==0) and (lastB[10][5] ==0)) { MidiSend(noteOn2, 96, velocity); lastB[10][5] =7; } //Write Midi Note Off if ((keysB[10][5] ==1) and (lastB[10][5] ==7)) { MidiSend(noteOff2, 96, velocity); lastB[10][5] =0; } //Write Keyboard C //C36 if ((keysC[0][0] ==0) and (lastC[0][0] ==0)) { MidiSend(noteOff3, 36, velocity); lastC[0][0] =7; } if ((keysC[0][0] ==1) and (lastC[0][0] ==7)) { MidiSend(noteOn3, 36, velocity); lastC[0][0] =0; } //C37 if ((keysC[1][0] ==0) and (lastC[1][0] ==0)) { MidiSend(noteOff3, 37, velocity); lastC[1][0] =7; } if ((keysC[1][0] ==1) and (lastC[1][0] ==7)) { MidiSend(noteOn3, 37, velocity); lastC[1][0] =0; } //C38 if ((keysC[1][1] ==0) and (lastC[1][1] ==0)) { MidiSend(noteOff3, 38, velocity); lastC[1][1] =7; } //Write Midi Note Off if ((keysC[1][1] ==1) and (lastC[1][1] ==7)) { MidiSend(noteOn3, 38, velocity); lastC[1][1] =0; } //C39 if ((keysC[1][2] ==0) and (lastC[1][2] ==0)) { MidiSend(noteOff3, 39, velocity); lastC[1][2] =7; } //Write Midi Note Off if ((keysC[1][2] ==1) and (lastC[1][2] ==7)) { MidiSend(noteOn3, 39, velocity); lastC[1][2] =0; } //C40 if ((keysC[1][3] ==0) and (lastC[1][3] ==0)) { MidiSend(noteOff3, 40, velocity); lastC[1][3] =7; } //Write Midi Note Off if ((keysC[1][3] ==1) and (lastC[1][3] ==7)) { MidiSend(noteOn3, 40, velocity); lastC[1][3] =0; } //C41 if ((keysC[1][4] ==0) and (lastC[1][4] ==0)) { MidiSend(noteOff3, 41, velocity); lastC[1][4] =7; } //Write Midi Note Off if ((keysC[1][4] ==1) and (lastC[1][4] ==7)) { MidiSend(noteOn3, 41, velocity); lastC[1][4] =0; } //C42 if ((keysC[1][5] ==0) and (lastC[1][5] ==0)) { MidiSend(noteOff3, 42, velocity); lastC[1][5] =7; } //Write Midi Note Off if ((keysC[1][5] ==1) and (lastC[1][5] ==7)) { MidiSend(noteOn3, 42, velocity); lastC[1][5] =0; } //C43 if ((keysC[2][0] ==0) and (lastC[2][0] ==0)) { MidiSend(noteOff3, 43, velocity); lastC[2][0] =7; } //Write Midi Note Off if ((keysC[2][0] ==1) and (lastC[2][0] ==7)) { MidiSend(noteOn3, 43, velocity); lastC[2][0] =0; } //C44 if ((keysC[2][1] ==0) and (lastC[2][1] ==0)) { MidiSend(noteOff3, 44, velocity); lastC[2][1] =7; } //Write Midi Note Off if ((keysC[2][1] ==1) and (lastC[2][1] ==7)) { MidiSend(noteOn3, 44, velocity); lastC[2][1] =0; } //C45 if ((keysC[2][2] ==0) and (lastC[2][2] ==0)) { MidiSend(noteOff3, 45, velocity); lastC[2][2] =7; } //Write Midi Note Off if ((keysC[2][2] ==1) and (lastC[2][2] ==7)) { MidiSend(noteOn3, 45, velocity); lastC[2][2] =0; } //C46 if ((keysC[2][3] ==0) and (lastC[2][3] ==0)) { MidiSend(noteOff3, 46, velocity); lastC[2][3] =7; } //Write Midi Note Off if ((keysC[2][3] ==1) and (lastC[2][3] ==7)) { MidiSend(noteOn3, 46, velocity); lastC[2][3] =0; } //C47 if ((keysC[2][4] ==0) and (lastC[2][4] ==0)) { MidiSend(noteOff3, 47, velocity); lastC[2][4] =7; } //Write Midi Note Off if ((keysC[2][4] ==1) and (lastC[2][4] ==7)) { MidiSend(noteOn3, 47, velocity); lastC[2][4] =0; } //C48 if ((keysC[2][5] ==0) and (lastC[2][5] ==0)) { MidiSend(noteOff3, 48, velocity); lastC[2][5] =7; } //Write Midi Note Off if ((keysC[2][5] ==1) and (lastC[2][5] ==7)) { MidiSend(noteOn3, 48, velocity); lastC[2][5] =0; } //C49 if ((keysC[3][0] ==0) and (lastC[3][0] ==0)) { MidiSend(noteOff3, 49, velocity); lastC[3][0] =7; } //Write Midi Note Off if ((keysC[3][0] ==1) and (lastC[3][0] ==7)) { MidiSend(noteOn3, 49, velocity); lastC[3][0] =0; } //C50 if ((keysC[3][1] ==0) and (lastC[3][1] ==0)) { MidiSend(noteOff3, 50, velocity); lastC[3][1] =7; } //Write Midi Note Off if ((keysC[3][1] ==1) and (lastC[3][1] ==7)) { MidiSend(noteOn3, 50, velocity); lastC[3][1] =0; } //C51 if ((keysC[3][2] ==0) and (lastC[3][2] ==0)) { MidiSend(noteOff3, 51, velocity); lastC[3][2] =7; } //Write Midi Note Off if ((keysC[3][2] ==1) and (lastC[3][2] ==7)) { MidiSend(noteOn3, 51, velocity); lastC[3][2] =0; } //C52 if ((keysC[3][3] ==0) and (lastC[3][3] ==0)) { MidiSend(noteOff3, 52, velocity); lastC[3][3] =7; } //Write Midi Note Off if ((keysC[3][3] ==1) and (lastC[3][3] ==7)) { MidiSend(noteOn3, 52, velocity); lastC[3][3] =0; } //C53 if ((keysC[3][4] ==0) and (lastC[3][4] ==0)) { MidiSend(noteOff3, 53, velocity); lastC[3][4] =7; } //Write Midi Note Off if ((keysC[3][4] ==1) and (lastC[3][4] ==7)) { MidiSend(noteOn3, 53, velocity); lastC[3][4] =0; } //C54 if ((keysC[3][5] ==0) and (lastC[3][5] ==0)) { MidiSend(noteOff3, 54, velocity); lastC[3][5] =7; } //Write Midi Note Off if ((keysC[3][5] ==1) and (lastC[3][5] ==7)) { MidiSend(noteOn3, 54, velocity); lastC[3][5] =0; } //C55 if ((keysC[4][0] ==0) and (lastC[4][0] ==0)) { MidiSend(noteOff3, 55, velocity); lastC[4][0] =7; } //Write Midi Note Off if ((keysC[4][0] ==1) and (lastC[4][0] ==7)) { MidiSend(noteOn3, 55, velocity); lastC[4][0] =0; } //C56 if ((keysC[4][1] ==0) and (lastC[4][1] ==0)) { MidiSend(noteOff3, 56, velocity); lastC[4][1] =7; } //Write Midi Note Off if ((keysC[4][1] ==1) and (lastC[4][1] ==7)) { MidiSend(noteOn3, 56, velocity); lastC[4][1] =0; } //C57 if ((keysC[4][2] ==0) and (lastC[4][2] ==0)) { MidiSend(noteOff3, 57, velocity); lastC[4][2] =7; } //Write Midi Note Off if ((keysC[4][2] ==1) and (lastC[4][2] ==7)) { MidiSend(noteOn3, 57, velocity); lastC[4][2] =0; } //C58 if ((keysC[4][3] ==0) and (lastC[4][3] ==0)) { MidiSend(noteOff3, 58, velocity); lastC[4][3] =7; } //Write Midi Note Off if ((keysC[4][3] ==1) and (lastC[4][3] ==7)) { MidiSend(noteOn3, 58, velocity); lastC[4][3] =0; } //C59 if ((keysC[4][4] ==0) and (lastC[4][4] ==0)) { MidiSend(noteOff3, 59, velocity); lastC[4][4] =7; } //Write Midi Note Off if ((keysC[4][4] ==1) and (lastC[4][4] ==7)) { MidiSend(noteOn3, 59, velocity); lastC[4][4] =0; } //C60 if ((keysC[4][5] ==0) and (lastC[4][5] ==0)) { MidiSend(noteOff3, 60, velocity); lastC[4][5] =7; } //Write Midi Note Off if ((keysC[4][5] ==1) and (lastC[4][5] ==7)) { MidiSend(noteOn3, 60, velocity); lastC[4][5] =0; } //C61 if ((keysC[5][0] ==0) and (lastC[5][0] ==0)) { MidiSend(noteOff3, 61, velocity); lastC[5][0] =7; } //Write Midi Note Off if ((keysC[5][0] ==1) and (lastC[5][0] ==7)) { MidiSend(noteOn3, 61, velocity); lastC[5][0] =0; } //C62 if ((keysC[5][1] ==0) and (lastC[5][1] ==0)) { MidiSend(noteOff3, 62, velocity); lastC[5][1] =7; } //Write Midi Note Off if ((keysC[5][1] ==1) and (lastC[5][1] ==7)) { MidiSend(noteOn3, 62, velocity); lastC[5][1] =0; } //C63 if ((keysC[5][2] ==0) and (lastC[5][2] ==0)) { MidiSend(noteOff3, 63, velocity); lastC[5][2] =7; } //Write Midi Note Off if ((keysC[5][2] ==1) and (lastC[5][2] ==7)) { MidiSend(noteOn3, 63, velocity); lastC[5][2] =0; } //C64 if ((keysC[5][3] ==0) and (lastC[5][3] ==0)) { MidiSend(noteOff3, 64, velocity); lastC[5][3] =7; } //Write Midi Note Off if ((keysC[5][3] ==1) and (lastC[5][3] ==7)) { MidiSend(noteOn3, 64, velocity); lastC[5][3] =0; } //C65 if ((keysC[5][4] ==0) and (lastC[5][4] ==0)) { MidiSend(noteOff3, 65, velocity); lastC[5][4] =7; } //Write Midi Note Off if ((keysC[5][4] ==1) and (lastC[5][4] ==7)) { MidiSend(noteOn3, 65, velocity); lastC[5][4] =0; } //C66 if ((keysC[5][5] ==0) and (lastC[5][5] ==0)) { MidiSend(noteOff3, 66, velocity); lastC[5][5] =7; } //Write Midi Note Off if ((keysC[5][5] ==1) and (lastC[5][5] ==7)) { MidiSend(noteOn3, 66, velocity); lastC[5][5] =0; } //C67 if ((keysC[6][0] ==0) and (lastC[6][0] ==0)) { MidiSend(noteOff3, 67, velocity); lastC[6][0] =7; } //Write Midi Note Off if ((keysC[6][0] ==1) and (lastC[6][0] ==7)) { MidiSend(noteOn3, 67, velocity); lastC[6][0] =0; } //Expression pedal on analog pin 0 to Channel 6 int Cur6 =analogRead(0); int Map6 =map(Cur6, 0, 1023, 0, 127); if (abs(Cur6 - LastPot6)>=8) { MidiSend(chan6,Exp,Map6); LastPot6 =Cur6; } //Expression pedal on analog pin 1 to Channel 7 int Cur7 =analogRead(1); int Map7 =map(Cur7, 0, 1023, 0, 127); if (abs(Cur7 - LastPot7)>=8) { MidiSend(chan7,Exp,Map7); LastPot7 =Cur7; } }void MidiSend(int one, int two, int three) { Serial.write(one); Serial.write(two); Serial.write(three); }
Bussed Keyboard CodeArduino
Code to upload to the Arduino if you are following the Bussed Keyboard Schematic.
// Name:Arduino Mega Midi Controller 61x4 plus 3 potentiometers.// Version 1.0// Created:April 12, 2021// Author:Larason2// Acknowledgements:Bald Engineer, Amanda Ghassaei, jeffb42, GrumpyMike//Note Databyte keysA[11][6];byte keysB[11][6];byte keysC[11][6];byte keysD[11][6];//Last Key Statebyte lastA[11][6];byte lastB[11][6];byte lastC[11][6];byte lastD[11][6];//Midi Messages Sentint noteOn1 =144;int noteOff1 =128;int noteOn2 =145;int noteOff2 =129;int noteOn3 =146;int noteOff3 =130;int noteOn4 =147;int noteOff4 =131;int velocity =100;int chan6 =181;int chan7 =182;int chan8 =183;int Exp =11;//Last Potentiometer Stateint LastPot6 =1;int LastPot7 =1;int LastPot8 =1;void setup() { // Start Serial at Midi rate Serial.begin(31250); //Initialize Pins 1-10 pinMode(2, INPUT); pinMode(3, INPUT); pinMode(4, INPUT); pinMode(5, INPUT); pinMode(6, INPUT); pinMode(7, INPUT); pinMode(8, INPUT); pinMode(9, INPUT); pinMode(10, INPUT); pinMode(11, INPUT); //Pins 11-20 pinMode(12, INPUT); pinMode(13, INPUT); pinMode(14, INPUT); pinMode(15, INPUT); pinMode(16, INPUT); pinMode(17, INPUT); pinMode(18, INPUT); pinMode(19, INPUT); pinMode(20, INPUT); pinMode(21, INPUT); //Pins 21-30 pinMode(22, INPUT); pinMode(23, INPUT); pinMode(24, INPUT); pinMode(25, INPUT); pinMode(26, INPUT); pinMode(27, INPUT); pinMode(28, INPUT); pinMode(29, INPUT); pinMode(30, INPUT); pinMode(31, INPUT); //Pins 31-40 pinMode(32, INPUT); pinMode(33, INPUT); pinMode(34, INPUT); pinMode(35, INPUT); pinMode(36, INPUT); pinMode(37, INPUT); pinMode(38, INPUT); pinMode(39, INPUT); pinMode(40, INPUT); pinMode(41, INPUT); //Pins 41-50 pinMode(42, INPUT); pinMode(43, INPUT); pinMode(44, INPUT); pinMode(45, INPUT); pinMode(46, INPUT); pinMode(47, INPUT); pinMode(48, INPUT); pinMode(49, INPUT); pinMode(50, INPUT); pinMode(51, INPUT); //Pins 51-61 pinMode(52, INPUT); pinMode(53, INPUT); pinMode(A0, INPUT); pinMode(A1, INPUT); pinMode(A2, INPUT); pinMode(A3, INPUT); pinMode(A4, INPUT); pinMode(A5, INPUT); pinMode(A6, INPUT); pinMode(A7, INPUT); pinMode(A8, INPUT); //Column Pins pinMode(A9, INPUT); pinMode(A10, INPUT); pinMode(A11, INPUT); pinMode(A12, INPUT); //Pot Pins pinMode(A13, INPUT); pinMode(A14, INPUT); pinMode(A15, INPUT);}void loop() { // Setup pins for keyboards //Pins 1-10 pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); pinMode(4, INPUT_PULLUP); pinMode(5, INPUT_PULLUP); pinMode(6, INPUT_PULLUP); pinMode(7, INPUT_PULLUP); pinMode(8, INPUT_PULLUP); pinMode(9, INPUT_PULLUP); pinMode(10, INPUT_PULLUP); pinMode(11, INPUT_PULLUP); //Pins 11-20 pinMode(12, INPUT_PULLUP); pinMode(13, INPUT_PULLUP); pinMode(14, INPUT_PULLUP); pinMode(15, INPUT_PULLUP); pinMode(16, INPUT_PULLUP); pinMode(17, INPUT_PULLUP); pinMode(18, INPUT_PULLUP); pinMode(19, INPUT_PULLUP); pinMode(20, INPUT_PULLUP); pinMode(21, INPUT_PULLUP); //Pins 21-30 pinMode(22, INPUT_PULLUP); pinMode(23, INPUT_PULLUP); pinMode(24, INPUT_PULLUP); pinMode(25, INPUT_PULLUP); pinMode(26, INPUT_PULLUP); pinMode(27, INPUT_PULLUP); pinMode(28, INPUT_PULLUP); pinMode(29, INPUT_PULLUP); pinMode(30, INPUT_PULLUP); pinMode(31, INPUT_PULLUP); //Pins 31-40 pinMode(32, INPUT_PULLUP); pinMode(33, INPUT_PULLUP); pinMode(34, INPUT_PULLUP); pinMode(35, INPUT_PULLUP); pinMode(36, INPUT_PULLUP); pinMode(37, INPUT_PULLUP); pinMode(38, INPUT_PULLUP); pinMode(39, INPUT_PULLUP); pinMode(40, INPUT_PULLUP); pinMode(41, INPUT_PULLUP); //Pins 41-50 pinMode(42, INPUT_PULLUP); pinMode(43, INPUT_PULLUP); pinMode(44, INPUT_PULLUP); pinMode(45, INPUT_PULLUP); pinMode(46, INPUT_PULLUP); pinMode(47, INPUT_PULLUP); pinMode(48, INPUT_PULLUP); pinMode(49, INPUT_PULLUP); pinMode(50, INPUT_PULLUP); pinMode(51, INPUT_PULLUP); //Pins 51-61 pinMode(52, INPUT_PULLUP); pinMode(53, INPUT_PULLUP); pinMode(A0, INPUT_PULLUP); pinMode(A1, INPUT_PULLUP); pinMode(A2, INPUT_PULLUP); pinMode(A3, INPUT_PULLUP); pinMode(A4, INPUT_PULLUP); pinMode(A5, INPUT_PULLUP); pinMode(A6, INPUT_PULLUP); pinMode(A7, INPUT_PULLUP); pinMode(A8, INPUT_PULLUP); //Read Keyboard A pinMode(A9, OUTPUT); digitalWrite(A9, LOW); //Keys 1-10 keysA[0][0] =digitalRead(2); keysA[1][0] =digitalRead(3); keysA[1][1] =digitalRead(4); keysA[1][2] =digitalRead(5); keysA[1][3] =digitalRead(6); keysA[1][4] =digitalRead(7); keysA[1][5] =digitalRead(8); keysA[2][0] =digitalRead(9); keysA[2][1] =digitalRead(10); keysA[2][2] =digitalRead(11); //Keys 11-20 keysA[2][3] =digitalRead(12); keysA[2][4] =digitalRead(13); keysA[2][5] =digitalRead(14); keysA[3][0] =digitalRead(15); keysA[3][1] =digitalRead(16); keysA[3][2] =digitalRead(17); keysA[3][3] =digitalRead(18); keysA[3][4] =digitalRead(19); keysA[3][5] =digitalRead(20); keysA[4][0] =digitalRead(21); //Keys 21-30 keysA[4][1] =digitalRead(22); keysA[4][2] =digitalRead(23); keysA[4][3] =digitalRead(24); keysA[4][4] =digitalRead(25); keysA[4][5] =digitalRead(26); keysA[5][0] =digitalRead(27); keysA[5][1] =digitalRead(28); keysA[5][2] =digitalRead(29); keysA[5][3] =digitalRead(30); keysA[5][4] =digitalRead(31); //Keys 31-40 keysA[5][5] =digitalRead(32); keysA[6][0] =digitalRead(33); keysA[6][1] =digitalRead(34); keysA[6][2] =digitalRead(35); keysA[6][3] =digitalRead(36); keysA[6][4] =digitalRead(37); keysA[6][5] =digitalRead(38); keysA[7][0] =digitalRead(39); keysA[7][1] =digitalRead(40); keysA[7][2] =digitalRead(41); //Keys 41-50 keysA[7][3] =digitalRead(42); keysA[7][4] =digitalRead(43); keysA[7][5] =digitalRead(44); keysA[8][0] =digitalRead(45); keysA[8][1] =digitalRead(46); keysA[8][2] =digitalRead(47); keysA[8][3] =digitalRead(48); keysA[8][4] =digitalRead(49); keysA[8][5] =digitalRead(50); keysA[9][0] =digitalRead(51); //Keys 51-61 keysA[9][1] =digitalRead(52); keysA[9][2] =digitalRead(53); keysA[9][3] =digitalRead(A0); keysA[9][4] =digitalRead(A1); keysA[9][5] =digitalRead(A2); keysA[10][0] =digitalRead(A3); keysA[10][1] =digitalRead(A4); keysA[10][2] =digitalRead(A5); keysA[10][3] =digitalRead(A6); keysA[10][4] =digitalRead(A7); keysA[10][5] =digitalRead(A8); pinMode(A9, INPUT); // Read Keyboard B pinMode(A10, OUTPUT); digitalWrite(A10, LOW); //Keys 1-10 keysB[0][0] =digitalRead(2); keysB[1][0] =digitalRead(3); keysB[1][1] =digitalRead(4); keysB[1][2] =digitalRead(5); keysB[1][3] =digitalRead(6); keysB[1][4] =digitalRead(7); keysB[1][5] =digitalRead(8); keysB[2][0] =digitalRead(9); keysB[2][1] =digitalRead(10); keysB[2][2] =digitalRead(11); //Keys 11-20 keysB[2][3] =digitalRead(12); keysB[2][4] =digitalRead(13); keysB[2][5] =digitalRead(14); keysB[3][0] =digitalRead(15); keysB[3][1] =digitalRead(16); keysB[3][2] =digitalRead(17); keysB[3][3] =digitalRead(18); keysB[3][4] =digitalRead(19); keysB[3][5] =digitalRead(20); keysB[4][0] =digitalRead(21); //Keys 21-30 keysB[4][1] =digitalRead(22); keysB[4][2] =digitalRead(23); keysB[4][3] =digitalRead(24); keysB[4][4] =digitalRead(25); keysB[4][5] =digitalRead(26); keysB[5][0] =digitalRead(27); keysB[5][1] =digitalRead(28); keysB[5][2] =digitalRead(29); keysB[5][3] =digitalRead(30); keysB[5][4] =digitalRead(31); //Keys 31-40 keysB[5][5] =digitalRead(32); keysB[6][0] =digitalRead(33); keysB[6][1] =digitalRead(34); keysB[6][2] =digitalRead(35); keysB[6][3] =digitalRead(36); keysB[6][4] =digitalRead(37); keysB[6][5] =digitalRead(38); keysB[7][0] =digitalRead(39); keysB[7][1] =digitalRead(40); keysB[7][2] =digitalRead(41); //Keys 41-50 keysB[7][3] =digitalRead(42); keysB[7][4] =digitalRead(43); keysB[7][5] =digitalRead(44); keysB[8][0] =digitalRead(45); keysB[8][1] =digitalRead(46); keysB[8][2] =digitalRead(47); keysB[8][3] =digitalRead(48); keysB[8][4] =digitalRead(49); keysB[8][5] =digitalRead(50); keysB[9][0] =digitalRead(51); //Keys 51-61 keysB[9][1] =digitalRead(52); keysB[9][2] =digitalRead(53); keysB[9][3] =digitalRead(A0); keysB[9][4] =digitalRead(A1); keysB[9][5] =digitalRead(A2); keysB[10][0] =digitalRead(A3); keysB[10][1] =digitalRead(A4); keysB[10][2] =digitalRead(A5); keysB[10][3] =digitalRead(A6); keysB[10][4] =digitalRead(A7); keysB[10][5] =digitalRead(A8); pinMode(A10, INPUT); // Read Keyboard C pinMode(A11, OUTPUT); digitalWrite(A11, LOW); //Keys 1-10 keysC[0][0] =digitalRead(2); keysC[1][0] =digitalRead(3); keysC[1][1] =digitalRead(4); keysC[1][2] =digitalRead(5); keysC[1][3] =digitalRead(6); keysC[1][4] =digitalRead(7); keysC[1][5] =digitalRead(8); keysC[2][0] =digitalRead(9); keysC[2][1] =digitalRead(10); keysC[2][2] =digitalRead(11); //Keys 11-20 keysC[2][3] =digitalRead(12); keysC[2][4] =digitalRead(13); keysC[2][5] =digitalRead(14); keysC[3][0] =digitalRead(15); keysC[3][1] =digitalRead(16); keysC[3][2] =digitalRead(17); keysC[3][3] =digitalRead(18); keysC[3][4] =digitalRead(19); keysC[3][5] =digitalRead(20); keysC[4][0] =digitalRead(21); //Keys 21-30 keysC[4][1] =digitalRead(22); keysC[4][2] =digitalRead(23); keysC[4][3] =digitalRead(24); keysC[4][4] =digitalRead(25); keysC[4][5] =digitalRead(26); keysC[5][0] =digitalRead(27); keysC[5][1] =digitalRead(28); keysC[5][2] =digitalRead(29); keysC[5][3] =digitalRead(30); keysC[5][4] =digitalRead(31); //Keys 31-40 keysC[5][5] =digitalRead(32); keysC[6][0] =digitalRead(33); keysC[6][1] =digitalRead(34); keysC[6][2] =digitalRead(35); keysC[6][3] =digitalRead(36); keysC[6][4] =digitalRead(37); keysC[6][5] =digitalRead(38); keysC[7][0] =digitalRead(39); keysC[7][1] =digitalRead(40); keysC[7][2] =digitalRead(41); //Keys 41-50 keysC[7][3] =digitalRead(42); keysC[7][4] =digitalRead(43); keysC[7][5] =digitalRead(44); keysC[8][0] =digitalRead(45); keysC[8][1] =digitalRead(46); keysC[8][2] =digitalRead(47); keysC[8][3] =digitalRead(48); keysC[8][4] =digitalRead(49); keysC[8][5] =digitalRead(50); keysC[9][0] =digitalRead(51); //Keys 51-61 keysC[9][1] =digitalRead(52); keysC[9][2] =digitalRead(53); keysC[9][3] =digitalRead(A0); keysC[9][4] =digitalRead(A1); keysC[9][5] =digitalRead(A2); keysC[10][0] =digitalRead(A3); keysC[10][1] =digitalRead(A4); keysC[10][2] =digitalRead(A5); keysC[10][3] =digitalRead(A6); keysC[10][4] =digitalRead(A7); keysC[10][5] =digitalRead(A8); pinMode(A11, INPUT); // Read Keyboard D pinMode(A12, OUTPUT); digitalWrite(A12, LOW); //Keys 1-10 keysD[0][0] =digitalRead(2); keysD[1][0] =digitalRead(3); keysD[1][1] =digitalRead(4); keysD[1][2] =digitalRead(5); keysD[1][3] =digitalRead(6); keysD[1][4] =digitalRead(7); keysD[1][5] =digitalRead(8); keysD[2][0] =digitalRead(9); keysD[2][1] =digitalRead(10); keysD[2][2] =digitalRead(11); //Keys 11-20 keysD[2][3] =digitalRead(12); keysD[2][4] =digitalRead(13); keysD[2][5] =digitalRead(14); keysD[3][0] =digitalRead(15); keysD[3][1] =digitalRead(16); keysD[3][2] =digitalRead(17); keysD[3][3] =digitalRead(18); keysD[3][4] =digitalRead(19); keysD[3][5] =digitalRead(20); keysD[4][0] =digitalRead(21); //Keys 21-30 keysD[4][1] =digitalRead(22); keysD[4][2] =digitalRead(23); keysD[4][3] =digitalRead(24); keysD[4][4] =digitalRead(25); keysD[4][5] =digitalRead(26); keysD[5][0] =digitalRead(27); keysD[5][1] =digitalRead(28); keysD[5][2] =digitalRead(29); keysD[5][3] =digitalRead(30); keysD[5][4] =digitalRead(31); //Keys 31-40 keysD[5][5] =digitalRead(32); keysD[6][0] =digitalRead(33); keysD[6][1] =digitalRead(34); keysD[6][2] =digitalRead(35); keysD[6][3] =digitalRead(36); keysD[6][4] =digitalRead(37); keysD[6][5] =digitalRead(38); keysD[7][0] =digitalRead(39); keysD[7][1] =digitalRead(40); keysD[7][2] =digitalRead(41); //Keys 41-50 keysD[7][3] =digitalRead(42); keysD[7][4] =digitalRead(43); keysD[7][5] =digitalRead(44); keysD[8][0] =digitalRead(45); keysD[8][1] =digitalRead(46); keysD[8][2] =digitalRead(47); keysD[8][3] =digitalRead(48); keysD[8][4] =digitalRead(49); keysD[8][5] =digitalRead(50); keysD[9][0] =digitalRead(51); //Keys 51-61 keysD[9][1] =digitalRead(52); keysD[9][2] =digitalRead(53); keysD[9][3] =digitalRead(A0); keysD[9][4] =digitalRead(A1); keysD[9][5] =digitalRead(A2); keysD[10][0] =digitalRead(A3); keysD[10][1] =digitalRead(A4); keysD[10][2] =digitalRead(A5); keysD[10][3] =digitalRead(A6); keysD[10][4] =digitalRead(A7); keysD[10][5] =digitalRead(A8); pinMode(A12, INPUT); //Return pins to Initialized state //Pins 1-10 pinMode(2, INPUT); pinMode(3, INPUT); pinMode(4, INPUT); pinMode(5, INPUT); pinMode(6, INPUT); pinMode(7, INPUT); pinMode(8, INPUT); pinMode(9, INPUT); pinMode(10, INPUT); pinMode(11, INPUT); //Pins 11-20 pinMode(12, INPUT); pinMode(13, INPUT); pinMode(14, INPUT); pinMode(15, INPUT); pinMode(16, INPUT); pinMode(17, INPUT); pinMode(18, INPUT); pinMode(19, INPUT); pinMode(20, INPUT); pinMode(21, INPUT); //Pins 21-30 pinMode(22, INPUT); pinMode(23, INPUT); pinMode(24, INPUT); pinMode(25, INPUT); pinMode(26, INPUT); pinMode(27, INPUT); pinMode(28, INPUT); pinMode(29, INPUT); pinMode(30, INPUT); pinMode(31, INPUT); //Pins 31-40 pinMode(32, INPUT); pinMode(33, INPUT); pinMode(34, INPUT); pinMode(35, INPUT); pinMode(36, INPUT); pinMode(37, INPUT); pinMode(38, INPUT); pinMode(39, INPUT); pinMode(40, INPUT); pinMode(41, INPUT); //Pins 41-50 pinMode(42, INPUT); pinMode(43, INPUT); pinMode(44, INPUT); pinMode(45, INPUT); pinMode(46, INPUT); pinMode(47, INPUT); pinMode(48, INPUT); pinMode(49, INPUT); pinMode(50, INPUT); pinMode(51, INPUT); //Pins 51-61 pinMode(52, INPUT); pinMode(53, INPUT); pinMode(A0, INPUT); pinMode(A1, INPUT); pinMode(A2, INPUT); pinMode(A3, INPUT); pinMode(A4, INPUT); pinMode(A5, INPUT); pinMode(A6, INPUT); pinMode(A7, INPUT); pinMode(A8, INPUT); //Column Pins pinMode(A9, INPUT); pinMode(A10, INPUT); pinMode(A11, INPUT); pinMode(A12, INPUT); //Pot Pins pinMode(A13, INPUT); pinMode(A14, INPUT); pinMode(A15, INPUT); /* //Invert Keyboard data only if needed. //Example only for 32 pedals of a pedalboard, first 32 keys of keyboard C. //Column 1 if (keysC[0][0] ==0) { keysC[0][0] =1; } else if (keysC[0][0] ==1) { keysC[0][0] =0; } //Column 2 if (keysC[1][0] ==0) { keysC[1][0] =1; } else if (keysC[1][0] ==1) { keysC[1][0] =0; } if (keysC[1][1] ==0) { keysC[1][1] =1; } else if (keysC[1][1] ==1) { keysC[1][1] =0; } if (keysC[1][2] ==0) { keysC[1][2] =1; } else if (keysC[1][2] ==1) { keysC[1][2] =0; } if (keysC[1][3] ==0) { keysC[1][3] =1; } else if (keysC[1][3] ==1) { keysC[1][3] =0; } if (keysC[1][4] ==0) { keysC[1][4] =1; } else if (keysC[1][4] ==1) { keysC[1][4] =0; } if (keysC[1][5] ==0) { keysC[1][5] =1; } else if (keysC[1][5] ==1) { keysC[1][5] =0; } //Column 3 if (keysC[2][0] ==0) { keysC[2][0] =1; } else if (keysC[2][0] ==1) { keysC[2][0] =0; } if (keysC[2][1] ==0) { keysC[2][1] =1; } else if (keysC[2][1] ==1) { keysC[2][1] =0; } if (keysC[2][2] ==0) { keysC[2][2] =1; } else if (keysC[2][2] ==1) { keysC[2][2] =0; } if (keysC[2][3] ==0) { keysC[2][3] =1; } else if (keysC[2][3] ==1) { keysC[2][3] =0; } if (keysC[2][4] ==0) { keysC[2][4] =1; } else if (keysC[2][4] ==1) { keysC[2][4] =0; } if (keysC[2][5] ==0) { keysC[2][5] =1; } else if (keysC[2][5] ==1) { keysC[2][5] =0; } //Column 4 if (keysC[3][0] ==0) { keysC[3][0] =1; } else if (keysC[3][0] ==1) { keysC[3][0] =0; } if (keysC[3][1] ==0) { keysC[3][1] =1; } else if (keysC[3][1] ==1) { keysC[3][1] =0; } if (keysC[3][2] ==0) { keysC[3][2] =1; } else if (keysC[3][2] ==1) { keysC[3][2] =0; } if (keysC[3][3] ==0) { keysC[3][3] =1; } else if (keysC[3][3] ==1) { keysC[3][3] =0; } if (keysC[3][4] ==0) { keysC[3][4] =1; } else if (keysC[3][4] ==1) { keysC[3][4] =0; } if (keysC[3][5] ==0) { keysC[3][5] =1; } else if (keysC[3][5] ==1) { keysC[3][5] =0; } //Column 5 if (keysC[4][0] ==0) { keysC[4][0] =1; } else if (keysC[4][0] ==1) { keysC[4][0] =0; } if (keysC[4][1] ==0) { keysC[4][1] =1; } else if (keysC[4][1] ==1) { keysC[4][1] =0; } if (keysC[4][2] ==0) { keysC[4][2] =1; } else if (keysC[4][2] ==1) { keysC[4][2] =0; } if (keysC[4][3] ==0) { keysC[4][3] =1; } else if (keysC[4][3] ==1) { keysC[4][3] =0; } if (keysC[4][4] ==0) { keysC[4][4] =1; } else if (keysC[4][4] ==1) { keysC[4][4] =0; } if (keysC[4][5] ==0) { keysC[4][5] =1; } else if (keysC[4][5] ==1) { keysC[4][5] =0; } //Column 6 if (keysC[5][0] ==0) { keysC[5][0] =1; } else if (keysC[5][0] ==1) { keysC[5][0] =0; } if (keysC[5][1] ==0) { keysC[5][1] =1; } else if (keysC[5][1] ==1) { keysC[5][1] =0; } if (keysC[5][2] ==0) { keysC[5][2] =1; } else if (keysC[5][2] ==1) { keysC[5][2] =0; } if (keysC[5][3] ==0) { keysC[5][3] =1; } else if (keysC[5][3] ==1) { keysC[5][3] =0; } if (keysC[5][4] ==0) { keysC[5][4] =1; } else if (keysC[5][4] ==1) { keysC[5][4] =0; } if (keysC[5][5] ==0) { keysC[5][5] =1; } else if (keysC[5][5] ==1) { keysC[5][5] =0; } //Column 7 if (keysC[6][0] ==0) { keysC[6][0] =1; } else if (keysC[6][0] ==1) { keysC[6][0] =0; } */ //Write Keyboard A //A36 if ((keysA[0][0] ==0) and (lastA[0][0] ==0)) { MidiSend(noteOn1, 36, velocity); lastA[0][0] =7; } if ((keysA[0][0] ==1) and (lastA[0][0] ==7)) { MidiSend(noteOff1, 36, velocity); lastA[0][0] =0; } //A37 if ((keysA[1][0] ==0) and (lastA[1][0] ==0)) { MidiSend(noteOn1, 37, velocity); lastA[1][0] =7; } if ((keysA[1][0] ==1) and (lastA[1][0] ==7)) { MidiSend(noteOff1, 37, velocity); lastA[1][0] =0; } //A38 if ((keysA[1][1] ==0) and (lastA[1][1] ==0)) { MidiSend(noteOn1, 38, velocity); lastA[1][1] =7; } //Write Midi Note Off if ((keysA[1][1] ==1) and (lastA[1][1] ==7)) { MidiSend(noteOff1, 38, velocity); lastA[1][1] =0; } //A39 if ((keysA[1][2] ==0) and (lastA[1][2] ==0)) { MidiSend(noteOn1, 39, velocity); lastA[1][2] =7; } //Write Midi Note Off if ((keysA[1][2] ==1) and (lastA[1][2] ==7)) { MidiSend(noteOff1, 39, velocity); lastA[1][2] =0; } //A40 if ((keysA[1][3] ==0) and (lastA[1][3] ==0)) { MidiSend(noteOn1, 40, velocity); lastA[1][3] =7; } //Write Midi Note Off if ((keysA[1][3] ==1) and (lastA[1][3] ==7)) { MidiSend(noteOff1, 40, velocity); lastA[1][3] =0; } //A41 if ((keysA[1][4] ==0) and (lastA[1][4] ==0)) { MidiSend(noteOn1, 41, velocity); lastA[1][4] =7; } //Write Midi Note Off if ((keysA[1][4] ==1) and (lastA[1][4] ==7)) { MidiSend(noteOff1, 41, velocity); lastA[1][4] =0; } //A42 if ((keysA[1][5] ==0) and (lastA[1][5] ==0)) { MidiSend(noteOn1, 42, velocity); lastA[1][5] =7; } //Write Midi Note Off if ((keysA[1][5] ==1) and (lastA[1][5] ==7)) { MidiSend(noteOff1, 42, velocity); lastA[1][5] =0; } //A43 if ((keysA[2][0] ==0) and (lastA[2][0] ==0)) { MidiSend(noteOn1, 43, velocity); lastA[2][0] =7; } //Write Midi Note Off if ((keysA[2][0] ==1) and (lastA[2][0] ==7)) { MidiSend(noteOff1, 43, velocity); lastA[2][0] =0; } //A44 if ((keysA[2][1] ==0) and (lastA[2][1] ==0)) { MidiSend(noteOn1, 44, velocity); lastA[2][1] =7; } //Write Midi Note Off if ((keysA[2][1] ==1) and (lastA[2][1] ==7)) { MidiSend(noteOff1, 44, velocity); lastA[2][1] =0; } //A45 if ((keysA[2][2] ==0) and (lastA[2][2] ==0)) { MidiSend(noteOn1, 45, velocity); lastA[2][2] =7; } //Write Midi Note Off if ((keysA[2][2] ==1) and (lastA[2][2] ==7)) { MidiSend(noteOff1, 45, velocity); lastA[2][2] =0; } //A46 if ((keysA[2][3] ==0) and (lastA[2][3] ==0)) { MidiSend(noteOn1, 46, velocity); lastA[2][3] =7; } //Write Midi Note Off if ((keysA[2][3] ==1) and (lastA[2][3] ==7)) { MidiSend(noteOff1, 46, velocity); lastA[2][3] =0; } //A47 if ((keysA[2][4] ==0) and (lastA[2][4] ==0)) { MidiSend(noteOn1, 47, velocity); lastA[2][4] =7; } //Write Midi Note Off if ((keysA[2][4] ==1) and (lastA[2][4] ==7)) { MidiSend(noteOff1, 47, velocity); lastA[2][4] =0; } //A48 if ((keysA[2][5] ==0) and (lastA[2][5] ==0)) { MidiSend(noteOn1, 48, velocity); lastA[2][5] =7; } //Write Midi Note Off if ((keysA[2][5] ==1) and (lastA[2][5] ==7)) { MidiSend(noteOff1, 48, velocity); lastA[2][5] =0; } //A49 if ((keysA[3][0] ==0) and (lastA[3][0] ==0)) { MidiSend(noteOn1, 49, velocity); lastA[3][0] =7; } //Write Midi Note Off if ((keysA[3][0] ==1) and (lastA[3][0] ==7)) { MidiSend(noteOff1, 49, velocity); lastA[3][0] =0; } //A50 if ((keysA[3][1] ==0) and (lastA[3][1] ==0)) { MidiSend(noteOn1, 50, velocity); lastA[3][1] =7; } //Write Midi Note Off if ((keysA[3][1] ==1) and (lastA[3][1] ==7)) { MidiSend(noteOff1, 50, velocity); lastA[3][1] =0; } //A51 if ((keysA[3][2] ==0) and (lastA[3][2] ==0)) { MidiSend(noteOn1, 51, velocity); lastA[3][2] =7; } //Write Midi Note Off if ((keysA[3][2] ==1) and (lastA[3][2] ==7)) { MidiSend(noteOff1, 51, velocity); lastA[3][2] =0; } //A52 if ((keysA[3][3] ==0) and (lastA[3][3] ==0)) { MidiSend(noteOn1, 52, velocity); lastA[3][3] =7; } //Write Midi Note Off if ((keysA[3][3] ==1) and (lastA[3][3] ==7)) { MidiSend(noteOff1, 52, velocity); lastA[3][3] =0; } //A53 if ((keysA[3][4] ==0) and (lastA[3][4] ==0)) { MidiSend(noteOn1, 53, velocity); lastA[3][4] =7; } //Write Midi Note Off if ((keysA[3][4] ==1) and (lastA[3][4] ==7)) { MidiSend(noteOff1, 53, velocity); lastA[3][4] =0; } //A54 if ((keysA[3][5] ==0) and (lastA[3][5] ==0)) { MidiSend(noteOn1, 54, velocity); lastA[3][5] =7; } //Write Midi Note Off if ((keysA[3][5] ==1) and (lastA[3][5] ==7)) { MidiSend(noteOff1, 54, velocity); lastA[3][5] =0; } //A55 if ((keysA[4][0] ==0) and (lastA[4][0] ==0)) { MidiSend(noteOn1, 55, velocity); lastA[4][0] =7; } //Write Midi Note Off if ((keysA[4][0] ==1) and (lastA[4][0] ==7)) { MidiSend(noteOff1, 55, velocity); lastA[4][0] =0; } //A56 if ((keysA[4][1] ==0) and (lastA[4][1] ==0)) { MidiSend(noteOn1, 56, velocity); lastA[4][1] =7; } //Write Midi Note Off if ((keysA[4][1] ==1) and (lastA[4][1] ==7)) { MidiSend(noteOff1, 56, velocity); lastA[4][1] =0; } //A57 if ((keysA[4][2] ==0) and (lastA[4][2] ==0)) { MidiSend(noteOn1, 57, velocity); lastA[4][2] =7; } //Write Midi Note Off if ((keysA[4][2] ==1) and (lastA[4][2] ==7)) { MidiSend(noteOff1, 57, velocity); lastA[4][2] =0; } //A58 if ((keysA[4][3] ==0) and (lastA[4][3] ==0)) { MidiSend(noteOn1, 58, velocity); lastA[4][3] =7; } //Write Midi Note Off if ((keysA[4][3] ==1) and (lastA[4][3] ==7)) { MidiSend(noteOff1, 58, velocity); lastA[4][3] =0; } //59 if ((keysA[4][4] ==0) and (lastA[4][4] ==0)) { MidiSend(noteOn1, 59, velocity); lastA[4][4] =7; } //Write Midi Note Off if ((keysA[4][4] ==1) and (lastA[4][4] ==7)) { MidiSend(noteOff1, 59, velocity); lastA[4][4] =0; } //A60 if ((keysA[4][5] ==0) and (lastA[4][5] ==0)) { MidiSend(noteOn1, 60, velocity); lastA[4][5] =7; } //Write Midi Note Off if ((keysA[4][5] ==1) and (lastA[4][5] ==7)) { MidiSend(noteOff1, 60, velocity); lastA[4][5] =0; } //A61 if ((keysA[5][0] ==0) and (lastA[5][0] ==0)) { MidiSend(noteOn1, 61, velocity); lastA[5][0] =7; } //Write Midi Note Off if ((keysA[5][0] ==1) and (lastA[5][0] ==7)) { MidiSend(noteOff1, 61, velocity); lastA[5][0] =0; } //A62 if ((keysA[5][1] ==0) and (lastA[5][1] ==0)) { MidiSend(noteOn1, 62, velocity); lastA[5][1] =7; } //Write Midi Note Off if ((keysA[5][1] ==1) and (lastA[5][1] ==7)) { MidiSend(noteOff1, 62, velocity); lastA[5][1] =0; } //A63 if ((keysA[5][2] ==0) and (lastA[5][2] ==0)) { MidiSend(noteOn1, 63, velocity); lastA[5][2] =7; } //Write Midi Note Off if ((keysA[5][2] ==1) and (lastA[5][2] ==7)) { MidiSend(noteOff1, 63, velocity); lastA[5][2] =0; } //A64 if ((keysA[5][3] ==0) and (lastA[5][3] ==0)) { MidiSend(noteOn1, 64, velocity); lastA[5][3] =7; } //Write Midi Note Off if ((keysA[5][3] ==1) and (lastA[5][3] ==7)) { MidiSend(noteOff1, 64, velocity); lastA[5][3] =0; } //A65 if ((keysA[5][4] ==0) and (lastA[5][4] ==0)) { MidiSend(noteOn1, 65, velocity); lastA[5][4] =7; } //Write Midi Note Off if ((keysA[5][4] ==1) and (lastA[5][4] ==7)) { MidiSend(noteOff1, 65, velocity); lastA[5][4] =0; } //A66 if ((keysA[5][5] ==0) and (lastA[5][5] ==0)) { MidiSend(noteOn1, 66, velocity); lastA[5][5] =7; } //Write Midi Note Off if ((keysA[5][5] ==1) and (lastA[5][5] ==7)) { MidiSend(noteOff1, 66, velocity); lastA[5][5] =0; } //A67 if ((keysA[6][0] ==0) and (lastA[6][0] ==0)) { MidiSend(noteOn1, 67, velocity); lastA[6][0] =7; } //Write Midi Note Off if ((keysA[6][0] ==1) and (lastA[6][0] ==7)) { MidiSend(noteOff1, 67, velocity); lastA[6][0] =0; } //A68 if ((keysA[6][1] ==0) and (lastA[6][1] ==0)) { MidiSend(noteOn1, 68, velocity); lastA[6][1] =7; } //Write Midi Note Off if ((keysA[6][1] ==1) and (lastA[6][1] ==7)) { MidiSend(noteOff1, 68, velocity); lastA[6][1] =0; } //A69 if ((keysA[6][2] ==0) and (lastA[6][2] ==0)) { MidiSend(noteOn1, 69, velocity); lastA[6][2] =7; } //Write Midi Note Off if ((keysA[6][2] ==1) and (lastA[6][2] ==7)) { MidiSend(noteOff1, 69, velocity); lastA[6][2] =0; } //A70 if ((keysA[6][3] ==0) and (lastA[6][3] ==0)) { MidiSend(noteOn1, 70, velocity); lastA[6][3] =7; } //Write Midi Note Off if ((keysA[6][3] ==1) and (lastA[6][3] ==7)) { MidiSend(noteOff1, 70, velocity); lastA[6][3] =0; } //A71 if ((keysA[6][4] ==0) and (lastA[6][4] ==0)) { MidiSend(noteOn1, 71, velocity); lastA[6][4] =7; } //Write Midi Note Off if ((keysA[6][4] ==1) and (lastA[6][4] ==7)) { MidiSend(noteOff1, 71, velocity); lastA[6][4] =0; } //A72 if ((keysA[6][5] ==0) and (lastA[6][5] ==0)) { MidiSend(noteOn1, 72, velocity); lastA[6][5] =7; } //Write Midi Note Off if ((keysA[6][5] ==1) and (lastA[6][5] ==7)) { MidiSend(noteOff1, 72, velocity); lastA[6][5] =0; } //A73 if ((keysA[7][0] ==0) and (lastA[7][0] ==0)) { MidiSend(noteOn1, 73, velocity); lastA[7][0] =7; } //Write Midi Note Off if ((keysA[7][0] ==1) and (lastA[7][0] ==7)) { MidiSend(noteOff1, 73, velocity); lastA[7][0] =0; } //A74 if ((keysA[7][1] ==0) and (lastA[7][1] ==0)) { MidiSend(noteOn1, 74, velocity); lastA[7][1] =7; } //Write Midi Note Off if ((keysA[7][1] ==1) and (lastA[7][1] ==7)) { MidiSend(noteOff1, 74, velocity); lastA[7][1] =0; } //A75 if ((keysA[7][2] ==0) and (lastA[7][2] ==0)) { MidiSend(noteOn1, 75, velocity); lastA[7][2] =7; } //Write Midi Note Off if ((keysA[7][2] ==1) and (lastA[7][2] ==7)) { MidiSend(noteOff1, 75, velocity); lastA[7][2] =0; } //A76 if ((keysA[7][3] ==0) and (lastA[7][3] ==0)) { MidiSend(noteOn1, 76, velocity); lastA[7][3] =7; } //Write Midi Note Off if ((keysA[7][3] ==1) and (lastA[7][3] ==7)) { MidiSend(noteOff1, 76, velocity); lastA[7][3] =0; } //A77 if ((keysA[7][4] ==0) and (lastA[7][4] ==0)) { MidiSend(noteOn1, 77, velocity); lastA[7][4] =7; } //Write Midi Note Off if ((keysA[7][4] ==1) and (lastA[7][4] ==7)) { MidiSend(noteOff1, 77, velocity); lastA[7][4] =0; } //A78 if ((keysA[7][5] ==0) and (lastA[7][5] ==0)) { MidiSend(noteOn1, 78, velocity); lastA[7][5] =7; } //Write Midi Note Off if ((keysA[7][5] ==1) and (lastA[7][5] ==7)) { MidiSend(noteOff1, 78, velocity); lastA[7][5] =0; } //A79 if ((keysA[8][0] ==0) and (lastA[8][0] ==0)) { MidiSend(noteOn1, 79, velocity); lastA[8][0] =7; } //Write Midi Note Off if ((keysA[8][0] ==1) and (lastA[8][0] ==7)) { MidiSend(noteOff1, 79, velocity); lastA[8][0] =0; } //A80 if ((keysA[8][1] ==0) and (lastA[8][1] ==0)) { MidiSend(noteOn1, 80, velocity); lastA[8][1] =7; } //Write Midi Note Off if ((keysA[8][1] ==1) and (lastA[8][1] ==7)) { MidiSend(noteOff1, 80, velocity); lastA[8][1] =0; } //A81 if ((keysA[8][2] ==0) and (lastA[8][2] ==0)) { MidiSend(noteOn1, 81, velocity); lastA[8][2] =7; } //Write Midi Note Off if ((keysA[8][2] ==1) and (lastA[8][2] ==7)) { MidiSend(noteOff1, 81, velocity); lastA[8][2] =0; } //A82 if ((keysA[8][3] ==0) and (lastA[8][3] ==0)) { MidiSend(noteOn1, 82, velocity); lastA[8][3] =7; } //Write Midi Note Off if ((keysA[8][3] ==1) and (lastA[8][3] ==7)) { MidiSend(noteOff1, 82, velocity); lastA[8][3] =0; } //A83 if ((keysA[8][4] ==0) and (lastA[8][4] ==0)) { MidiSend(noteOn1, 83, velocity); lastA[8][4] =7; } //Write Midi Note Off if ((keysA[8][4] ==1) and (lastA[8][4] ==7)) { MidiSend(noteOff1, 83, velocity); lastA[8][4] =0; } //A84 if ((keysA[8][5] ==0) and (lastA[8][5] ==0)) { MidiSend(noteOn1, 84, velocity); lastA[8][5] =7; } //Write Midi Note Off if ((keysA[8][5] ==1) and (lastA[8][5] ==7)) { MidiSend(noteOff1, 84, velocity); lastA[8][5] =0; } //A85 if ((keysA[9][0] ==0) and (lastA[9][0] ==0)) { MidiSend(noteOn1, 85, velocity); lastA[9][0] =7; } //Write Midi Note Off if ((keysA[9][0] ==1) and (lastA[9][0] ==7)) { MidiSend(noteOff1, 85, velocity); lastA[9][0] =0; } //A86 if ((keysA[9][1] ==0) and (lastA[9][1] ==0)) { MidiSend(noteOn1, 86, velocity); lastA[9][1] =7; } //Write Midi Note Off if ((keysA[9][1] ==1) and (lastA[9][1] ==7)) { MidiSend(noteOff1, 86, velocity); lastA[9][1] =0; } //A87 if ((keysA[9][2] ==0) and (lastA[9][2] ==0)) { MidiSend(noteOn1, 87, velocity); lastA[9][2] =7; } //Write Midi Note Off if ((keysA[9][2] ==1) and (lastA[9][2] ==7)) { MidiSend(noteOff1, 87, velocity); lastA[9][2] =0; } //A88 if ((keysA[9][3] ==0) and (lastA[9][3] ==0)) { MidiSend(noteOn1, 88, velocity); lastA[9][3] =7; } //Write Midi Note Off if ((keysA[9][3] ==1) and (lastA[9][3] ==7)) { MidiSend(noteOff1, 88, velocity); lastA[9][3] =0; } //A89 if ((keysA[9][4] ==0) and (lastA[9][4] ==0)) { MidiSend(noteOn1, 89, velocity); lastA[9][4] =7; } //Write Midi Note Off if ((keysA[9][4] ==1) and (lastA[9][4] ==7)) { MidiSend(noteOff1, 89, velocity); lastA[9][4] =0; } //A90 if ((keysA[9][5] ==0) and (lastA[9][5] ==0)) { MidiSend(noteOn1, 90, velocity); lastA[9][5] =7; } //Write Midi Note Off if ((keysA[9][5] ==1) and (lastA[9][5] ==7)) { MidiSend(noteOff1, 90, velocity); lastA[9][5] =0; } //A91 if ((keysA[10][0] ==0) and (lastA[10][0] ==0)) { MidiSend(noteOn1, 91, velocity); lastA[10][0] =7; } //Write Midi Note Off if ((keysA[10][0] ==1) and (lastA[10][0] ==7)) { MidiSend(noteOff1, 91, velocity); lastA[10][0] =0; } //A92 if ((keysA[10][1] ==0) and (lastA[10][1] ==0)) { MidiSend(noteOn1, 92, velocity); lastA[10][1] =7; } //Write Midi Note Off if ((keysA[10][1] ==1) and (lastA[10][1] ==7)) { MidiSend(noteOff1, 92, velocity); lastA[10][1] =0; } //A93 if ((keysA[10][2] ==0) and (lastA[10][2] ==0)) { MidiSend(noteOn1, 93, velocity); lastA[10][2] =7; } //Write Midi Note Off if ((keysA[10][2] ==1) and (lastA[10][2] ==7)) { MidiSend(noteOff1, 93, velocity); lastA[10][2] =0; } //A94 if ((keysA[10][3] ==0) and (lastA[10][3] ==0)) { MidiSend(noteOn1, 94, velocity); lastA[10][3] =7; } //Write Midi Note Off if ((keysA[10][3] ==1) and (lastA[10][3] ==7)) { MidiSend(noteOff1, 94, velocity); lastA[10][3] =0; } //A95 if ((keysA[10][4] ==0) and (lastA[10][4] ==0)) { MidiSend(noteOn1, 95, velocity); lastA[10][4] =7; } //Write Midi Note Off if ((keysA[10][4] ==1) and (lastA[10][4] ==7)) { MidiSend(noteOff1, 95, velocity); lastA[10][4] =0; } //A96 if ((keysA[10][5] ==0) and (lastA[10][5] ==0)) { MidiSend(noteOn1, 96, velocity); lastA[10][5] =7; } //Write Midi Note Off if ((keysA[10][5] ==1) and (lastA[10][5] ==7)) { MidiSend(noteOff1, 96, velocity); lastA[10][5] =0; } //Write Keyboard B //B36 if ((keysB[0][0] ==0) and (lastB[0][0] ==0)) { MidiSend(noteOn2, 36, velocity); lastB[0][0] =7; } if ((keysB[0][0] ==1) and (lastB[0][0] ==7)) { MidiSend(noteOff2, 36, velocity); lastB[0][0] =0; } //B37 if ((keysB[1][0] ==0) and (lastB[1][0] ==0)) { MidiSend(noteOn2, 37, velocity); lastB[1][0] =7; } if ((keysB[1][0] ==1) and (lastB[1][0] ==7)) { MidiSend(noteOff2, 37, velocity); lastB[1][0] =0; } //B38 if ((keysB[1][1] ==0) and (lastB[1][1] ==0)) { MidiSend(noteOn2, 38, velocity); lastB[1][1] =7; } //Write Midi Note Off if ((keysB[1][1] ==1) and (lastB[1][1] ==7)) { MidiSend(noteOff2, 38, velocity); lastB[1][1] =0; } //B39 if ((keysB[1][2] ==0) and (lastB[1][2] ==0)) { MidiSend(noteOn2, 39, velocity); lastB[1][2] =7; } //Write Midi Note Off if ((keysB[1][2] ==1) and (lastB[1][2] ==7)) { MidiSend(noteOff2, 39, velocity); lastB[1][2] =0; } //B40 if ((keysB[1][3] ==0) and (lastB[1][3] ==0)) { MidiSend(noteOn2, 40, velocity); lastB[1][3] =7; } //Write Midi Note Off if ((keysB[1][3] ==1) and (lastB[1][3] ==7)) { MidiSend(noteOff2, 40, velocity); lastB[1][3] =0; } //B41 if ((keysB[1][4] ==0) and (lastB[1][4] ==0)) { MidiSend(noteOn2, 41, velocity); lastB[1][4] =7; } //Write Midi Note Off if ((keysB[1][4] ==1) and (lastB[1][4] ==7)) { MidiSend(noteOff2, 41, velocity); lastB[1][4] =0; } //B42 if ((keysB[1][5] ==0) and (lastB[1][5] ==0)) { MidiSend(noteOn2, 42, velocity); lastB[1][5] =7; } //Write Midi Note Off if ((keysB[1][5] ==1) and (lastB[1][5] ==7)) { MidiSend(noteOff2, 42, velocity); lastB[1][5] =0; } //B43 if ((keysB[2][0] ==0) and (lastB[2][0] ==0)) { MidiSend(noteOn2, 43, velocity); lastB[2][0] =7; } //Write Midi Note Off if ((keysB[2][0] ==1) and (lastB[2][0] ==7)) { MidiSend(noteOff2, 43, velocity); lastB[2][0] =0; } //B44 if ((keysB[2][1] ==0) and (lastB[2][1] ==0)) { MidiSend(noteOn2, 44, velocity); lastB[2][1] =7; } //Write Midi Note Off if ((keysB[2][1] ==1) and (lastB[2][1] ==7)) { MidiSend(noteOff2, 44, velocity); lastB[2][1] =0; } //B45 if ((keysB[2][2] ==0) and (lastB[2][2] ==0)) { MidiSend(noteOn2, 45, velocity); lastB[2][2] =7; } //Write Midi Note Off if ((keysB[2][2] ==1) and (lastB[2][2] ==7)) { MidiSend(noteOff2, 45, velocity); lastB[2][2] =0; } //B46 if ((keysB[2][3] ==0) and (lastB[2][3] ==0)) { MidiSend(noteOn2, 46, velocity); lastB[2][3] =7; } //Write Midi Note Off if ((keysB[2][3] ==1) and (lastB[2][3] ==7)) { MidiSend(noteOff2, 46, velocity); lastB[2][3] =0; } //B47 if ((keysB[2][4] ==0) and (lastB[2][4] ==0)) { MidiSend(noteOn2, 47, velocity); lastB[2][4] =7; } //Write Midi Note Off if ((keysB[2][4] ==1) and (lastB[2][4] ==7)) { MidiSend(noteOff2, 47, velocity); lastB[2][4] =0; } //B48 if ((keysB[2][5] ==0) and (lastB[2][5] ==0)) { MidiSend(noteOn2, 48, velocity); lastB[2][5] =7; } //Write Midi Note Off if ((keysB[2][5] ==1) and (lastB[2][5] ==7)) { MidiSend(noteOff2, 48, velocity); lastB[2][5] =0; } //B49 if ((keysB[3][0] ==0) and (lastB[3][0] ==0)) { MidiSend(noteOn2, 49, velocity); lastB[3][0] =7; } //Write Midi Note Off if ((keysB[3][0] ==1) and (lastB[3][0] ==7)) { MidiSend(noteOff2, 49, velocity); lastB[3][0] =0; } //B50 if ((keysB[3][1] ==0) and (lastB[3][1] ==0)) { MidiSend(noteOn2, 50, velocity); lastB[3][1] =7; } //Write Midi Note Off if ((keysB[3][1] ==1) and (lastB[3][1] ==7)) { MidiSend(noteOff2, 50, velocity); lastB[3][1] =0; } //B51 if ((keysB[3][2] ==0) and (lastB[3][2] ==0)) { MidiSend(noteOn2, 51, velocity); lastB[3][2] =7; } //Write Midi Note Off if ((keysB[3][2] ==1) and (lastB[3][2] ==7)) { MidiSend(noteOff2, 51, velocity); lastB[3][2] =0; } //B52 if ((keysB[3][3] ==0) and (lastB[3][3] ==0)) { MidiSend(noteOn2, 52, velocity); lastB[3][3] =7; } //Write Midi Note Off if ((keysB[3][3] ==1) and (lastB[3][3] ==7)) { MidiSend(noteOff2, 52, velocity); lastB[3][3] =0; } //B53 if ((keysB[3][4] ==0) and (lastB[3][4] ==0)) { MidiSend(noteOn2, 53, velocity); lastB[3][4] =7; } //Write Midi Note Off if ((keysB[3][4] ==1) and (lastB[3][4] ==7)) { MidiSend(noteOff2, 53, velocity); lastB[3][4] =0; } //B54 if ((keysB[3][5] ==0) and (lastB[3][5] ==0)) { MidiSend(noteOn2, 54, velocity); lastB[3][5] =7; } //Write Midi Note Off if ((keysB[3][5] ==1) and (lastB[3][5] ==7)) { MidiSend(noteOff2, 54, velocity); lastB[3][5] =0; } //B55 if ((keysB[4][0] ==0) and (lastB[4][0] ==0)) { MidiSend(noteOn2, 55, velocity); lastB[4][0] =7; } //Write Midi Note Off if ((keysB[4][0] ==1) and (lastB[4][0] ==7)) { MidiSend(noteOff2, 55, velocity); lastB[4][0] =0; } //B56 if ((keysB[4][1] ==0) and (lastB[4][1] ==0)) { MidiSend(noteOn2, 56, velocity); lastB[4][1] =7; } //Write Midi Note Off if ((keysB[4][1] ==1) and (lastB[4][1] ==7)) { MidiSend(noteOff2, 56, velocity); lastB[4][1] =0; } //B57 if ((keysB[4][2] ==0) and (lastB[4][2] ==0)) { MidiSend(noteOn2, 57, velocity); lastB[4][2] =7; } //Write Midi Note Off if ((keysB[4][2] ==1) and (lastB[4][2] ==7)) { MidiSend(noteOff2, 57, velocity); lastB[4][2] =0; } //B58 if ((keysB[4][3] ==0) and (lastB[4][3] ==0)) { MidiSend(noteOn2, 58, velocity); lastB[4][3] =7; } //Write Midi Note Off if ((keysB[4][3] ==1) and (lastB[4][3] ==7)) { MidiSend(noteOff2, 58, velocity); lastB[4][3] =0; } //B59 if ((keysB[4][4] ==0) and (lastB[4][4] ==0)) { MidiSend(noteOn2, 59, velocity); lastB[4][4] =7; } //Write Midi Note Off if ((keysB[4][4] ==1) and (lastB[4][4] ==7)) { MidiSend(noteOff2, 59, velocity); lastB[4][4] =0; } //B60 if ((keysB[4][5] ==0) and (lastB[4][5] ==0)) { MidiSend(noteOn2, 60, velocity); lastB[4][5] =7; } //Write Midi Note Off if ((keysB[4][5] ==1) and (lastB[4][5] ==7)) { MidiSend(noteOff2, 60, velocity); lastB[4][5] =0; } //B61 if ((keysB[5][0] ==0) and (lastB[5][0] ==0)) { MidiSend(noteOn2, 61, velocity); lastB[5][0] =7; } //Write Midi Note Off if ((keysB[5][0] ==1) and (lastB[5][0] ==7)) { MidiSend(noteOff2, 61, velocity); lastB[5][0] =0; } //B62 if ((keysB[5][1] ==0) and (lastB[5][1] ==0)) { MidiSend(noteOn2, 62, velocity); lastB[5][1] =7; } //Write Midi Note Off if ((keysB[5][1] ==1) and (lastB[5][1] ==7)) { MidiSend(noteOff2, 62, velocity); lastB[5][1] =0; } //B63 if ((keysB[5][2] ==0) and (lastB[5][2] ==0)) { MidiSend(noteOn2, 63, velocity); lastB[5][2] =7; } //Write Midi Note Off if ((keysB[5][2] ==1) and (lastB[5][2] ==7)) { MidiSend(noteOff2, 63, velocity); lastB[5][2] =0; } //B64 if ((keysB[5][3] ==0) and (lastB[5][3] ==0)) { MidiSend(noteOn2, 64, velocity); lastB[5][3] =7; } //Write Midi Note Off if ((keysB[5][3] ==1) and (lastB[5][3] ==7)) { MidiSend(noteOff2, 64, velocity); lastB[5][3] =0; } //B65 if ((keysB[5][4] ==0) and (lastB[5][4] ==0)) { MidiSend(noteOn2, 65, velocity); lastB[5][4] =7; } //Write Midi Note Off if ((keysB[5][4] ==1) and (lastB[5][4] ==7)) { MidiSend(noteOff2, 65, velocity); lastB[5][4] =0; } //B66 if ((keysB[5][5] ==0) and (lastB[5][5] ==0)) { MidiSend(noteOn2, 66, velocity); lastB[5][5] =7; } //Write Midi Note Off if ((keysB[5][5] ==1) and (lastB[5][5] ==7)) { MidiSend(noteOff2, 66, velocity); lastB[5][5] =0; } //B67 if ((keysB[6][0] ==0) and (lastB[6][0] ==0)) { MidiSend(noteOn2, 67, velocity); lastB[6][0] =7; } //Write Midi Note Off if ((keysB[6][0] ==1) and (lastB[6][0] ==7)) { MidiSend(noteOff2, 67, velocity); lastB[6][0] =0; } //B68 if ((keysB[6][1] ==0) and (lastB[6][1] ==0)) { MidiSend(noteOn2, 68, velocity); lastB[6][1] =7; } //Write Midi Note Off if ((keysB[6][1] ==1) and (lastB[6][1] ==7)) { MidiSend(noteOff2, 68, velocity); lastB[6][1] =0; } //B69 if ((keysB[6][2] ==0) and (lastB[6][2] ==0)) { MidiSend(noteOn2, 69, velocity); lastB[6][2] =7; } //Write Midi Note Off if ((keysB[6][2] ==1) and (lastB[6][2] ==7)) { MidiSend(noteOff2, 69, velocity); lastB[6][2] =0; } //B70 if ((keysB[6][3] ==0) and (lastB[6][3] ==0)) { MidiSend(noteOn2, 70, velocity); lastB[6][3] =7; } //Write Midi Note Off if ((keysB[6][3] ==1) and (lastB[6][3] ==7)) { MidiSend(noteOff2, 70, velocity); lastB[6][3] =0; } //B71 if ((keysB[6][4] ==0) and (lastB[6][4] ==0)) { MidiSend(noteOn2, 71, velocity); lastB[6][4] =7; } //Write Midi Note Off if ((keysB[6][4] ==1) and (lastB[6][4] ==7)) { MidiSend(noteOff2, 71, velocity); lastB[6][4] =0; } //B72 if ((keysB[6][5] ==0) and (lastB[6][5] ==0)) { MidiSend(noteOn2, 72, velocity); lastB[6][5] =7; } //Write Midi Note Off if ((keysB[6][5] ==1) and (lastB[6][5] ==7)) { MidiSend(noteOff2, 72, velocity); lastB[6][5] =0; } //B73 if ((keysB[7][0] ==0) and (lastB[7][0] ==0)) { MidiSend(noteOn2, 73, velocity); lastB[7][0] =7; } //Write Midi Note Off if ((keysB[7][0] ==1) and (lastB[7][0] ==7)) { MidiSend(noteOff2, 73, velocity); lastB[7][0] =0; } //B74 if ((keysB[7][1] ==0) and (lastB[7][1] ==0)) { MidiSend(noteOn2, 74, velocity); lastB[7][1] =7; } //Write Midi Note Off if ((keysB[7][1] ==1) and (lastB[7][1] ==7)) { MidiSend(noteOff2, 74, velocity); lastB[7][1] =0; } //B75 if ((keysB[7][2] ==0) and (lastB[7][2] ==0)) { MidiSend(noteOn2, 75, velocity); lastB[7][2] =7; } //Write Midi Note Off if ((keysB[7][2] ==1) and (lastB[7][2] ==7)) { MidiSend(noteOff2, 75, velocity); lastB[7][2] =0; } //B76 if ((keysB[7][3] ==0) and (lastB[7][3] ==0)) { MidiSend(noteOn2, 76, velocity); lastB[7][3] =7; } //Write Midi Note Off if ((keysB[7][3] ==1) and (lastB[7][3] ==7)) { MidiSend(noteOff2, 76, velocity); lastB[7][3] =0; } //B77 if ((keysB[7][4] ==0) and (lastB[7][4] ==0)) { MidiSend(noteOn2, 77, velocity); lastB[7][4] =7; } //Write Midi Note Off if ((keysB[7][4] ==1) and (lastB[7][4] ==7)) { MidiSend(noteOff2, 77, velocity); lastB[7][4] =0; } //B78 if ((keysB[7][5] ==0) and (lastB[7][5] ==0)) { MidiSend(noteOn2, 78, velocity); lastB[7][5] =7; } //Write Midi Note Off if ((keysB[7][5] ==1) and (lastB[7][5] ==7)) { MidiSend(noteOff2, 78, velocity); lastB[7][5] =0; } //B79 if ((keysB[8][0] ==0) and (lastB[8][0] ==0)) { MidiSend(noteOn2, 79, velocity); lastB[8][0] =7; } //Write Midi Note Off if ((keysB[8][0] ==1) and (lastB[8][0] ==7)) { MidiSend(noteOff2, 79, velocity); lastB[8][0] =0; } //B80 if ((keysB[8][1] ==0) and (lastB[8][1] ==0)) { MidiSend(noteOn2, 80, velocity); lastB[8][1] =7; } //Write Midi Note Off if ((keysB[8][1] ==1) and (lastB[8][1] ==7)) { MidiSend(noteOff2, 80, velocity); lastB[8][1] =0; } //B81 if ((keysB[8][2] ==0) and (lastB[8][2] ==0)) { MidiSend(noteOn2, 81, velocity); lastB[8][2] =7; } //Write Midi Note Off if ((keysB[8][2] ==1) and (lastB[8][2] ==7)) { MidiSend(noteOff2, 81, velocity); lastB[8][2] =0; } //B82 if ((keysB[8][3] ==0) and (lastB[8][3] ==0)) { MidiSend(noteOn2, 82, velocity); lastB[8][3] =7; } //Write Midi Note Off if ((keysB[8][3] ==1) and (lastB[8][3] ==7)) { MidiSend(noteOff2, 82, velocity); lastB[8][3] =0; } //B83 if ((keysB[8][4] ==0) and (lastB[8][4] ==0)) { MidiSend(noteOn2, 83, velocity); lastB[8][4] =7; } //Write Midi Note Off if ((keysB[8][4] ==1) and (lastB[8][4] ==7)) { MidiSend(noteOff2, 83, velocity); lastB[8][4] =0; } //B84 if ((keysB[8][5] ==0) and (lastB[8][5] ==0)) { MidiSend(noteOn2, 84, velocity); lastB[8][5] =7; } //Write Midi Note Off if ((keysB[8][5] ==1) and (lastB[8][5] ==7)) { MidiSend(noteOff2, 84, velocity); lastB[8][5] =0; } //B85 if ((keysB[9][0] ==0) and (lastB[9][0] ==0)) { MidiSend(noteOn2, 85, velocity); lastB[9][0] =7; } //Write Midi Note Off if ((keysB[9][0] ==1) and (lastB[9][0] ==7)) { MidiSend(noteOff2, 85, velocity); lastB[9][0] =0; } //B86 if ((keysB[9][1] ==0) and (lastB[9][1] ==0)) { MidiSend(noteOn2, 86, velocity); lastB[9][1] =7; } //Write Midi Note Off if ((keysB[9][1] ==1) and (lastB[9][1] ==7)) { MidiSend(noteOff2, 86, velocity); lastB[9][1] =0; } //B87 if ((keysB[9][2] ==0) and (lastB[9][2] ==0)) { MidiSend(noteOn2, 87, velocity); lastB[9][2] =7; } //Write Midi Note Off if ((keysB[9][2] ==1) and (lastB[9][2] ==7)) { MidiSend(noteOff2, 87, velocity); lastB[9][2] =0; } //B88 if ((keysB[9][3] ==0) and (lastB[9][3] ==0)) { MidiSend(noteOn2, 88, velocity); lastB[9][3] =7; } //Write Midi Note Off if ((keysB[9][3] ==1) and (lastB[9][3] ==7)) { MidiSend(noteOff2, 88, velocity); lastB[9][3] =0; } //B89 if ((keysB[9][4] ==0) and (lastB[9][4] ==0)) { MidiSend(noteOn2, 89, velocity); lastB[9][4] =7; } //Write Midi Note Off if ((keysB[9][4] ==1) and (lastB[9][4] ==7)) { MidiSend(noteOff2, 89, velocity); lastB[9][4] =0; } //B90 if ((keysB[9][5] ==0) and (lastB[9][5] ==0)) { MidiSend(noteOn2, 90, velocity); lastB[9][5] =7; } //Write Midi Note Off if ((keysB[9][5] ==1) and (lastB[9][5] ==7)) { MidiSend(noteOff2, 90, velocity); lastB[9][5] =0; } //B91 if ((keysB[10][0] ==0) and (lastB[10][0] ==0)) { MidiSend(noteOn2, 91, velocity); lastB[10][0] =7; } //Write Midi Note Off if ((keysB[10][0] ==1) and (lastB[10][0] ==7)) { MidiSend(noteOff2, 91, velocity); lastB[10][0] =0; } //B92 if ((keysB[10][1] ==0) and (lastB[10][1] ==0)) { MidiSend(noteOn2, 92, velocity); lastB[10][1] =7; } //Write Midi Note Off if ((keysB[10][1] ==1) and (lastB[10][1] ==7)) { MidiSend(noteOff2, 92, velocity); lastB[10][1] =0; } //B93 if ((keysB[10][2] ==0) and (lastB[10][2] ==0)) { MidiSend(noteOn2, 93, velocity); lastB[10][2] =7; } //Write Midi Note Off if ((keysB[10][2] ==1) and (lastB[10][2] ==7)) { MidiSend(noteOff2, 93, velocity); lastB[10][2] =0; } //B94 if ((keysB[10][3] ==0) and (lastB[10][3] ==0)) { MidiSend(noteOn2, 94, velocity); lastB[10][3] =7; } //Write Midi Note Off if ((keysB[10][3] ==1) and (lastB[10][3] ==7)) { MidiSend(noteOff2, 94, velocity); lastB[10][3] =0; } //B95 if ((keysB[10][4] ==0) and (lastB[10][4] ==0)) { MidiSend(noteOn2, 95, velocity); lastB[10][4] =7; } //Write Midi Note Off if ((keysB[10][4] ==1) and (lastB[10][4] ==7)) { MidiSend(noteOff2, 95, velocity); lastB[10][4] =0; } //B96 if ((keysB[10][5] ==0) and (lastB[10][5] ==0)) { MidiSend(noteOn2, 96, velocity); lastB[10][5] =7; } //Write Midi Note Off if ((keysB[10][5] ==1) and (lastB[10][5] ==7)) { MidiSend(noteOff2, 96, velocity); lastB[10][5] =0; } //Write Keyboard C //C36 if ((keysC[0][0] ==0) and (lastC[0][0] ==0)) { MidiSend(noteOn3, 36, velocity); lastC[0][0] =7; } if ((keysC[0][0] ==1) and (lastC[0][0] ==7)) { MidiSend(noteOff3, 36, velocity); lastC[0][0] =0; } //C37 if ((keysC[1][0] ==0) and (lastC[1][0] ==0)) { MidiSend(noteOn3, 37, velocity); lastC[1][0] =7; } if ((keysC[1][0] ==1) and (lastC[1][0] ==7)) { MidiSend(noteOff3, 37, velocity); lastC[1][0] =0; } //C38 if ((keysC[1][1] ==0) and (lastC[1][1] ==0)) { MidiSend(noteOn3, 38, velocity); lastC[1][1] =7; } //Write Midi Note Off if ((keysC[1][1] ==1) and (lastC[1][1] ==7)) { MidiSend(noteOff3, 38, velocity); lastC[1][1] =0; } //C39 if ((keysC[1][2] ==0) and (lastC[1][2] ==0)) { MidiSend(noteOn3, 39, velocity); lastC[1][2] =7; } //Write Midi Note Off if ((keysC[1][2] ==1) and (lastC[1][2] ==7)) { MidiSend(noteOff3, 39, velocity); lastC[1][2] =0; } //C40 if ((keysC[1][3] ==0) and (lastC[1][3] ==0)) { MidiSend(noteOn3, 40, velocity); lastC[1][3] =7; } //Write Midi Note Off if ((keysC[1][3] ==1) and (lastC[1][3] ==7)) { MidiSend(noteOff3, 40, velocity); lastC[1][3] =0; } //C41 if ((keysC[1][4] ==0) and (lastC[1][4] ==0)) { MidiSend(noteOn3, 41, velocity); lastC[1][4] =7; } //Write Midi Note Off if ((keysC[1][4] ==1) and (lastC[1][4] ==7)) { MidiSend(noteOff3, 41, velocity); lastC[1][4] =0; } //C42 if ((keysC[1][5] ==0) and (lastC[1][5] ==0)) { MidiSend(noteOn3, 42, velocity); lastC[1][5] =7; } //Write Midi Note Off if ((keysC[1][5] ==1) and (lastC[1][5] ==7)) { MidiSend(noteOff3, 42, velocity); lastC[1][5] =0; } //C43 if ((keysC[2][0] ==0) and (lastC[2][0] ==0)) { MidiSend(noteOn3, 43, velocity); lastC[2][0] =7; } //Write Midi Note Off if ((keysC[2][0] ==1) and (lastC[2][0] ==7)) { MidiSend(noteOff3, 43, velocity); lastC[2][0] =0; } //C44 if ((keysC[2][1] ==0) and (lastC[2][1] ==0)) { MidiSend(noteOn3, 44, velocity); lastC[2][1] =7; } //Write Midi Note Off if ((keysC[2][1] ==1) and (lastC[2][1] ==7)) { MidiSend(noteOff3, 44, velocity); lastC[2][1] =0; } //B45 if ((keysC[2][2] ==0) and (lastC[2][2] ==0)) { MidiSend(noteOn3, 45, velocity); lastC[2][2] =7; } //Write Midi Note Off if ((keysC[2][2] ==1) and (lastC[2][2] ==7)) { MidiSend(noteOff3, 45, velocity); lastC[2][2] =0; } //C46 if ((keysC[2][3] ==0) and (lastC[2][3] ==0)) { MidiSend(noteOn3, 46, velocity); lastC[2][3] =7; } //Write Midi Note Off if ((keysC[2][3] ==1) and (lastC[2][3] ==7)) { MidiSend(noteOff3, 46, velocity); lastC[2][3] =0; } //C47 if ((keysC[2][4] ==0) and (lastC[2][4] ==0)) { MidiSend(noteOn3, 47, velocity); lastC[2][4] =7; } //Write Midi Note Off if ((keysC[2][4] ==1) and (lastC[2][4] ==7)) { MidiSend(noteOff3, 47, velocity); lastC[2][4] =0; } //C48 if ((keysC[2][5] ==0) and (lastC[2][5] ==0)) { MidiSend(noteOn3, 48, velocity); lastC[2][5] =7; } //Write Midi Note Off if ((keysC[2][5] ==1) and (lastC[2][5] ==7)) { MidiSend(noteOff3, 48, velocity); lastC[2][5] =0; } //C49 if ((keysC[3][0] ==0) and (lastC[3][0] ==0)) { MidiSend(noteOn3, 49, velocity); lastC[3][0] =7; } //Write Midi Note Off if ((keysC[3][0] ==1) and (lastC[3][0] ==7)) { MidiSend(noteOff3, 49, velocity); lastC[3][0] =0; } //C50 if ((keysC[3][1] ==0) and (lastC[3][1] ==0)) { MidiSend(noteOn3, 50, velocity); lastC[3][1] =7; } //Write Midi Note Off if ((keysC[3][1] ==1) and (lastC[3][1] ==7)) { MidiSend(noteOff3, 50, velocity); lastC[3][1] =0; } //C51 if ((keysC[3][2] ==0) and (lastC[3][2] ==0)) { MidiSend(noteOn3, 51, velocity); lastC[3][2] =7; } //Write Midi Note Off if ((keysC[3][2] ==1) and (lastC[3][2] ==7)) { MidiSend(noteOff3, 51, velocity); lastC[3][2] =0; } //C52 if ((keysC[3][3] ==0) and (lastC[3][3] ==0)) { MidiSend(noteOn3, 52, velocity); lastC[3][3] =7; } //Write Midi Note Off if ((keysC[3][3] ==1) and (lastC[3][3] ==7)) { MidiSend(noteOff3, 52, velocity); lastC[3][3] =0; } //C53 if ((keysC[3][4] ==0) and (lastC[3][4] ==0)) { MidiSend(noteOn3, 53, velocity); lastC[3][4] =7; } //Write Midi Note Off if ((keysC[3][4] ==1) and (lastC[3][4] ==7)) { MidiSend(noteOff3, 53, velocity); lastC[3][4] =0; } //C54 if ((keysC[3][5] ==0) and (lastC[3][5] ==0)) { MidiSend(noteOn3, 54, velocity); lastC[3][5] =7; } //Write Midi Note Off if ((keysC[3][5] ==1) and (lastC[3][5] ==7)) { MidiSend(noteOff3, 54, velocity); lastC[3][5] =0; } //C55 if ((keysC[4][0] ==0) and (lastC[4][0] ==0)) { MidiSend(noteOn3, 55, velocity); lastC[4][0] =7; } //Write Midi Note Off if ((keysC[4][0] ==1) and (lastC[4][0] ==7)) { MidiSend(noteOff3, 55, velocity); lastC[4][0] =0; } //C56 if ((keysC[4][1] ==0) and (lastC[4][1] ==0)) { MidiSend(noteOn3, 56, velocity); lastC[4][1] =7; } //Write Midi Note Off if ((keysC[4][1] ==1) and (lastC[4][1] ==7)) { MidiSend(noteOff3, 56, velocity); lastC[4][1] =0; } //C57 if ((keysC[4][2] ==0) and (lastC[4][2] ==0)) { MidiSend(noteOn3, 57, velocity); lastC[4][2] =7; } //Write Midi Note Off if ((keysC[4][2] ==1) and (lastC[4][2] ==7)) { MidiSend(noteOff3, 57, velocity); lastC[4][2] =0; } //C58 if ((keysC[4][3] ==0) and (lastC[4][3] ==0)) { MidiSend(noteOn3, 58, velocity); lastC[4][3] =7; } //Write Midi Note Off if ((keysC[4][3] ==1) and (lastC[4][3] ==7)) { MidiSend(noteOff3, 58, velocity); lastC[4][3] =0; } //C59 if ((keysC[4][4] ==0) and (lastC[4][4] ==0)) { MidiSend(noteOn3, 59, velocity); lastC[4][4] =7; } //Write Midi Note Off if ((keysC[4][4] ==1) and (lastC[4][4] ==7)) { MidiSend(noteOff3, 59, velocity); lastC[4][4] =0; } //C60 if ((keysC[4][5] ==0) and (lastC[4][5] ==0)) { MidiSend(noteOn3, 60, velocity); lastC[4][5] =7; } //Write Midi Note Off if ((keysC[4][5] ==1) and (lastC[4][5] ==7)) { MidiSend(noteOff3, 60, velocity); lastC[4][5] =0; } //C61 if ((keysC[5][0] ==0) and (lastC[5][0] ==0)) { MidiSend(noteOn3, 61, velocity); lastC[5][0] =7; } //Write Midi Note Off if ((keysC[5][0] ==1) and (lastC[5][0] ==7)) { MidiSend(noteOff3, 61, velocity); lastC[5][0] =0; } //C62 if ((keysC[5][1] ==0) and (lastC[5][1] ==0)) { MidiSend(noteOn3, 62, velocity); lastC[5][1] =7; } //Write Midi Note Off if ((keysC[5][1] ==1) and (lastC[5][1] ==7)) { MidiSend(noteOff3, 62, velocity); lastC[5][1] =0; } //C63 if ((keysC[5][2] ==0) and (lastC[5][2] ==0)) { MidiSend(noteOn3, 63, velocity); lastC[5][2] =7; } //Write Midi Note Off if ((keysC[5][2] ==1) and (lastC[5][2] ==7)) { MidiSend(noteOff3, 63, velocity); lastC[5][2] =0; } //C64 if ((keysC[5][3] ==0) and (lastC[5][3] ==0)) { MidiSend(noteOn3, 64, velocity); lastC[5][3] =7; } //Write Midi Note Off if ((keysC[5][3] ==1) and (lastC[5][3] ==7)) { MidiSend(noteOff3, 64, velocity); lastC[5][3] =0; } //C65 if ((keysC[5][4] ==0) and (lastC[5][4] ==0)) { MidiSend(noteOn3, 65, velocity); lastC[5][4] =7; } //Write Midi Note Off if ((keysC[5][4] ==1) and (lastC[5][4] ==7)) { MidiSend(noteOff3, 65, velocity); lastC[5][4] =0; } //C66 if ((keysC[5][5] ==0) and (lastC[5][5] ==0)) { MidiSend(noteOn3, 66, velocity); lastC[5][5] =7; } //Write Midi Note Off if ((keysC[5][5] ==1) and (lastC[5][5] ==7)) { MidiSend(noteOff3, 66, velocity); lastC[5][5] =0; } //C67 if ((keysC[6][0] ==0) and (lastC[6][0] ==0)) { MidiSend(noteOn3, 67, velocity); lastC[6][0] =7; } //Write Midi Note Off if ((keysC[6][0] ==1) and (lastC[6][0] ==7)) { MidiSend(noteOff3, 67, velocity); lastC[6][0] =0; } //C68 if ((keysC[6][1] ==0) and (lastC[6][1] ==0)) { MidiSend(noteOn3, 68, velocity); lastC[6][1] =7; } //Write Midi Note Off if ((keysC[6][1] ==1) and (lastC[6][1] ==7)) { MidiSend(noteOff3, 68, velocity); lastC[6][1] =0; } //C69 if ((keysC[6][2] ==0) and (lastC[6][2] ==0)) { MidiSend(noteOn3, 69, velocity); lastC[6][2] =7; } //Write Midi Note Off if ((keysC[6][2] ==1) and (lastC[6][2] ==7)) { MidiSend(noteOff3, 69, velocity); lastC[6][2] =0; } //C70 if ((keysC[6][3] ==0) and (lastC[6][3] ==0)) { MidiSend(noteOn3, 70, velocity); lastC[6][3] =7; } //Write Midi Note Off if ((keysC[6][3] ==1) and (lastC[6][3] ==7)) { MidiSend(noteOff3, 70, velocity); lastC[6][3] =0; } //C71 if ((keysC[6][4] ==0) and (lastC[6][4] ==0)) { MidiSend(noteOn3, 71, velocity); lastC[6][4] =7; } //Write Midi Note Off if ((keysC[6][4] ==1) and (lastC[6][4] ==7)) { MidiSend(noteOff3, 71, velocity); lastC[6][4] =0; } //C72 if ((keysC[6][5] ==0) and (lastC[6][5] ==0)) { MidiSend(noteOn3, 72, velocity); lastC[6][5] =7; } //Write Midi Note Off if ((keysC[6][5] ==1) and (lastC[6][5] ==7)) { MidiSend(noteOff3, 72, velocity); lastC[6][5] =0; } //C73 if ((keysC[7][0] ==0) and (lastC[7][0] ==0)) { MidiSend(noteOn3, 73, velocity); lastC[7][0] =7; } //Write Midi Note Off if ((keysC[7][0] ==1) and (lastC[7][0] ==7)) { MidiSend(noteOff3, 73, velocity); lastC[7][0] =0; } //C74 if ((keysC[7][1] ==0) and (lastC[7][1] ==0)) { MidiSend(noteOn3, 74, velocity); lastC[7][1] =7; } //Write Midi Note Off if ((keysC[7][1] ==1) and (lastC[7][1] ==7)) { MidiSend(noteOff3, 74, velocity); lastC[7][1] =0; } //C75 if ((keysC[7][2] ==0) and (lastC[7][2] ==0)) { MidiSend(noteOn3, 75, velocity); lastC[7][2] =7; } //Write Midi Note Off if ((keysC[7][2] ==1) and (lastC[7][2] ==7)) { MidiSend(noteOff3, 75, velocity); lastC[7][2] =0; } //C76 if ((keysC[7][3] ==0) and (lastC[7][3] ==0)) { MidiSend(noteOn3, 76, velocity); lastC[7][3] =7; } //Write Midi Note Off if ((keysC[7][3] ==1) and (lastC[7][3] ==7)) { MidiSend(noteOff3, 76, velocity); lastC[7][3] =0; } //C77 if ((keysC[7][4] ==0) and (lastC[7][4] ==0)) { MidiSend(noteOn3, 77, velocity); lastC[7][4] =7; } //Write Midi Note Off if ((keysC[7][4] ==1) and (lastC[7][4] ==7)) { MidiSend(noteOff3, 77, velocity); lastC[7][4] =0; } //C78 if ((keysC[7][5] ==0) and (lastC[7][5] ==0)) { MidiSend(noteOn3, 78, velocity); lastC[7][5] =7; } //Write Midi Note Off if ((keysC[7][5] ==1) and (lastC[7][5] ==7)) { MidiSend(noteOff3, 78, velocity); lastC[7][5] =0; } //C79 if ((keysC[8][0] ==0) and (lastC[8][0] ==0)) { MidiSend(noteOn3, 79, velocity); lastC[8][0] =7; } //Write Midi Note Off if ((keysC[8][0] ==1) and (lastC[8][0] ==7)) { MidiSend(noteOff2, 79, velocity); lastC[8][0] =0; } //C80 if ((keysC[8][1] ==0) and (lastC[8][1] ==0)) { MidiSend(noteOn3, 80, velocity); lastC[8][1] =7; } //Write Midi Note Off if ((keysC[8][1] ==1) and (lastC[8][1] ==7)) { MidiSend(noteOff3, 80, velocity); lastC[8][1] =0; } //C81 if ((keysC[8][2] ==0) and (lastC[8][2] ==0)) { MidiSend(noteOn3, 81, velocity); lastC[8][2] =7; } //Write Midi Note Off if ((keysC[8][2] ==1) and (lastC[8][2] ==7)) { MidiSend(noteOff3, 81, velocity); lastC[8][2] =0; } //C82 if ((keysC[8][3] ==0) and (lastC[8][3] ==0)) { MidiSend(noteOn3, 82, velocity); lastC[8][3] =7; } //Write Midi Note Off if ((keysC[8][3] ==1) and (lastC[8][3] ==7)) { MidiSend(noteOff3, 82, velocity); lastC[8][3] =0; } //C83 if ((keysC[8][4] ==0) and (lastC[8][4] ==0)) { MidiSend(noteOn3, 83, velocity); lastC[8][4] =7; } //Write Midi Note Off if ((keysC[8][4] ==1) and (lastC[8][4] ==7)) { MidiSend(noteOff3, 83, velocity); lastC[8][4] =0; } //C84 if ((keysC[8][5] ==0) and (lastC[8][5] ==0)) { MidiSend(noteOn3, 84, velocity); lastC[8][5] =7; } //Write Midi Note Off if ((keysC[8][5] ==1) and (lastC[8][5] ==7)) { MidiSend(noteOff3, 84, velocity); lastC[8][5] =0; } //C85 if ((keysC[9][0] ==0) and (lastC[9][0] ==0)) { MidiSend(noteOn3, 85, velocity); lastC[9][0] =7; } //Write Midi Note Off if ((keysC[9][0] ==1) and (lastC[9][0] ==7)) { MidiSend(noteOff3, 85, velocity); lastC[9][0] =0; } //C86 if ((keysC[9][1] ==0) and (lastC[9][1] ==0)) { MidiSend(noteOn2, 86, velocity); lastC[9][1] =7; } //Write Midi Note Off if ((keysC[9][1] ==1) and (lastC[9][1] ==7)) { MidiSend(noteOff3, 86, velocity); lastC[9][1] =0; } //C87 if ((keysC[9][2] ==0) and (lastC[9][2] ==0)) { MidiSend(noteOn3, 87, velocity); lastC[9][2] =7; } //Write Midi Note Off if ((keysC[9][2] ==1) and (lastC[9][2] ==7)) { MidiSend(noteOff3, 87, velocity); lastC[9][2] =0; } //C88 if ((keysC[9][3] ==0) and (lastC[9][3] ==0)) { MidiSend(noteOn3, 88, velocity); lastC[9][3] =7; } //Write Midi Note Off if ((keysC[9][3] ==1) and (lastC[9][3] ==7)) { MidiSend(noteOff3, 88, velocity); lastC[9][3] =0; } //C89 if ((keysC[9][4] ==0) and (lastC[9][4] ==0)) { MidiSend(noteOn3, 89, velocity); lastC[9][4] =7; } //Write Midi Note Off if ((keysC[9][4] ==1) and (lastC[9][4] ==7)) { MidiSend(noteOff3, 89, velocity); lastC[9][4] =0; } //C90 if ((keysC[9][5] ==0) and (lastC[9][5] ==0)) { MidiSend(noteOn3, 90, velocity); lastC[9][5] =7; } //Write Midi Note Off if ((keysC[9][5] ==1) and (lastC[9][5] ==7)) { MidiSend(noteOff3, 90, velocity); lastC[9][5] =0; } //C91 if ((keysC[10][0] ==0) and (lastC[10][0] ==0)) { MidiSend(noteOn3, 91, velocity); lastC[10][0] =7; } //Write Midi Note Off if ((keysC[10][0] ==1) and (lastC[10][0] ==7)) { MidiSend(noteOff3, 91, velocity); lastC[10][0] =0; } //C92 if ((keysC[10][1] ==0) and (lastC[10][1] ==0)) { MidiSend(noteOn3, 92, velocity); lastC[10][1] =7; } //Write Midi Note Off if ((keysC[10][1] ==1) and (lastC[10][1] ==7)) { MidiSend(noteOff3, 92, velocity); lastC[10][1] =0; } //C93 if ((keysC[10][2] ==0) and (lastC[10][2] ==0)) { MidiSend(noteOn3, 93, velocity); lastC[10][2] =7; } //Write Midi Note Off if ((keysC[10][2] ==1) and (lastC[10][2] ==7)) { MidiSend(noteOff3, 93, velocity); lastC[10][2] =0; } //C94 if ((keysC[10][3] ==0) and (lastC[10][3] ==0)) { MidiSend(noteOn3, 94, velocity); lastC[10][3] =7; } //Write Midi Note Off if ((keysC[10][3] ==1) and (lastC[10][3] ==7)) { MidiSend(noteOff3, 94, velocity); lastC[10][3] =0; } //C95 if ((keysC[10][4] ==0) and (lastC[10][4] ==0)) { MidiSend(noteOn3, 95, velocity); lastC[10][4] =7; } //Write Midi Note Off if ((keysC[10][4] ==1) and (lastC[10][4] ==7)) { MidiSend(noteOff3, 95, velocity); lastC[10][4] =0; } //C96 if ((keysC[10][5] ==0) and (lastC[10][5] ==0)) { MidiSend(noteOn3, 96, velocity); lastC[10][5] =7; } //Write Midi Note Off if ((keysC[10][5] ==1) and (lastC[10][5] ==7)) { MidiSend(noteOff3, 96, velocity); lastC[10][5] =0; } //Write Keyboard D //D36 if ((keysD[0][0] ==0) and (lastD[0][0] ==0)) { MidiSend(noteOn4, 36, velocity); lastD[0][0] =7; } if ((keysD[0][0] ==1) and (lastD[0][0] ==7)) { MidiSend(noteOff4, 36, velocity); lastD[0][0] =0; } //D37 if ((keysD[1][0] ==0) and (lastD[1][0] ==0)) { MidiSend(noteOn4, 37, velocity); lastD[1][0] =7; } if ((keysD[1][0] ==1) and (lastD[1][0] ==7)) { MidiSend(noteOff4, 37, velocity); lastD[1][0] =0; } //D38 if ((keysD[1][1] ==0) and (lastD[1][1] ==0)) { MidiSend(noteOn4, 38, velocity); lastD[1][1] =7; } //Write Midi Note Off if ((keysD[1][1] ==1) and (lastD[1][1] ==7)) { MidiSend(noteOff4, 38, velocity); lastD[1][1] =0; } //D39 if ((keysD[1][2] ==0) and (lastD[1][2] ==0)) { MidiSend(noteOn4, 39, velocity); lastD[1][2] =7; } //Write Midi Note Off if ((keysD[1][2] ==1) and (lastD[1][2] ==7)) { MidiSend(noteOff4, 39, velocity); lastD[1][2] =0; } //D40 if ((keysD[1][3] ==0) and (lastD[1][3] ==0)) { MidiSend(noteOn4, 40, velocity); lastD[1][3] =7; } //Write Midi Note Off if ((keysD[1][3] ==1) and (lastD[1][3] ==7)) { MidiSend(noteOff4, 40, velocity); lastD[1][3] =0; } //D41 if ((keysD[1][4] ==0) and (lastD[1][4] ==0)) { MidiSend(noteOn4, 41, velocity); lastD[1][4] =7; } //Write Midi Note Off if ((keysD[1][4] ==1) and (lastD[1][4] ==7)) { MidiSend(noteOff4, 41, velocity); lastD[1][4] =0; } //D42 if ((keysD[1][5] ==0) and (lastD[1][5] ==0)) { MidiSend(noteOn4, 42, velocity); lastD[1][5] =7; } //Write Midi Note Off if ((keysD[1][5] ==1) and (lastD[1][5] ==7)) { MidiSend(noteOff4, 42, velocity); lastD[1][5] =0; } //D43 if ((keysD[2][0] ==0) and (lastD[2][0] ==0)) { MidiSend(noteOn4, 43, velocity); lastD[2][0] =7; } //Write Midi Note Off if ((keysD[2][0] ==1) and (lastD[2][0] ==7)) { MidiSend(noteOff4, 43, velocity); lastD[2][0] =0; } //B44 if ((keysD[2][1] ==0) and (lastD[2][1] ==0)) { MidiSend(noteOn4, 44, velocity); lastD[2][1] =7; } //Write Midi Note Off if ((keysD[2][1] ==1) and (lastD[2][1] ==7)) { MidiSend(noteOff4, 44, velocity); lastD[2][1] =0; } //D45 if ((keysD[2][2] ==0) and (lastD[2][2] ==0)) { MidiSend(noteOn4, 45, velocity); lastD[2][2] =7; } //Write Midi Note Off if ((keysD[2][2] ==1) and (lastD[2][2] ==7)) { MidiSend(noteOff4, 45, velocity); lastD[2][2] =0; } //D46 if ((keysD[2][3] ==0) and (lastD[2][3] ==0)) { MidiSend(noteOn4, 46, velocity); lastD[2][3] =7; } //Write Midi Note Off if ((keysD[2][3] ==1) and (lastD[2][3] ==7)) { MidiSend(noteOff4, 46, velocity); lastD[2][3] =0; } //D47 if ((keysD[2][4] ==0) and (lastD[2][4] ==0)) { MidiSend(noteOn4, 47, velocity); lastD[2][4] =7; } //Write Midi Note Off if ((keysD[2][4] ==1) and (lastD[2][4] ==7)) { MidiSend(noteOff4, 47, velocity); lastD[2][4] =0; } //D48 if ((keysD[2][5] ==0) and (lastD[2][5] ==0)) { MidiSend(noteOn4, 48, velocity); lastD[2][5] =7; } //Write Midi Note Off if ((keysD[2][5] ==1) and (lastD[2][5] ==7)) { MidiSend(noteOff4, 48, velocity); lastD[2][5] =0; } //D49 if ((keysD[3][0] ==0) and (lastD[3][0] ==0)) { MidiSend(noteOn4, 49, velocity); lastD[3][0] =7; } //Write Midi Note Off if ((keysD[3][0] ==1) and (lastD[3][0] ==7)) { MidiSend(noteOff4, 49, velocity); lastD[3][0] =0; } //D50 if ((keysD[3][1] ==0) and (lastD[3][1] ==0)) { MidiSend(noteOn4, 50, velocity); lastD[3][1] =7; } //Write Midi Note Off if ((keysD[3][1] ==1) and (lastD[3][1] ==7)) { MidiSend(noteOff4, 50, velocity); lastD[3][1] =0; } //D51 if ((keysD[3][2] ==0) and (lastD[3][2] ==0)) { MidiSend(noteOn4, 51, velocity); lastD[3][2] =7; } //Write Midi Note Off if ((keysD[3][2] ==1) and (lastD[3][2] ==7)) { MidiSend(noteOff4, 51, velocity); lastD[3][2] =0; } //D52 if ((keysD[3][3] ==0) and (lastD[3][3] ==0)) { MidiSend(noteOn4, 52, velocity); lastD[3][3] =7; } //Write Midi Note Off if ((keysD[3][3] ==1) and (lastD[3][3] ==7)) { MidiSend(noteOff4, 52, velocity); lastD[3][3] =0; } //D53 if ((keysD[3][4] ==0) and (lastD[3][4] ==0)) { MidiSend(noteOn4, 53, velocity); lastD[3][4] =7; } //Write Midi Note Off if ((keysD[3][4] ==1) and (lastD[3][4] ==7)) { MidiSend(noteOff4, 53, velocity); lastD[3][4] =0; } //D54 if ((keysD[3][5] ==0) and (lastD[3][5] ==0)) { MidiSend(noteOn4, 54, velocity); lastD[3][5] =7; } //Write Midi Note Off if ((keysD[3][5] ==1) and (lastD[3][5] ==7)) { MidiSend(noteOff4, 54, velocity); lastD[3][5] =0; } //D55 if ((keysD[4][0] ==0) and (lastD[4][0] ==0)) { MidiSend(noteOn4, 55, velocity); lastD[4][0] =7; } //Write Midi Note Off if ((keysD[4][0] ==1) and (lastD[4][0] ==7)) { MidiSend(noteOff4, 55, velocity); lastD[4][0] =0; } //D56 if ((keysD[4][1] ==0) and (lastD[4][1] ==0)) { MidiSend(noteOn4, 56, velocity); lastD[4][1] =7; } //Write Midi Note Off if ((keysD[4][1] ==1) and (lastD[4][1] ==7)) { MidiSend(noteOff4, 56, velocity); lastD[4][1] =0; } //D57 if ((keysD[4][2] ==0) and (lastD[4][2] ==0)) { MidiSend(noteOn4, 57, velocity); lastD[4][2] =7; } //Write Midi Note Off if ((keysD[4][2] ==1) and (lastD[4][2] ==7)) { MidiSend(noteOff4, 57, velocity); lastD[4][2] =0; } //D58 if ((keysD[4][3] ==0) and (lastD[4][3] ==0)) { MidiSend(noteOn4, 58, velocity); lastD[4][3] =7; } //Write Midi Note Off if ((keysD[4][3] ==1) and (lastD[4][3] ==7)) { MidiSend(noteOff4, 58, velocity); lastD[4][3] =0; } //D59 if ((keysD[4][4] ==0) and (lastD[4][4] ==0)) { MidiSend(noteOn4, 59, velocity); lastD[4][4] =7; } //Write Midi Note Off if ((keysD[4][4] ==1) and (lastD[4][4] ==7)) { MidiSend(noteOff4, 59, velocity); lastD[4][4] =0; } //D60 if ((keysD[4][5] ==0) and (lastD[4][5] ==0)) { MidiSend(noteOn4, 60, velocity); lastD[4][5] =7; } //Write Midi Note Off if ((keysD[4][5] ==1) and (lastD[4][5] ==7)) { MidiSend(noteOff4, 60, velocity); lastD[4][5] =0; } //D61 if ((keysD[5][0] ==0) and (lastD[5][0] ==0)) { MidiSend(noteOn4, 61, velocity); lastD[5][0] =7; } //Write Midi Note Off if ((keysD[5][0] ==1) and (lastD[5][0] ==7)) { MidiSend(noteOff4, 61, velocity); lastD[5][0] =0; } //D62 if ((keysD[5][1] ==0) and (lastD[5][1] ==0)) { MidiSend(noteOn4, 62, velocity); lastD[5][1] =7; } //Write Midi Note Off if ((keysD[5][1] ==1) and (lastD[5][1] ==7)) { MidiSend(noteOff4, 62, velocity); lastD[5][1] =0; } //D63 if ((keysD[5][2] ==0) and (lastD[5][2] ==0)) { MidiSend(noteOn4, 63, velocity); lastD[5][2] =7; } //Write Midi Note Off if ((keysD[5][2] ==1) and (lastD[5][2] ==7)) { MidiSend(noteOff4, 63, velocity); lastD[5][2] =0; } //D64 if ((keysD[5][3] ==0) and (lastD[5][3] ==0)) { MidiSend(noteOn4, 64, velocity); lastD[5][3] =7; } //Write Midi Note Off if ((keysD[5][3] ==1) and (lastD[5][3] ==7)) { MidiSend(noteOff4, 64, velocity); lastD[5][3] =0; } //D65 if ((keysD[5][4] ==0) and (lastD[5][4] ==0)) { MidiSend(noteOn4, 65, velocity); lastD[5][4] =7; } //Write Midi Note Off if ((keysD[5][4] ==1) and (lastD[5][4] ==7)) { MidiSend(noteOff4, 65, velocity); lastD[5][4] =0; } //D66 if ((keysD[5][5] ==0) and (lastD[5][5] ==0)) { MidiSend(noteOn4, 66, velocity); lastD[5][5] =7; } //Write Midi Note Off if ((keysD[5][5] ==1) and (lastD[5][5] ==7)) { MidiSend(noteOff4, 66, velocity); lastD[5][5] =0; } //D67 if ((keysD[6][0] ==0) and (lastD[6][0] ==0)) { MidiSend(noteOn4, 67, velocity); lastD[6][0] =7; } //Write Midi Note Off if ((keysD[6][0] ==1) and (lastD[6][0] ==7)) { MidiSend(noteOff4, 67, velocity); lastD[6][0] =0; } //D68 if ((keysD[6][1] ==0) and (lastD[6][1] ==0)) { MidiSend(noteOn4, 68, velocity); lastD[6][1] =7; } //Write Midi Note Off if ((keysD[6][1] ==1) and (lastD[6][1] ==7)) { MidiSend(noteOff4, 68, velocity); lastD[6][1] =0; } //D69 if ((keysD[6][2] ==0) and (lastD[6][2] ==0)) { MidiSend(noteOn4, 69, velocity); lastD[6][2] =7; } //Write Midi Note Off if ((keysD[6][2] ==1) and (lastD[6][2] ==7)) { MidiSend(noteOff4, 69, velocity); lastD[6][2] =0; } //D70 if ((keysD[6][3] ==0) and (lastD[6][3] ==0)) { MidiSend(noteOn4, 70, velocity); lastD[6][3] =7; } //Write Midi Note Off if ((keysD[6][3] ==1) and (lastD[6][3] ==7)) { MidiSend(noteOff4, 70, velocity); lastD[6][3] =0; } //D71 if ((keysD[6][4] ==0) and (lastD[6][4] ==0)) { MidiSend(noteOn4, 71, velocity); lastD[6][4] =7; } //Write Midi Note Off if ((keysD[6][4] ==1) and (lastD[6][4] ==7)) { MidiSend(noteOff4, 71, velocity); lastD[6][4] =0; } //D72 if ((keysD[6][5] ==0) and (lastD[6][5] ==0)) { MidiSend(noteOn4, 72, velocity); lastD[6][5] =7; } //Write Midi Note Off if ((keysD[6][5] ==1) and (lastD[6][5] ==7)) { MidiSend(noteOff4, 72, velocity); lastD[6][5] =0; } //D73 if ((keysD[7][0] ==0) and (lastD[7][0] ==0)) { MidiSend(noteOn4, 73, velocity); lastD[7][0] =7; } //Write Midi Note Off if ((keysD[7][0] ==1) and (lastD[7][0] ==7)) { MidiSend(noteOff4, 73, velocity); lastD[7][0] =0; } //D74 if ((keysD[7][1] ==0) and (lastD[7][1] ==0)) { MidiSend(noteOn4, 74, velocity); lastD[7][1] =7; } //Write Midi Note Off if ((keysD[7][1] ==1) and (lastD[7][1] ==7)) { MidiSend(noteOff4, 74, velocity); lastD[7][1] =0; } //D75 if ((keysD[7][2] ==0) and (lastD[7][2] ==0)) { MidiSend(noteOn4, 75, velocity); lastD[7][2] =7; } //Write Midi Note Off if ((keysD[7][2] ==1) and (lastD[7][2] ==7)) { MidiSend(noteOff4, 75, velocity); lastD[7][2] =0; } //D76 if ((keysD[7][3] ==0) and (lastD[7][3] ==0)) { MidiSend(noteOn4, 76, velocity); lastD[7][3] =7; } //Write Midi Note Off if ((keysD[7][3] ==1) and (lastD[7][3] ==7)) { MidiSend(noteOff4, 76, velocity); lastD[7][3] =0; } //D77 if ((keysD[7][4] ==0) and (lastD[7][4] ==0)) { MidiSend(noteOn4, 77, velocity); lastD[7][4] =7; } //Write Midi Note Off if ((keysD[7][4] ==1) and (lastD[7][4] ==7)) { MidiSend(noteOff4, 77, velocity); lastD[7][4] =0; } //D78 if ((keysD[7][5] ==0) and (lastD[7][5] ==0)) { MidiSend(noteOn4, 78, velocity); lastD[7][5] =7; } //Write Midi Note Off if ((keysD[7][5] ==1) and (lastD[7][5] ==7)) { MidiSend(noteOff4, 78, velocity); lastD[7][5] =0; } //D79 if ((keysD[8][0] ==0) and (lastD[8][0] ==0)) { MidiSend(noteOn4, 79, velocity); lastD[8][0] =7; } //Write Midi Note Off if ((keysD[8][0] ==1) and (lastD[8][0] ==7)) { MidiSend(noteOff4, 79, velocity); lastD[8][0] =0; } //D80 if ((keysD[8][1] ==0) and (lastD[8][1] ==0)) { MidiSend(noteOn4, 80, velocity); lastD[8][1] =7; } //Write Midi Note Off if ((keysD[8][1] ==1) and (lastD[8][1] ==7)) { MidiSend(noteOff4, 80, velocity); lastD[8][1] =0; } //D81 if ((keysD[8][2] ==0) and (lastD[8][2] ==0)) { MidiSend(noteOn4, 81, velocity); lastD[8][2] =7; } //Write Midi Note Off if ((keysD[8][2] ==1) and (lastD[8][2] ==7)) { MidiSend(noteOff4, 81, velocity); lastD[8][2] =0; } //D82 if ((keysD[8][3] ==0) and (lastD[8][3] ==0)) { MidiSend(noteOn4, 82, velocity); lastD[8][3] =7; } //Write Midi Note Off if ((keysD[8][3] ==1) and (lastD[8][3] ==7)) { MidiSend(noteOff4, 82, velocity); lastD[8][3] =0; } //D83 if ((keysD[8][4] ==0) and (lastD[8][4] ==0)) { MidiSend(noteOn4, 83, velocity); lastD[8][4] =7; } //Write Midi Note Off if ((keysD[8][4] ==1) and (lastD[8][4] ==7)) { MidiSend(noteOff4, 83, velocity); lastD[8][4] =0; } //D84 if ((keysD[8][5] ==0) and (lastD[8][5] ==0)) { MidiSend(noteOn4, 84, velocity); lastD[8][5] =7; } //Write Midi Note Off if ((keysD[8][5] ==1) and (lastD[8][5] ==7)) { MidiSend(noteOff4, 84, velocity); lastD[8][5] =0; } //D85 if ((keysD[9][0] ==0) and (lastD[9][0] ==0)) { MidiSend(noteOn4, 85, velocity); lastD[9][0] =7; } //Write Midi Note Off if ((keysD[9][0] ==1) and (lastD[9][0] ==7)) { MidiSend(noteOff4, 85, velocity); lastD[9][0] =0; } //D86 if ((keysD[9][1] ==0) and (lastD[9][1] ==0)) { MidiSend(noteOn4, 86, velocity); lastD[9][1] =7; } //Write Midi Note Off if ((keysD[9][1] ==1) and (lastD[9][1] ==7)) { MidiSend(noteOff4, 86, velocity); lastD[9][1] =0; } //D87 if ((keysD[9][2] ==0) and (lastD[9][2] ==0)) { MidiSend(noteOn4, 87, velocity); lastD[9][2] =7; } //Write Midi Note Off if ((keysD[9][2] ==1) and (lastD[9][2] ==7)) { MidiSend(noteOff4, 87, velocity); lastD[9][2] =0; } //D88 if ((keysD[9][3] ==0) and (lastD[9][3] ==0)) { MidiSend(noteOn4, 88, velocity); lastD[9][3] =7; } //Write Midi Note Off if ((keysD[9][3] ==1) and (lastD[9][3] ==7)) { MidiSend(noteOff4, 88, velocity); lastD[9][3] =0; } //D89 if ((keysD[9][4] ==0) and (lastD[9][4] ==0)) { MidiSend(noteOn4, 89, velocity); lastD[9][4] =7; } //Write Midi Note Off if ((keysD[9][4] ==1) and (lastD[9][4] ==7)) { MidiSend(noteOff4, 89, velocity); lastD[9][4] =0; } //D90 if ((keysD[9][5] ==0) and (lastD[9][5] ==0)) { MidiSend(noteOn4, 90, velocity); lastD[9][5] =7; } //Write Midi Note Off if ((keysD[9][5] ==1) and (lastD[9][5] ==7)) { MidiSend(noteOff4, 90, velocity); lastD[9][5] =0; } //D91 if ((keysD[10][0] ==0) and (lastD[10][0] ==0)) { MidiSend(noteOn4, 91, velocity); lastD[10][0] =7; } //Write Midi Note Off if ((keysD[10][0] ==1) and (lastD[10][0] ==7)) { MidiSend(noteOff4, 91, velocity); lastD[10][0] =0; } //D92 if ((keysD[10][1] ==0) and (lastD[10][1] ==0)) { MidiSend(noteOn4, 92, velocity); lastD[10][1] =7; } //Write Midi Note Off if ((keysD[10][1] ==1) and (lastD[10][1] ==7)) { MidiSend(noteOff4, 92, velocity); lastD[10][1] =0; } //D93 if ((keysD[10][2] ==0) and (lastD[10][2] ==0)) { MidiSend(noteOn4, 93, velocity); lastD[10][2] =7; } //Write Midi Note Off if ((keysD[10][2] ==1) and (lastD[10][2] ==7)) { MidiSend(noteOff4, 93, velocity); lastD[10][2] =0; } //D94 if ((keysD[10][3] ==0) and (lastD[10][3] ==0)) { MidiSend(noteOn4, 94, velocity); lastD[10][3] =7; } //Write Midi Note Off if ((keysD[10][3] ==1) and (lastD[10][3] ==7)) { MidiSend(noteOff4, 94, velocity); lastD[10][3] =0; } //D95 if ((keysD[10][4] ==0) and (lastD[10][4] ==0)) { MidiSend(noteOn4, 95, velocity); lastD[10][4] =7; } //Write Midi Note Off if ((keysD[10][4] ==1) and (lastD[10][4] ==7)) { MidiSend(noteOff4, 95, velocity); lastD[10][4] =0; } //D96 if ((keysD[10][5] ==0) and (lastD[10][5] ==0)) { MidiSend(noteOn4, 96, velocity); lastD[10][5] =7; } //Write Midi Note Off if ((keysD[10][5] ==1) and (lastD[10][5] ==7)) { MidiSend(noteOff4, 96, velocity); lastD[10][5] =0; } //Write Keyboard C, only for inverted switches, first 32 notes only. /* //C36 if ((keysC[0][0] ==0) and (lastC[0][0] ==0)) { MidiSend(noteOff3, 36, velocity); lastC[0][0] =7; } if ((keysC[0][0] ==1) and (lastC[0][0] ==7)) { MidiSend(noteOn3, 36, velocity); lastC[0][0] =0; } //C37 if ((keysC[1][0] ==0) and (lastC[1][0] ==0)) { MidiSend(noteOff3, 37, velocity); lastC[1][0] =7; } if ((keysC[1][0] ==1) and (lastC[1][0] ==7)) { MidiSend(noteOn3, 37, velocity); lastC[1][0] =0; } //C38 if ((keysC[1][1] ==0) and (lastC[1][1] ==0)) { MidiSend(noteOff3, 38, velocity); lastC[1][1] =7; } //Write Midi Note Off if ((keysC[1][1] ==1) and (lastC[1][1] ==7)) { MidiSend(noteOn3, 38, velocity); lastC[1][1] =0; } //C39 if ((keysC[1][2] ==0) and (lastC[1][2] ==0)) { MidiSend(noteOff3, 39, velocity); lastC[1][2] =7; } //Write Midi Note Off if ((keysC[1][2] ==1) and (lastC[1][2] ==7)) { MidiSend(noteOn3, 39, velocity); lastC[1][2] =0; } //C40 if ((keysC[1][3] ==0) and (lastC[1][3] ==0)) { MidiSend(noteOff3, 40, velocity); lastC[1][3] =7; } //Write Midi Note Off if ((keysC[1][3] ==1) and (lastC[1][3] ==7)) { MidiSend(noteOn3, 40, velocity); lastC[1][3] =0; } //C41 if ((keysC[1][4] ==0) and (lastC[1][4] ==0)) { MidiSend(noteOff3, 41, velocity); lastC[1][4] =7; } //Write Midi Note Off if ((keysC[1][4] ==1) and (lastC[1][4] ==7)) { MidiSend(noteOn3, 41, velocity); lastC[1][4] =0; } //C42 if ((keysC[1][5] ==0) and (lastC[1][5] ==0)) { MidiSend(noteOff3, 42, velocity); lastC[1][5] =7; } //Write Midi Note Off if ((keysC[1][5] ==1) and (lastC[1][5] ==7)) { MidiSend(noteOn3, 42, velocity); lastC[1][5] =0; } //C43 if ((keysC[2][0] ==0) and (lastC[2][0] ==0)) { MidiSend(noteOff3, 43, velocity); lastC[2][0] =7; } //Write Midi Note Off if ((keysC[2][0] ==1) and (lastC[2][0] ==7)) { MidiSend(noteOn3, 43, velocity); lastC[2][0] =0; } //C44 if ((keysC[2][1] ==0) and (lastC[2][1] ==0)) { MidiSend(noteOff3, 44, velocity); lastC[2][1] =7; } //Write Midi Note Off if ((keysC[2][1] ==1) and (lastC[2][1] ==7)) { MidiSend(noteOn3, 44, velocity); lastC[2][1] =0; } //C45 if ((keysC[2][2] ==0) and (lastC[2][2] ==0)) { MidiSend(noteOff3, 45, velocity); lastC[2][2] =7; } //Write Midi Note Off if ((keysC[2][2] ==1) and (lastC[2][2] ==7)) { MidiSend(noteOn3, 45, velocity); lastC[2][2] =0; } //C46 if ((keysC[2][3] ==0) and (lastC[2][3] ==0)) { MidiSend(noteOff3, 46, velocity); lastC[2][3] =7; } //Write Midi Note Off if ((keysC[2][3] ==1) and (lastC[2][3] ==7)) { MidiSend(noteOn3, 46, velocity); lastC[2][3] =0; } //C47 if ((keysC[2][4] ==0) and (lastC[2][4] ==0)) { MidiSend(noteOff3, 47, velocity); lastC[2][4] =7; } //Write Midi Note Off if ((keysC[2][4] ==1) and (lastC[2][4] ==7)) { MidiSend(noteOn3, 47, velocity); lastC[2][4] =0; } //C48 if ((keysC[2][5] ==0) and (lastC[2][5] ==0)) { MidiSend(noteOff3, 48, velocity); lastC[2][5] =7; } //Write Midi Note Off if ((keysC[2][5] ==1) and (lastC[2][5] ==7)) { MidiSend(noteOn3, 48, velocity); lastC[2][5] =0; } //C49 if ((keysC[3][0] ==0) and (lastC[3][0] ==0)) { MidiSend(noteOff3, 49, velocity); lastC[3][0] =7; } //Write Midi Note Off if ((keysC[3][0] ==1) and (lastC[3][0] ==7)) { MidiSend(noteOn3, 49, velocity); lastC[3][0] =0; } //C50 if ((keysC[3][1] ==0) and (lastC[3][1] ==0)) { MidiSend(noteOff3, 50, velocity); lastC[3][1] =7; } //Write Midi Note Off if ((keysC[3][1] ==1) and (lastC[3][1] ==7)) { MidiSend(noteOn3, 50, velocity); lastC[3][1] =0; } //C51 if ((keysC[3][2] ==0) and (lastC[3][2] ==0)) { MidiSend(noteOff3, 51, velocity); lastC[3][2] =7; } //Write Midi Note Off if ((keysC[3][2] ==1) and (lastC[3][2] ==7)) { MidiSend(noteOn3, 51, velocity); lastC[3][2] =0; } //C52 if ((keysC[3][3] ==0) and (lastC[3][3] ==0)) { MidiSend(noteOff3, 52, velocity); lastC[3][3] =7; } //Write Midi Note Off if ((keysC[3][3] ==1) and (lastC[3][3] ==7)) { MidiSend(noteOn3, 52, velocity); lastC[3][3] =0; } //C53 if ((keysC[3][4] ==0) and (lastC[3][4] ==0)) { MidiSend(noteOff3, 53, velocity); lastC[3][4] =7; } //Write Midi Note Off if ((keysC[3][4] ==1) and (lastC[3][4] ==7)) { MidiSend(noteOn3, 53, velocity); lastC[3][4] =0; } //C54 if ((keysC[3][5] ==0) and (lastC[3][5] ==0)) { MidiSend(noteOff3, 54, velocity); lastC[3][5] =7; } //Write Midi Note Off if ((keysC[3][5] ==1) and (lastC[3][5] ==7)) { MidiSend(noteOn3, 54, velocity); lastC[3][5] =0; } //C55 if ((keysC[4][0] ==0) and (lastC[4][0] ==0)) { MidiSend(noteOff3, 55, velocity); lastC[4][0] =7; } //Write Midi Note Off if ((keysC[4][0] ==1) and (lastC[4][0] ==7)) { MidiSend(noteOn3, 55, velocity); lastC[4][0] =0; } //C56 if ((keysC[4][1] ==0) and (lastC[4][1] ==0)) { MidiSend(noteOff3, 56, velocity); lastC[4][1] =7; } //Write Midi Note Off if ((keysC[4][1] ==1) and (lastC[4][1] ==7)) { MidiSend(noteOn3, 56, velocity); lastC[4][1] =0; } //C57 if ((keysC[4][2] ==0) and (lastC[4][2] ==0)) { MidiSend(noteOff3, 57, velocity); lastC[4][2] =7; } //Write Midi Note Off if ((keysC[4][2] ==1) and (lastC[4][2] ==7)) { MidiSend(noteOn3, 57, velocity); lastC[4][2] =0; } //C58 if ((keysC[4][3] ==0) and (lastC[4][3] ==0)) { MidiSend(noteOff3, 58, velocity); lastC[4][3] =7; } //Write Midi Note Off if ((keysC[4][3] ==1) and (lastC[4][3] ==7)) { MidiSend(noteOn3, 58, velocity); lastC[4][3] =0; } //C59 if ((keysC[4][4] ==0) and (lastC[4][4] ==0)) { MidiSend(noteOff3, 59, velocity); lastC[4][4] =7; } //Write Midi Note Off if ((keysC[4][4] ==1) and (lastC[4][4] ==7)) { MidiSend(noteOn3, 59, velocity); lastC[4][4] =0; } //C60 if ((keysC[4][5] ==0) and (lastC[4][5] ==0)) { MidiSend(noteOff3, 60, velocity); lastC[4][5] =7; } //Write Midi Note Off if ((keysC[4][5] ==1) and (lastC[4][5] ==7)) { MidiSend(noteOn3, 60, velocity); lastC[4][5] =0; } //C61 if ((keysC[5][0] ==0) and (lastC[5][0] ==0)) { MidiSend(noteOff3, 61, velocity); lastC[5][0] =7; } //Write Midi Note Off if ((keysC[5][0] ==1) and (lastC[5][0] ==7)) { MidiSend(noteOn3, 61, velocity); lastC[5][0] =0; } //C62 if ((keysC[5][1] ==0) and (lastC[5][1] ==0)) { MidiSend(noteOff3, 62, velocity); lastC[5][1] =7; } //Write Midi Note Off if ((keysC[5][1] ==1) and (lastC[5][1] ==7)) { MidiSend(noteOn3, 62, velocity); lastC[5][1] =0; } //C63 if ((keysC[5][2] ==0) and (lastC[5][2] ==0)) { MidiSend(noteOff3, 63, velocity); lastC[5][2] =7; } //Write Midi Note Off if ((keysC[5][2] ==1) and (lastC[5][2] ==7)) { MidiSend(noteOn3, 63, velocity); lastC[5][2] =0; } //C64 if ((keysC[5][3] ==0) and (lastC[5][3] ==0)) { MidiSend(noteOff3, 64, velocity); lastC[5][3] =7; } //Write Midi Note Off if ((keysC[5][3] ==1) and (lastC[5][3] ==7)) { MidiSend(noteOn3, 64, velocity); lastC[5][3] =0; } //C65 if ((keysC[5][4] ==0) and (lastC[5][4] ==0)) { MidiSend(noteOff3, 65, velocity); lastC[5][4] =7; } //Write Midi Note Off if ((keysC[5][4] ==1) and (lastC[5][4] ==7)) { MidiSend(noteOn3, 65, velocity); lastC[5][4] =0; } //C66 if ((keysC[5][5] ==0) and (lastC[5][5] ==0)) { MidiSend(noteOff3, 66, velocity); lastC[5][5] =7; } //Write Midi Note Off if ((keysC[5][5] ==1) and (lastC[5][5] ==7)) { MidiSend(noteOn3, 66, velocity); lastC[5][5] =0; } //C67 if ((keysC[6][0] ==0) and (lastC[6][0] ==0)) { MidiSend(noteOff3, 67, velocity); lastC[6][0] =7; } //Write Midi Note Off if ((keysC[6][0] ==1) and (lastC[6][0] ==7)) { MidiSend(noteOn3, 67, velocity); lastC[6][0] =0; } */ //Expression Pedal controls //Expression pedal on analog pin A13 to Channel 6 int Cur6 =analogRead(13); int Map6 =map(Cur6, 0, 1023, 0, 127); if (abs(Cur6 - LastPot6)>=8) { MidiSend(chan6,Exp,Map6); LastPot6 =Cur6; } //Expression pedal on analog pin A14 to Channel 7 int Cur7 =analogRead(14); int Map7 =map(Cur7, 0, 1023, 0, 127); if (abs(Cur7 - LastPot7)>=8) { MidiSend(chan7,Exp,Map7); LastPot7 =Cur7; } //Expression pedal on analog pin A15 to Channel 8 int Cur8 =analogRead(15); int Map8 =map(Cur8, 0, 1023, 0, 127); if (abs(Cur8 - LastPot8)>=8) { MidiSend(chan8,Exp,Map8); LastPot8 =Cur8; }}void MidiSend(int one, int two, int three) { Serial.write(one); Serial.write(two); Serial.write(three); }

示意图

Wiring diagram for 6x11 Matrix keyboards and pedalboard with potentiometer inputsWiring diagram for Bussed keyboards with potentiometer inputs

制造工艺

  1. 软件组件的 ISO 26262 认证
  2. Eclipse Ditto 1.0:数字孪生构建者的框架
  3. 物联网中基于云的软件更新的组件
  4. 地毯行业切割解决方案——数字切割机
  5. 数字资产管理策略
  6. UL:测试塑料组件的易燃性
  7. 4 种粘合塑料部件的基本技术
  8. 用于汽车外饰部件的玻璃填充 PET
  9. 向您的经理推销数字营销(对于制造商)
  10. 2020 年的三大数字化制造趋势
  11. 数字化转型的成功计划
  12. Invar 36 组件的材料