Open dimitrios73gr opened 3 years ago
im working in the same thing. we need use midi control change(CC) 1 for modulation wheel https://www.noterepeat.com/articles/how-to/213-midi-basics-common-terms-explained so we neeed figure out how send this control change message. im considering use this library: https://github.com/arduino-libraries/MIDIUSB/blob/master/examples/MIDIUSB_write/MIDIUSB_write.ino https://github.com/silveirago/DIY-Midi-Controller/blob/master/Code%20-%20c%C3%B3digo/en-DIY_midi_controller/en-DIY_midi_controller.ino i know it will became a rats nast but if works its fine for me
void send_midi_eventcc(byte status_byte, byte key_index, unsigned long time) { unsigned long t = time;
char out[32]; sprintf(out, "%02X %02X %03d %d", status_byte, key_index, vel, t); Serial.println(out);
Serial.write(status_byte); Serial.write(key_index); Serial.write(t);
} const int N_POTS = 1; // número total de pots (slide e rotativo) const int POT_ARDUINO_PIN[N_POTS] = {A0, A1}; // pinos de cada pot conectado diretamente ao Arduino int potCState[N_POTS] = {0}; // estado atual da porta analogica int potPState[N_POTS] = {0}; // estado previo da porta analogica int potVar = 0; // variacao entre o valor do estado previo e o atual da porta analogica int midiCState[N_POTS] = {0}; // Estado atual do valor midi int midiPState[N_POTS] = {0}; // Estado anterior do valor midi const int TIMEOUT = 300; // quantidade de tempo em que o potenciometro sera lido apos ultrapassar o varThreshold const int varThreshold = 100; // threshold para a variacao no sinal do potenciometro boolean potMoving = true; // se o potenciometro esta se movendo unsigned long PTime[N_POTS] = {0}; // tempo armazenado anteriormente unsigned long timer[N_POTS] = {0}; // armazena o tempo que passou desde que o timer foi zerado
byte cc = 1; //* O mais baixo MIDI CC a ser usado voidsetup
void loop for (int i = 0; i < N_POTS; i++) { // Faz o loop de todos os potenciômetros
potCState[i] = analogRead(POT_ARDUINO_PIN[i]);
midiCState[i] = map(potCState[i], 450, 880, 0, 127); // Mapeia a leitura do potCState para um valor utilizável em midi
potVar = abs(potCState[i] - potPState[i]); // Calcula o valor absoluto entre a diferença entre o estado atual e o anterior do pot
if (potVar > varThreshold) { // Abre o portão se a variação do potenciômetro for maior que o limite (varThreshold)
PTime[i] = millis(); // Armazena o tempo anterior
}
timer[i] = millis() - PTime[i]; // Reseta o timer 11000 - 11000 = 0ms
if (timer[i] < TIMEOUT) { // Se o timer for menor que o tempo máximo permitido, significa que o potenciômetro ainda está se movendo
potMoving = true;
}
else {
potMoving = false;
}
if (potMoving == true) { // Se o potenciômetro ainda estiver em movimento, envie control change
if (midiPState[i] != midiCState[i]) {
send_midi_eventcc(0xB0, cc+ i, midiCState[i]);
potPState[i] = potCState[i]; // Armazena a leitura atual do potenciômetro para comparar com a próxima
midiPState[i] = midiCState[i];
}
}
}
try this its working for me
for pitch bend change to this send_midi_eventcc(0xE0, cc+ i, midiCState[i]);
for pitch bend change to this send_midi_eventcc(0xE0, cc+ i, midiCState[i]);
Thank you very very much for your help!!!!...I will try it soon and I will respense to you!!!...one last thing...the code you send me in which place of the original code i must add...I mean at wich line i must insert the code...Sorry for bothering you but i dont know much about programming...que tenga un lindo día...Gracias por tu ayuda
Check my fork, there you can see the code https://github.com/andersonbruno02/keyboardscanner
for pitch bend change to this send_midi_eventcc(0xE0, cc+ i, midiCState[i]);
Check my fork, there you can see the code https://github.com/andersonbruno02/keyboardscanner
Perfect!!!!!....Thanks you very much for your fast response and your help....I will try it all together and I will tell you the results....
Hello, Everything is working except PEDAL...I connect the one leg of push button on pin 21 and the other leg to gnd..Do I need to use resistor between pedal pin 21 (SCL MEGA2560) and ground?...not working at all..any other setting?...
also I see an error on code (see attached photo)
Thanks in advance
Hi. Do I need to use hairless midi and loop midi with this? I tried this and I get nothing... Without using hairless midi...
Is there a way to use this code with a teensy lc instead?
On Mon, Mar 8, 2021, 6:58 AM dimitrios73gr @.***> wrote:
Hello ,I made a midi velocity sensitive keyboard from an old casio ctk-691..The code is awesome and working 100%. I want to add a pitch bend and a modulation wheel but i dont know the code to do that... Please help me if you know..thanks in advance...
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/oxesoft/keyboardscanner/issues/13, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKN773ZWXFXKWVDVE2WEZSLTCS3WVANCNFSM4YZIUGIA .
yes you need use hairless and loop mid because my arduino dont have native usb port... i think original arduino mega with custom firmeware can use usb native ports but also arduino leonardo and arduino due have native out of the box. im not shure about teensy boards, but perhaps you can try make your own code with this: https://github.com/silveirago/DIY-Midi-Controller/blob/master/Code%20-%20c%C3%B3digo/en-DIY_midi_controller/en-DIY_midi_controller.ino
about the pedal just delete this error line byte pedal = LOW; im ajusting this on my code as well. thanks!
also theres a better way to use the pedal. using the midi control change i will be implementing this very soon
also theres a better way to use the pedal. using the midi control change i will be implementing this very soon
Hello,sorry for bothering you again...Pedal is not working at all....(MEGA 2560,DIO2 1.5.1I... connect one wire from button to pin21 (SCL) and the other button cable to arduino gnd without any resistor...is this correct?...Do I need any wire from switch to 5V?
try the new code: https://github.com/andersonbruno02/keyboardscanner is control change now. im using the internal pullup resistor from arduino, no need add more resistors. only a conection to the pin and ground you also can try change the port see if makes diference
try the new code: https://github.com/andersonbruno02/keyboardscanner is control change now. im using the internal pullup resistor from arduino, no need add more resistors. only a conection to the pin and ground you also can try change the port see if makes diference
THANKS THANKS!!!!...Its working!!!!...Now I can start my project..A mini atx pc inside my broken casio ctk-651 with usb audio midi soundcard so I can create a synth and sampler with vsti etc...thenks alo for your help...
coba kode baru: https://github.com/andersonbruno02/keyboardscanner adalah perubahan kontrol sekarang. im menggunakan resistor pullup internal dari arduino, tidak perlu menambahkan lebih banyak resistor. hanya koneksi ke pin dan ground Anda juga dapat mencoba mengubah port, lihat apakah ada bedanya
Periksa garpu saya, di sana Anda dapat melihat kode https://github.com/andersonbruno02/keyboardscanner
hi anderson can you help me ... i have a roland em 20 keyboard ... i want to convert it to a midi controller ... i have tried to make it but it doesn't work, the problem is roland em 20 has 2 16x16 bands,, i have succeeded in making the first ribbon but when i try for the 2nd ribbon it makes everything random.. can you help me
hi... I've seen the code on this page, but I don't see or read which pins will be used for the keyboard keys, so I'm still confused, which pins to use??? can anyone give me help me here???
I have a broken Roland 61 key keyboard, I want to make it a midi controller, can I use the code shared on this page??? And do I have to change the code first???
I have a broken Roland 61 key keyboard, I want to make it a midi controller, can I use the code shared on this page??? And do I have to change the code first???
The code shared in this page if for making pitch bend and modulation wheel work in the respective repository's code. Please follow the instructions in https://github.com/oxesoft/keyboardscanner and bring your keyboard back to life.
experimente o novo código: https://github.com/andersonbruno02/keyboardscanner o controle muda agora. estou usando o resistor pullup interno do arduino, não preciso adicionar mais resistores. apenas uma conexão com o pino e o aterramento. você também pode tentar mudar a porta para ver se faz diferença.
Anderson, você tem alguma dica para mim adicionar 8 faders e 8 potenciometros e 8 botoes para controlar as layers da daw?
Hello,
your code is perfect and helped me to convert a velocity sensitive keyboard from an old casio ctk-691 to midi..The code is awesome and working 100%. I want to add a pitch bend and a modulation wheel but i dont know the code to do that... Please help me if you know..thanks in advance...