Good stuff and helpful as I'm getting a Leonardo today to start prototyping. I disagree about using the noteOn function to turn off the note, especially when you have a noteOff function. Then you also have a comment when you shouldn't need one.
A great idea and implementation. I did the control on the Arduino Pro Micro. If this connect after Ableton Live (11) running, then everything works. If the device is connected before starting Ableton Live (11), then no commands work until the device is reconnected. Then everything is fine again. That is, Ableton does not see an already connected device. Can this be fixed?
it is not straightforward that the code works with my teensy 4.0, i get an error, why? board is selected, usb port is selected, usb type midi is selected. code uploads but nothing appears in the serial monitor. also, the imported functions are generating some conflict apparently.
I got in mind to create a node for a midi hub that keeps a copy of the simple script for the 16 channels plus editable globals of setups of the midi devices. This idea is a resolve so I do not have to pay for espensive subscriptions on my iPad for apps that do this. No knowledge on how to do that but that is what I have in mind. It seems a good resolve especially if I can extend the script over time so it becomes an app that facilitates other functions associated with my array midi devices.
You want to call fliush as fast as you can after you get a read, so ideally every time hit a note. If you call at the end, imagine you have 100 buttons, you'll only hear that note you played after it finishes readin all the notes, besides it will play at the same time all the note you played during that loop.
@@NerdMusician I meant, if you moved the flush INTO the noteOn function, at the very end of its. That would be functionally equivalent to where you’ve placed it, would it not? But you wouldn’t have to remember to use it whenever you call noteOn, as it would be built in. It’s been a while since my coding years, and this wasn’t a language I used professionally, so I may be making incorrect assumptions.
@@_just_looking_thank_you Because USB work on packets, the data is first set in the buffer and when the Host request the data then is sended (remember, the host controller is also listening your keyboard, mouse, etc), that is why you can't send one-by-one because can increase the delay to wait the next request when you have to send multiple notes. By using flush() declare the data is ready to send and then force that.
hello so good video, but unfortuly i'm not avaible to understand correctly, arduino code. i need and want to make my personnal midi usb light console, like apc 40, running into sunlite suite software, who is DMX software.is this will cost me a lot of money to order you a complete running arduino code attached to a shematics i could design. hoping your answer. best regards philippe from france
Wow sounds great. Do you think the library I can have midi out AND midi in on the Arduino ? So then if I connect it to a midi cable usb on the arduino side and a split midi in/out cable to an instrument then I can send a command to the arduino interactivelly ?
It can. I do teach how to do this inside my course. With this Arduino it's tricky because you have to use the MIDIUSB lib for the USB and the MIDI libr for the midi din, so two libs at the same time.
Mano, tô usando uma esp32, uma placa Touch e somente 10ms de delay no loop, mas parece mais quando conecto com o FL Studio mobile. O que vocês tem usado? Com USB tem menos delay?
I can't find any model "usb midi class compliant' with 16 analog inputs or more ..... Must i go on a impossible to find teensy or use a multiplexor ? seems terrifying
Yes. haha You already know the answer. Teensy is easy though. And I teach how to use multiplexers easily in my MMwA course: www.musiconerd.com/making-music-with-arduino/
@@NerdMusician Yes, it's something I'm looking forward to trying too! It could open many doors... although it may create delay, it may be worth trying... midi+osc... I would like to create my own osc interface... I don't know how yet but will try it out! I love your work man, it's awesome !! You're a big inspiration !!
@@NerdMusician thanks for that link. I haven’t been able to get that code to work so far. Have the header and cpp files in the same directory as the ino file, and have added the include etc to the code, as it says to do in the readme. No errors when compiling, but no name change. Hmmm.
is not so hard, this code i use interupt, you can delete interupt, but you may miss some pulses specialy if you rotate to fast // Rotary Encoder Inputs #define CLK 2 #define DT 3 #include "MIDIUSB.h" int counter = 0; int currentStateCLK; int lastStateCLK; void setup() { // Set encoder pins as inputs pinMode(CLK, INPUT); pinMode(DT, INPUT); // Setup Serial Monitor Serial.begin(9600); // Read the initial state of CLK lastStateCLK = digitalRead(CLK); // Call updateEncoder() when any high/low changed seen // on interrupt 0 (pin 2), or interrupt 1 (pin 3) attachInterrupt(0, updateEncoder, CHANGE); attachInterrupt(1, updateEncoder, CHANGE); } void loop() { //Do some useful stuff here midiEventPacket_t rx = MidiUSB.read(); switch (rx.header) { case 0: break; //No pending events case 0xB: updateEncoder( rx.byte1 & 0xF, //channel rx.byte2, //cc rx.byte3 //value ); break; } } void updateEncoder(byte channel, byte number, byte velocity) { // Read the current state of CLK currentStateCLK = digitalRead(CLK); // If last and current state of CLK are different, then pulse occurred // React to only 1 state change to avoid double count if (currentStateCLK != lastStateCLK && currentStateCLK == 1) { // If the DT state is different than the CLK state then // the encoder is rotating CCW so decrement if (digitalRead(DT) != currentStateCLK) {
controlChange(1, 25, 127); // (channel, CC number, CC value) MidiUSB.flush();
} else { controlChange(1, 25, 1); // (channel, CC number, CC value) MidiUSB.flush();
Arduino Uno funciona, mas precisa de umas gambiaraas a mais, então não aconselho e nem ensino mais a usar o Uno, só o Leonardo, Pro Micro e a família Teensy. A menos que seja o novo Uno R4!
Hi.! Where do i find all the functions for the MidiUSB library? Total Noob here, but i am watching your videos everyday and learing a lot.! Your videos deserve a hell lot more of views!
The code of the course, it doesn't work for the arduino UNO, needs an updated, because the pages is deleted, how can i make the compliant for arduino UNO
@@eDrumsInANutshell in the course that i bought of NerdMusician, i don't speak of the video, but i dont found a place where can i put my comments in the course, and the video is related to the course and the comunication of the ATMEGA328 and the computer, for that i put my comment, learn to read
@MejoradoLopezJonathan Learn to write! How could I know that you did a paid course? Hopefully, when I do a paid course, I have another possibility to contact him, then a tiny comment.
@@eDrumsInANutshell You don't need to know, because my comment was for the author of the course, who is the owner of the RUclips channel, because he didn't answer the emails, my comment was for him, not for just anyone like You🤷
@@NerdMusician Thanks! Very nice as well. I have used this Pro Micro on another project, a gamepad, but since then its was unuseful. Previously, MIDI project only with Arduino Mega.
Wonderfully explained!
Valeu Nerd! isso me ajudou a compreender como funciona a biblioteca, pretendo colocar-o em um órgão antigo que restaurei
\o
So nice. Is it possible to Change the Identifier/Name of the Midi USB device as found by your DAW?
Excited for this one!
\o
Good stuff and helpful as I'm getting a Leonardo today to start prototyping.
I disagree about using the noteOn function to turn off the note, especially when you have a noteOff function. Then you also have a comment when you shouldn't need one.
And that, my friends, is how jazz was discovered :)
A great idea and implementation.
I did the control on the Arduino Pro Micro. If this connect after Ableton Live (11) running, then everything works. If the device is connected before starting Ableton Live (11), then no commands work until the device is reconnected. Then everything is fine again. That is, Ableton does not see an already connected device. Can this be fixed?
Muito bom. Tem como ele comunicar aparelho midi de 5 pino para midi usb
Tem sim, dá pra colocar conector MIDI tradicional.
@@NerdMusician eu to querendo fazer a comunicação da fcb1010 para usb. Tem como mim ajudar. A fcb 1010 so tem midi de 5 pino
Is the ESP32 work with MIDI-USB?
Thanks!
it is not straightforward that the code works with my teensy 4.0, i get an error, why? board is selected, usb port is selected, usb type midi is selected. code uploads but nothing appears in the serial monitor. also, the imported functions are generating some conflict apparently.
I got in mind to create a node for a midi hub that keeps a copy of the simple script for the 16 channels plus editable globals of setups of the midi devices. This idea is a resolve so I do not have to pay for espensive subscriptions on my iPad for apps that do this. No knowledge on how to do that but that is what I have in mind. It seems a good resolve especially if I can extend the script over time so it becomes an app that facilitates other functions associated with my array midi devices.
If a call to the flush function is required after each call to noteOn, why not simply embed a call to flush at the end of the noteOn function’s code?
You want to call fliush as fast as you can after you get a read, so ideally every time hit a note. If you call at the end, imagine you have 100 buttons, you'll only hear that note you played after it finishes readin all the notes, besides it will play at the same time all the note you played during that loop.
@@NerdMusician I meant, if you moved the flush INTO the noteOn function, at the very end of its. That would be functionally equivalent to where you’ve placed it, would it not? But you wouldn’t have to remember to use it whenever you call noteOn, as it would be built in.
It’s been a while since my coding years, and this wasn’t a language I used professionally, so I may be making incorrect assumptions.
@@_just_looking_thank_you Because USB work on packets, the data is first set in the buffer and when the Host request the data then is sended (remember, the host controller is also listening your keyboard, mouse, etc), that is why you can't send one-by-one because can increase the delay to wait the next request when you have to send multiple notes. By using flush() declare the data is ready to send and then force that.
hello so good video, but unfortuly
i'm not avaible to understand correctly, arduino code. i need and want to make my personnal midi usb light console, like apc 40, running into sunlite suite software, who is DMX software.is this will cost me a lot of money to order you a complete running arduino code attached to a shematics i could design. hoping your answer. best regards philippe from france
friend we got an arduino with dvs timecode feature in serato
Wow sounds great. Do you think the library I can have midi out AND midi in on the Arduino ? So then if I connect it to a midi cable usb on the arduino side and a split midi in/out cable to an instrument then I can send a command to the arduino interactivelly ?
It can. I do teach how to do this inside my course. With this Arduino it's tricky because you have to use the MIDIUSB lib for the USB and the MIDI libr for the midi din, so two libs at the same time.
Mano, tô usando uma esp32, uma placa Touch e somente 10ms de delay no loop, mas parece mais quando conecto com o FL Studio mobile. O que vocês tem usado? Com USB tem menos delay?
Hi, is it running on arduino uno pls ?
I can't find any model "usb midi class compliant' with 16 analog inputs or more .....
Must i go on a impossible to find teensy or use a multiplexor ? seems terrifying
Yes. haha You already know the answer. Teensy is easy though. And I teach how to use multiplexers easily in my MMwA course: www.musiconerd.com/making-music-with-arduino/
how to download the sketch, and the schematic, please help me
Have you tried the link in the description?
Hi, have you done midi + osc for wireless controllers ?
I Onloy have used OSC with my phone with the TouchOSC app. I know one can use OSC with the Arduino too, though! I'll have to give it a try.
@@NerdMusician Yes, it's something I'm looking forward to trying too! It could open many doors... although it may create delay, it may be worth trying... midi+osc... I would like to create my own osc interface... I don't know how yet but will try it out! I love your work man, it's awesome !! You're a big inspiration !!
Will you be talking about multiplexing in this video?
I would really like to make a midi controller with 64 buttons.
In this video no, only about the MIDIUSB lib. Multiplexers I cover in my course: www.musiconerd.com/making-music-with-arduino/
Does anyone know if there is a way to change the USB MIDI device name? By default it’s always ‘Arduino Leonardo’. Would be good to change that.
I'll prob cover this in a later video but this: github.com/mon/Arduino-USB-Rename
@@NerdMusician thanks for that link. I haven’t been able to get that code to work so far. Have the header and cpp files in the same directory as the ino file, and have added the include etc to the code, as it says to do in the readme. No errors when compiling, but no name change. Hmmm.
how can implement encoders??? and how can add some buttons ?
is not so hard, this code i use interupt, you can delete interupt, but you may miss some pulses specialy if you rotate to fast
// Rotary Encoder Inputs
#define CLK 2
#define DT 3
#include "MIDIUSB.h"
int counter = 0;
int currentStateCLK;
int lastStateCLK;
void setup() {
// Set encoder pins as inputs
pinMode(CLK, INPUT);
pinMode(DT, INPUT);
// Setup Serial Monitor
Serial.begin(9600);
// Read the initial state of CLK
lastStateCLK = digitalRead(CLK);
// Call updateEncoder() when any high/low changed seen
// on interrupt 0 (pin 2), or interrupt 1 (pin 3)
attachInterrupt(0, updateEncoder, CHANGE);
attachInterrupt(1, updateEncoder, CHANGE);
}
void loop() {
//Do some useful stuff here
midiEventPacket_t rx = MidiUSB.read();
switch (rx.header) {
case 0:
break; //No pending events
case 0xB:
updateEncoder(
rx.byte1 & 0xF, //channel
rx.byte2, //cc
rx.byte3 //value
);
break;
}
}
void updateEncoder(byte channel, byte number, byte velocity) {
// Read the current state of CLK
currentStateCLK = digitalRead(CLK);
// If last and current state of CLK are different, then pulse occurred
// React to only 1 state change to avoid double count
if (currentStateCLK != lastStateCLK && currentStateCLK == 1) {
// If the DT state is different than the CLK state then
// the encoder is rotating CCW so decrement
if (digitalRead(DT) != currentStateCLK) {
controlChange(1, 25, 127); // (channel, CC number, CC value)
MidiUSB.flush();
} else {
controlChange(1, 25, 1); // (channel, CC number, CC value)
MidiUSB.flush();
}
}
// Remember last CLK state
lastStateCLK = currentStateCLK;
}
void controlChange(byte channel, byte control, byte value) {
midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value};
MidiUSB.sendMIDI(event);
}
ruclips.net/video/9_dGC5XdQWc/видео.html I teach buttons here. Encoders I teach inside the course: www.musiconerd.com/nerd-musician-pro/
Eu tenho um Arduino Uno e um shield USB host. Serve?
Arduino Uno funciona, mas precisa de umas gambiaraas a mais, então não aconselho e nem ensino mais a usar o Uno, só o Leonardo, Pro Micro e a família Teensy.
A menos que seja o novo Uno R4!
@@NerdMusician Valeu. Eu consegui fazer funcionar aqui, trocando o firmware do controlador da USB.
Hi.! Where do i find all the functions for the MidiUSB library? Total Noob here, but i am watching your videos everyday and learing a lot.! Your videos deserve a hell lot more of views!
Documentation for the library. Also you can look at the code to see what is available.
Did you ever find a list, I've looked everywhere and can't find anything.
@@rootsnoir9164 I used chatgpt and figured out 🤣🤣
First 🥇🏆😍
\o/
How do you send chords?
One note after the other without a delay. It sends so fast that you don't notice that it's not exactly at the same time.
The code of the course, it doesn't work for the arduino UNO, needs an updated, because the pages is deleted, how can i make the compliant for arduino UNO
Dude, you have the listen. He said, it's for Arduinos mit ATMega32U4 controller.... 😂
@@eDrumsInANutshell in the course that i bought of NerdMusician, i don't speak of the video, but i dont found a place where can i put my comments in the course, and the video is related to the course and the comunication of the ATMEGA328 and the computer, for that i put my comment, learn to read
@MejoradoLopezJonathan Learn to write! How could I know that you did a paid course?
Hopefully, when I do a paid course, I have another possibility to contact him, then a tiny comment.
@@eDrumsInANutshell You don't need to know, because my comment was for the author of the course, who is the owner of the RUclips channel, because he didn't answer the emails, my comment was for him, not for just anyone like You🤷
@@MejoradoLopezJonathan Aha, might all be true. But still... Weired thoughts, dude.
This library dispenses the use of a middleware such as Hairless MIDISerial / ttymidi?
Yes!
@@NerdMusician Thanks! Very nice as well. I have used this Pro Micro on another project, a gamepad, but since then its was unuseful. Previously, MIDI project only with Arduino Mega.