MIDI pitch BEND Casio CT 670

255 / 5.000

Resultados de tradução

Resultado da tradução

Greetings to everyone, I'm new to the world of Arduino but I successfully managed to bring my old Casio Ct 670 back to life by transforming it into a MiDI controller, the question is, is there any way to include the pithbend to work together? Below is the code used..

#include <MIDI.h>
#include <Keypad.h>

const byte ROWS = 11; // 11 Linhas
const byte COLS = 6; // 6 Colunas
 
char keys[COLS][ROWS] = {

  {24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34},
  {35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45},
  {46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56},
  {57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67},
  {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78},
  {79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89}

};

byte rowPins[ROWS] = {2, 3, 4, 5, 6, 13, A0, A1, A2, A3, A4}; //connect to the row pinouts of the kpd
byte colPins[COLS] = {7,8,9,10,11,12}; //connect to the column pinouts of the kpd

 
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

byte pressed = 32;
byte chanel = 0; // MIDI channel to use

void setup() {
 Serial.begin(115200); // set this the same as Hairless
}


void loop() {
 // Fills kpd.key[49] array with up-to 10 active keys.
 // Returns true if there are ANY active keys.

 if (kpd.getKeys())
 {
   for (int i = 0; i < LIST_MAX; i++) // Scan the whole key list.
   {
     if ( kpd.key[i].stateChanged )   // Only find keys that have changed state.
     {
       pressed = kpd.key[i].kchar + 12;
       switch (kpd.key[i].kstate) {  // Report active key state : IDLE, PRESSED, HOLD, or RELEASED
         case PRESSED:
           sendMIDI(chanel | 0x90, pressed, 100);
           break;
          case RELEASED:
           sendMIDI(chanel | 0x80, pressed, 64);
           break;
       }
     }
   }
 }
}  // End loop

void sendMIDI(byte type, byte note, byte velocity){
  Serial.write(type);
  Serial.write(note & 0x7F);
  Serial.write(velocity);
}

Welcome to the forum.

To add pitch bend to your code you first need something to control it. While a rotary potentiometer might do, you have the problem of getting the pitch bend back to zero, that is how to stop it.

So i would suggest the best thing to get is a joystick. Then wire the joystick to the analogue to digital converter. Then take the reading when the joystick is central, this is your reference point. Then any reading above or below that point you can send a pitch bend message. Note you only need to use one dimension of the joystick not both.

Hello, thank you for responding, my keyboard is a Casio ct-670, it already has the pithbend wheel with the potentiometer and the spring, what I need to know is how to make it work in the code

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.