I have been a programmer for 30 years, and this has to be the BEST coding tutorial I've ever seen! Even despite the need to yell "SEMICOLON" at the screen.
Yes but also he could have made it a bit easier to remap later by assigning his channels and notes and velocities in variables before running the variables into the midi function.
I know yall know he isnt an idiot and probably knows more about coding than he lets on....which is brilliant, really, considering he ends up making entertaining for everyone watching.
The fact that you do not know what a semi colon is, and yet still do what you do with such proficiency lights the way for a huge amount of people who feel they lack the intelligence or ability's due to poor education or life circumstance, keep it up and keep encouraging the people of the world, you are an inspiration.
For anyone planning on doing this, at 14:41 he says that there are better ways to do it and he's right! I'm making one right now, and I am restricted as I only have 8 buttons so i came up with a cool idea to share: Use arrays! Have your buttons be stored in some array like int buttons = [ 0,1,2,3,4,5,6,7] ( the pin numbers of your buttons). Then comes the magic. You can have separate arrays for each scale! so for instance you could do something like int Phrygian = [whole/half tone steps away from base note]; int Locrian = [ same thing for locrian] etc.. int Modes = [Phrygian, Locrian...] Then have an array with the base notes: int Keys = [midi for C, midi for D, midi for E... so on]. Now in your logic you can have a variable for what mode you are in, and what key you are in: currentKey = 1; currentMode = 2; And now to send a note you can go through each button and if it is on, add the key youre in to the note on that mode! for(int btn = 0; btn < 8; i++){ if(digitalRead(buttons[btn]) == HIGH){ midi.write( (Keys[currentKey] + Modes[currentMode][ btn ] ); } } Now you can have a knob or button to allow you to switch between keys and modes and your keyboard will only play in the key and mode selected! [for any aspiring coders out here, if you find yourself rewriting alot of the same code, try to find a solution with functions and arrays. Notice how i took his 10 if/else statements and reduced them to just a small loop and a few arrays. And the best part is, if you want to change a note or key or something, you just have to change it in the array and not in each if statements :) ]
They really did a great job with midi. It’s just been the same connector and data standard forever. Even the new mpe keyboard I got is still just midi over usb but using some extra channels for all the extra expression info.
@@LOOKMUMNOCOMPUTER nothing wrong with the mini jack, but they are asking like 20€ for (... or something around that) for a original Arturia jack to din converter. than the fact you can loose it.
They even made a nice MIDI 2.0 version in 2020 with better resolution and nice new options but keeping it backwards compatible with the old MIDI. I love these guys, nice simple standard without the BS.
I did basically this same kind of project with a set of organ pedals many years ago and found something interesting. I always wondered why the MIDI serial port rate was 31,250 baud - kind of a weird number. More typical would be 9600,19200, 38400... turns out 31,250 is the fastest baud rate you can send from a 20MHz 8051 (which is what I was using for my project). So I'm betting that is the original processor they used for the prototypes :)
I've programed for too many years and this tutorial was pretty good like the code was kinda ugly and he didn't know the name of a lot of the symbols, but he explained it really well and I was kinda blown away with how simple it was with the midi library
@@LOOKMUMNOCOMPUTER You're like a mad scientist without a dictionary. If you get the stuff done, it doesn't matter. Comments are great if you can remember them. Some of the functions are pretty intuitive. I don't know this program AT ALL, but took C++ back in the day, so I'm looking at the code and thinking, "oh yeah, this makes sense, I can read it!"
@@LOOKMUMNOCOMPUTER if you have a midi keyboard like the one you showed first if its already broken some keys couldnt you take all the guts out and build a interface like this and weld a button to each of the key you want.. and you can keep the faders and rotary aswell just change to another enclosure
Before embarking on this project get more info on the project page www.lookmumnocomputer.com/projects#/super-simple-midi-keyboard please remember yes this code is clunky, but its designed to not assume people know about arrays etc, its laid out in a linear fashion which i believe is easier to understand, and regarding the code being inefficient, it really doesn't matter in this application. sure if we are doing something that stretches an arduino's function but this is not one of those time.
Another lovely Jubbley project. I have been following you since around 2016 I believe and your stuff is getting more amazing all the time. Thank you for your mad scientist contributions; your work is highly inspiring and appreciated. Just wanted to take a moment to say keep up the good work!
LOOK MUM A COMPUTER. Anyway very cool video for newbies in DIY. Arduino is probably best thing to happened for the DIY scene. Makes really hard IC controllers (most often in assembly-type language) programming a breeze. Keep up the good work.
Thank you 🙏. Please make more simple DIY’s. I’ve been subscribed for a long time and have always drooled over the the idea of making my own creation!!! This is the start!
Brilliant stuff, thanks for this - I can't believe MIDI is 40 years old! I often thought about doing something with a hand made MIDI controller but never realised how simple it is to do. Now I have a gazillion ideas rushing around my brain, can't wait to give this a try!
Some (a lot?) people find coding intimidating and it can be very intimidating. What you did here is awesome! You showed that it doesn't have to be hard. It doesn't need a huge amount of education (formal or otherwise). Who gives a poop if it's clean or "right". Literally JUST TRY IT! :) Nice work :)
On one hand I’m shouting words like “library” and “function” at the screen, but honestly, this is a brilliant intro to MIDI on arduino and that’s something I’ve wanted to get around to for 3 or 4 years and not got round to it. Thanks Sam - great video and really well explained.
This is PERFECT TIMING! I’ve been really keen to make an MPC arcade button controller, I was totally put off by the coding aspect. You’ve just changed my mind, thank you!
I was literally *just* about to buy a Midi Fighter today, and then spotted this video. The coding was the part that intimidated me about going diy, but after seeing this I think I'll give it a shot.
I like the way you showed the coding. When i was learning, it was a lot of. "Do this because i said so". you showed what the commands do and that the names of things don't matter, just that they match, and how the comments work.
Thanks for explaining how to make a midi keyboard! I am a programmer and you did a good job explaining it. I didn't realize how approachable MIDI was, would love to make my own controller now.
I'm just starting to put together some projects and experiment with Arduino. This video was very clear and simple and made me understand basic concepts. Logic makes a lot of sense, even if there are better ways to write the code this helped me to have autonomy when programming. Thanks!!
Just before Christmas i modified an old Yamaha organ keyboard - i rewired the keys as a 4x12 matrix and used an Arduino Micro to connect it to my Laptop. As the Micro has native USB support, it can act as a USB-MIDI device with no extra hardware! It takes just the Arduino, a few resistors and lots of wire.
When you use variables that just won't or especially if they shouldn't change, you should use preprocessor directives instead of actual variables. So instead of int button1 = 2; use #define BUTTON1 2 It doesn't have to be upper-case. That's just an unwritten rule that's written down very often (just not as an actual rule). You're already using preprocessor directives without knowing when you're writing stuff like INPUT_PULLUP, LOW, or HIGH. They're all over the place in Arduino. Using preprocessor directives for small datatypes should also save some memory which is very limited on microcontrollers. For that to be a problem you would have to make a project which is much more complex to run into problems there. But it also just makes sense that something that isn't variable shouldn't be A variable. With that in mind, you could also just make the variables constant with the const keyword, but that won't change anything on the memory side.
He can make an input array and a midi notes array, or he can define the input int range and the range of the midi notes, or he can define the base offset between the input numbers and the notes.. Out there is a principle called KISS
Except that #define is super risky to use, if you accidentally use the defined string as part of another string it will still replace it. For example: if you do #define a 1, and then write digitalRead();, it will be interpreted as digit1lRe1d(); const gets compiled perfectly and does not take up more memory than #define, so go for const. And more importantly: int is fine for beginners. use int.
@@DanielSimu Well, technically that's true, But if you use a more descriptive name than "a", something you should do anyway, it's just very unlikely that this will happen. And correct me if I'm wrong here, but the difference in memory use is that variables, const or not, are stored in RAM and literals, what preprocessor directives eventually become, won't. Every time you use a literal (as long as the number is small enough for a single word data type), it's taking up one word in flash and every time you're referencing a variable, the address also takes up one word in flash. So that's basically the same. So it depends on the question if you're running short on RAM while it won't help you much when you're running short on flash. Of course, that won't be much, but that's why I wrote it won't be a problem in smaller projects, so as you say, it's not a problem for beginners, but even beginners should start to learn good habits instead of unlearning what they've learned later. Even when I don't think about why this makes sense, I just look at how preprocessor directives are all over the place in Arduino itself at that they probably did it for a reason.
@@asp95video Yes, "keep it simple, stupid", but I don't see how using preprocessor directives isn't as simple using variables. Using arrays might be the more elegant solution, but my comment was more about variables vs preprocessor directives in general than about this particular case.
@@juschu85 Feel free to keep on using #define, but I disagree that it is unlikely to happen. For example, in this video there was an int button1 and an int button1beans, if the first had been #define button1 you would have gotten issues with the second. On a recent memory limit approaching project I had a look at replacing all the consts with #define just to test, and the arduino compiler showed no difference, the sizes were exactly the same. Why would the compiler treat a const differently anyway?
Sam you‘ re hard workin man. God bless you for your kind presence here on planet earth trying to entertain us with knowledge! knowledge is key to provide the world with a lot of empathy... and words or idioms are fuel for the brain to live the culture. I hope to see you at the superbooth, you’re a wonderful speaker, musician and inventor. greetings from a french guy with latin roots living in germany working in the software consulting business since 1996 (dedicated hip hop head since 76, making music back in 87 and now turned into a synthesizer and martial art lover). love ya mate!
this is exactly the kind of tutorial i want for everything ! show whats important , explain what it does with as few words as possible but pack everything important into it and keep it practical and entertaining :D
You got me at "dot squiggle" lol. As a C# dev, your code is copypasta, but good enough for someone new to get started like you said. Next step would be to put that repetitive code in a method and call it with parameters. It's amazing how simple doing midi on Arduino is, and this video gives me motivation to give it a go myself.
I liked your casual attitude. It makes the whole process, especially the programming, seem less intimidating. Good job! I've been building a MIDI expression pedal because keyboard velocity sensing is just not the same as turning up the volume, reverb, or vibrato. And who can do that with a knob while your hands are busy playing the keys?!
Dude. Thank you for this. I’m a 40 year old dude and all the physical stuff is easy for me to understand but I’ve always had trouble with code. I’ve got some Sanwa arcade buttons hanging out and I’m ready to build this. Thanks!!
could I just use a USB socket instead of the MIDI, to connect it to a DAW on the computer, or would I need an extra driver for that? GREAT video by the way =)
Thank you, thank you, thank you! I’ve been trying to piece together all this info through separate videos and tutorials, and look mum, it’s all HERE!!! You make the world a much more understandable place. Headed to Patreon to pay my course fee, haha!
Currently building this on an old lump of wood to use as a bass pedal to under my keyboard. I have 12 notes and have added 4 buttons for channel +/- and Octave +/-.......not sure how this will work yet, but fingers crossed. nice video, keeps the amatuers (like me) interested when its not all above our heads!
Groovy video! For a college Embedded Systems class project, I took a toy electronic keyboard and used an Arduino to connect it to a Yamaha YM2151 chip like classic arcade games like Street Fighter 2 used to use for sound. To this day I wish I made it MIDI-capable.
I really commend you going out of your way to go super in depth with the coding despite how it's the antithesis of your existence just to keep true to your goal to make this video a beginner's guide. big ups
Awesome instrucional vid as always, Sam! Just a minor criticism: per the MIDI hardware spec, there should be 220 ohm resistors on pins 4 and 5 of the DIN connector to prevent frying the input optocoupler on the synth you'll be connecting this to. Even though there SHOULD be a resistor inside the controlled synth, I reckon it's better to be safe than sorry. Keep up the amazing work!
Yeah al good tbh I was being lazy: I haven’t bothered so if someone is protective of their synth and I’m around with a midi controller I made don’t let me plug it in ha. I added 220r on the pic on the site when the vid went up al good
Thank you for this !!! You made it easy to understand, and that is the important thing for me. When I understand it, I can always streamline it in the future 😊👍
You are fing AWESOME!! Please give us more of this type of videos, I've been wanting to learn this stuff for so long, but it always confuses the hell out of me. Thank you brother.
Awesome tutorial. Been programming for years, but this was so much fun and super informative as I have never touched midi programming, but needed it for a project. Thanks a ton!
I love your teaching style. Did I already know how to use the arguing midi library? Well, yes, but getting there I did feel alone and a bit lost until I was able to get the hang of coding. Education is important!
Omg i loved this video. Im a long time game developer/teacher and i found this tutorial the most hilarious yet useful/engaging I've seen. It reminds me that you don't need fancy code to do amazing things. I really wanna try these. (And yeah there were many ways to optimize but is true that that way is easier for beginners (and 100 times more hilarious and creative)). (I watched this to get offended but failed) "There are no real rules at all!" love that, man ! You say you're not hackerman, but this seems like hacking to me.
Nice! I would strongly recommend to follow the midi standard and put a 220ohm resistor in series with the 5V wire to the midi connector. It will probably work without because there should be also a resistor on each midi in port too, but if both of them are omitted it will result in a blown optocoupler...
ofcourse, but almost everything has a resistor that has not been made by me so its ok haha. to be honest i usually never bother with opto couplers on the midi inputs haha. its just a digital signal stream, i have not come up an issue yet. obviously there can be issues but works for me :D. and when imake proper midi things i include optocouplers, but most of the time i just wire straight to midi socket on each sides
Yeah I was thinking the same. Agree you may not need it if you're just bodging your own projects together, but the issue here is that if you were to plug this into some proper synth you may blow up the optocoupler inside it if you exceed the max current of the LED :D.
@@LOOKMUMNOCOMPUTER I agree that for my own circuits, I often don't do "MIDI at the electrical layer" and just connect RX to TX on microcontrollers, and just "MIDI at the software/protocol layer", but as this is being called a MIDI keyboard and has a 5-pin DIN socket it looks for all outward purposes to be for connecting to other equipment, so isn't there a real chance of overloading an input circuit with no resistors? I think the issue is that the MIDI spec works on the basis of assuming a 5mA current loop, and the circuits suggest three resistors to get it - two on the output side, one on the input side. I am not an electronics person, but as I understand things, with an Arduino driving a MIDI circuit at 5V, using two 220 resistors on MIDI out and one 220 on MIDI in (at the other end) gives you 5/660 = 7.5mA (well it will be less as I've not included the diode Vf). But with no resistors in the MIDI out and just the one on the MIDI in, the current is 5/220 = 23mA (again actually less) but is four times higher than the MIDI spec says is required. Some opto-isolators on input circuits will be fine with this (the H11L1 for example has an input current limit of 60mA I believe). However some might be marginal, the commonly used 6N138 might have an input current limit of just 20mA, so any more would strictly speaking be too much for it. As with many things, I'm sure there is margin for error and you'd hope expensive equipment has input protections, so it may be fine. And I'm sure it isn't as simple as I'm saying here anyway (as I say, I'm not an electronics person and there are voltage drops involved across the diodes and things too). I often leave out the suggested buffers on outputs, but for the cost and effort of soldering in two resistors, why take that risk? Or at least, don't call it MIDI or use a 5-pin DIN socket, as a reminder to your future self? Kevin
@@SimpleDIYElectroMusicProjects sure I’ll add a disclaimer to the site and the project. But the margin for error is pretty chunky. Having done this a lot plugging into things I haven’t had any bad experiences but then again maybe that’s luck. A 6n138 for me has been fine for a lot above that. I mean in one project.. the drum trigger sequencer there are no resistors at all anywhere technically it would have burnt out years ago but going strong haha. I probably won’t change my behaviour towards it but I’ll mention it on the project page.
and thank you for taking the time to make these videos i just got around to learning how to solder, and this is definitely on my list of stuff to play with really love your work!
Is it possible to have a midi controller that is a modular patch bay with switches and knobs for virtual synths? It would be really cool to be able to use actual cables and knobs/faders with different programs.
I love this tutorial. Also as a coder, this was a great demonstration of arduino for beginners. My question is, as someone who makes a lot of instruments, do you recommend any buttons to be used as pads? I am not really a fan of arcade buttons, and want to make something like the old MPDs. So some form of larger rubber button (with pressure sensitivity for velocity).
MIDI's a beaut. I've got an old knackered-out (all synth chips dead) Yamaha Electone B35-N organ from the 70s knocking about that I'm waiting to convert into something mean. It's a lot of keys (two sets of 55 or something close to that maybe) with loads of pistons, pedals and levers to wire in. I've got a few candidate arduinos knocking about, but I haven't decided which one to use yet. Thanks for the inspiration needed to tackle the thing. The plan is to build a synth PC i've already prepared (forgive me) into the side. Can't wait to enter shift-register hell getting all those to work
Probably easier to use a load of I2C port expanders, you can put 4 or 8 on the bus depending on how many address channels they have and if you have a MEGA they have multiple I2C ports.
I've always wanted to know a simple way to make a custom MIDI pedal board to control my guitar effects. I didn't even know that Arduino had MIDI commands, as I've never used any microcontroller system but have always wanted to learn. I'll be looking into this for sure. Great video. :D
This has helped me no end, your teaching style is far more understandable than the books I have bought before that start with blink then expect you to know everything else. it has explained how i can build part of a larger project. Have you done a midi input video before?
Years ago I wanted to electrify an organ console I got. Two full manuals of 61 notes, pedals of 32 notes, 32 stops, and a swell pedal. I didn't even consider not using multiplexers, but I also never finished it.
Speaking as an old code hacker and midi fan, it was great to see this section of this project on coding to generate midi on the Arduino. As you say, it could be optimised, but your point was to make it easy to follow for non programmers, and in that you succeeded. Please do some more. ‘;’ is a semicolon. It’s basically there to make the job of the language compiler/interpreter easier as there is no ambiguity as to the end of the line. It was chosen as it’s a rarely used symbol and non-arithmetic, possibly because assembly code, from which high level languages like C/C++ grew, used it to mark the start of a comment; and yes, there was a language called B which came before C.
@@LOOKMUMNOCOMPUTER cheers Sam, great gig :) I have a denshi block kit in the garage somewhere that I’d like to donate to the museum. Will take a trip over when you’re open later this year. I remember most of those everyday electronics issues :) think I threw the mags away though.
I am a software developer. I write Arduino. You get a like because you survived that coding segment. Thought for sure you were about to stroke out on us.
This was super useful - cheers, Sam! A few years ago I got some info on Arduino and MIDI from Notes and Volts, but yours was the push I needed to finally try and actually build something! P.S. Did anyone else notice the tiny image flash at 4:01? "Keep your finger on the f*****g button, Clem Fandango!" 👏😁
Nice timing, I went through this same process the other day. Except mine's a remote controller for a t.c. Finalizer mastering processor that's now become my living room speakers EQ/compression at night. I wanted a nice way to control it so used one of the retro beige Hammond slanted desktop enclosures with the wooden sides. Gonna look sick.
For being known as awfull with computers I actually really liked your Arduino coding section it turned out really nice! Who cares about the names of symbols anyways, it changes for almost any programing language. :D
Jesus Christ, I think you just taught me how to code. Well enough to take a class and not be intimidated going in. I was not expecting this. And I'm older than MIDI.
Could anyone make a simple list of every material and gear used in this project(the connectors, buttons, switches, etc), I'm very new to this and can't quite figure out what to get. Thank you for reading.
1,2,4,8,16,32,64,128,256 are all common values when it comes to basic computers , all the way up to advanced computers. Had to learn all that when I was studying computer networking to compute binary and then convert to hexadecimal. I really want to build one of these, but I wish the buttons were pressure sensitive and could send the values of 0-127. That would be nice.
I have found "ternary operators" are incredibly useful to remove annoying "if" statements, as it sets up a "true" / "false" argument that puts everything on one line. ? : ; I haven't tried it but would this code work? (digitalRead(button1) == HIGH) ? (MIDI.sendNoteOn(36,127,1) : (MIDI.sendNoteOff(36,127,1);
I've wanted to build a midi controller of my own for some time and this may be the thing that finally gets me to do it! I really appreciate the efficient, no frills, beginner approach. I really liked your code breakdown and it didn't feel too convoluted at all (granted I have a small amount of programming experience). I would love to see a video and hear about how to think about integrating other sorts of switches, as well as maybe joysticks and especially rotary dials and the like for Mod, pitch wheel and effect knob controls (or does that get too complex?) I absolutely love your content- keep it coming!
What a cool project. Pretty good to get started on midi, arruino or even coding. Also, love the way you named some of the programming symbols haha. I’m going to start calling curly brackets as squiggly things, sound way better :)
You’ve got the 🔑 you got the secret. You’ve got the keyyyyy to … another place. I’ll get my coat. Great great vid. Learnt so much about midi but still feel as useless as I did before. Oh well. Says more about me than any of you experts who also watch this stuff. 🙏 thank you
I have been a programmer for 30 years, and this has to be the BEST coding tutorial I've ever seen! Even despite the need to yell "SEMICOLON" at the screen.
Yes but also he could have made it a bit easier to remap later by assigning his channels and notes and velocities in variables before running the variables into the midi function.
agreed....ARDUINO FOR DUMMIES!! love it.
I know yall know he isnt an idiot and probably knows more about coding than he lets on....which is brilliant, really, considering he ends up making entertaining for everyone watching.
this bippity bop and this swirly thing 😂😂
The fact that you do not know what a semi colon is, and yet still do what you do with such proficiency lights the way for a huge amount of people who feel they lack the intelligence or ability's due to poor education or life circumstance, keep it up and keep encouraging the people of the world, you are an inspiration.
I wish every coding tutorial was like this. You are the most engaging code teacher I have ever witnessed (and I've worked as a software engineer)
I'm a beginner straight up clueless. This man taught me a lot thanks dude.
For anyone planning on doing this, at 14:41 he says that there are better ways to do it and he's right! I'm making one right now, and I am restricted as I only have 8 buttons so i came up with a cool idea to share:
Use arrays! Have your buttons be stored in some array like int buttons = [ 0,1,2,3,4,5,6,7] ( the pin numbers of your buttons). Then comes the magic. You can have separate arrays for each scale! so for instance you could do something like
int Phrygian = [whole/half tone steps away from base note];
int Locrian = [ same thing for locrian]
etc..
int Modes = [Phrygian, Locrian...]
Then have an array with the base notes:
int Keys = [midi for C, midi for D, midi for E... so on].
Now in your logic you can have a variable for what mode you are in, and what key you are in:
currentKey = 1;
currentMode = 2;
And now to send a note you can go through each button and if it is on, add the key youre in to the note on that mode!
for(int btn = 0; btn < 8; i++){
if(digitalRead(buttons[btn]) == HIGH){ midi.write( (Keys[currentKey] + Modes[currentMode][ btn ] ); }
}
Now you can have a knob or button to allow you to switch between keys and modes and your keyboard will only play in the key and mode selected!
[for any aspiring coders out here, if you find yourself rewriting alot of the same code, try to find a solution with functions and arrays. Notice how i took his 10 if/else statements and reduced them to just a small loop and a few arrays. And the best part is, if you want to change a note or key or something, you just have to change it in the array and not in each if statements :) ]
Nice call. Also good for 8ve shifts
They really did a great job with midi. It’s just been the same connector and data standard forever. Even the new mpe keyboard I got is still just midi over usb but using some extra channels for all the extra expression info.
yeah!!! im glad newer products are ditching the midi over mini jacks and going back to 5 pin din! the mini jack midi is awful haha
@@LOOKMUMNOCOMPUTER nothing wrong with the mini jack, but they are asking like 20€ for (... or something around that) for a original Arturia jack to din converter.
than the fact you can loose it.
They even made a nice MIDI 2.0 version in 2020 with better resolution and nice new options but keeping it backwards compatible with the old MIDI. I love these guys, nice simple standard without the BS.
I did basically this same kind of project with a set of organ pedals many years ago and found something interesting. I always wondered why the MIDI serial port rate was 31,250 baud - kind of a weird number. More typical would be 9600,19200, 38400... turns out 31,250 is the fastest baud rate you can send from a 20MHz 8051 (which is what I was using for my project). So I'm betting that is the original processor they used for the prototypes :)
@@VAXHeadroom that would mean they divided 20mHz by 640, not accounting for start and stop bit. but 640 is still a multiple of 10 and 8.
I've programed for too many years and this tutorial was pretty good
like the code was kinda ugly and he didn't know the name of a lot of the symbols, but he explained it really well and I was kinda blown away with how simple it was with the midi library
it is ugly! hs but you know tried tomake it make sense like lego mindstorms ha
@@LOOKMUMNOCOMPUTER You're like a mad scientist without a dictionary. If you get the stuff done, it doesn't matter. Comments are great if you can remember them. Some of the functions are pretty intuitive. I don't know this program AT ALL, but took C++ back in the day, so I'm looking at the code and thinking, "oh yeah, this makes sense, I can read it!"
@@LOOKMUMNOCOMPUTER if you have a midi keyboard like the one you showed first if its already broken some keys couldnt you take all the guts out and build a interface like this and weld a button to each of the key you want.. and you can keep the faders and rotary aswell just change to another enclosure
@@fullfunk you could. Quite a faff but you should give it a go!
I dunno the names he gave them made sense to me
I love your teaching style and how you consider all skill levels. Great video.
He would make a good teacher. (This coming from a Swedish/English teacher for senior high school in Sweden.)
Before embarking on this project get more info on the project page www.lookmumnocomputer.com/projects#/super-simple-midi-keyboard
please remember yes this code is clunky, but its designed to not assume people know about arrays etc, its laid out in a linear fashion which i believe is easier to understand, and regarding the code being inefficient, it really doesn't matter in this application. sure if we are doing something that stretches an arduino's function but this is not one of those time.
Kosmo
TB-303
Another lovely Jubbley project. I have been following you since around 2016 I believe and your stuff is getting more amazing all the time. Thank you for your mad scientist contributions; your work is highly inspiring and appreciated. Just wanted to take a moment to say keep up the good work!
Atari ST
An Arduino
“They not hacker man.” Next level. As a long time hacker man, this really reminded me of how I first learned. Very lovely.
LOOK MUM A COMPUTER. Anyway very cool video for newbies in DIY. Arduino is probably best thing to happened for the DIY scene. Makes really hard IC controllers (most often in assembly-type language) programming a breeze. Keep up the good work.
he is coding in a potato, i am pretty sure of that =p
Thank you 🙏. Please make more simple DIY’s. I’ve been subscribed for a long time and have always drooled over the the idea of making my own creation!!! This is the start!
Brilliant stuff, thanks for this - I can't believe MIDI is 40 years old! I often thought about doing something with a hand made MIDI controller but never realised how simple it is to do. Now I have a gazillion ideas rushing around my brain, can't wait to give this a try!
Some (a lot?) people find coding intimidating and it can be very intimidating. What you did here is awesome! You showed that it doesn't have to be hard. It doesn't need a huge amount of education (formal or otherwise). Who gives a poop if it's clean or "right". Literally JUST TRY IT! :) Nice work :)
Gorgeous, you are giving 3 lectures at the same time. About programming, electronics and midi (and humour).
The main weapon of the Spanish Inquisition.... :D
"Void, that's like a sad void like my heart". Love it. Will keep this in mind when programming in C.
On one hand I’m shouting words like “library” and “function” at the screen, but honestly, this is a brilliant intro to MIDI on arduino and that’s something I’ve wanted to get around to for 3 or 4 years and not got round to it. Thanks Sam - great video and really well explained.
This is PERFECT TIMING! I’ve been really keen to make an MPC arcade button controller, I was totally put off by the coding aspect. You’ve just changed my mind, thank you!
I was literally *just* about to buy a Midi Fighter today, and then spotted this video. The coding was the part that intimidated me about going diy, but after seeing this I think I'll give it a shot.
I like the way you showed the coding. When i was learning, it was a lot of. "Do this because i said so". you showed what the commands do and that the names of things don't matter, just that they match, and how the comments work.
Thanks for explaining how to make a midi keyboard! I am a programmer and you did a good job explaining it. I didn't realize how approachable MIDI was, would love to make my own controller now.
i have a qestion . Will be this program good when i want use it as midi for FL studio but i want use usb cabel for conect it?
@@adambalaz4833 you can send midi over serial and convert it on the computer side with midi loopback driver
I'm just starting to put together some projects and experiment with Arduino. This video was very clear and simple and made me understand basic concepts. Logic makes a lot of sense, even if there are better ways to write the code this helped me to have autonomy when programming. Thanks!!
Just before Christmas i modified an old Yamaha organ keyboard - i rewired the keys as a 4x12 matrix and used an Arduino Micro to connect it to my Laptop. As the Micro has native USB support, it can act as a USB-MIDI device with no extra hardware! It takes just the Arduino, a few resistors and lots of wire.
When you use variables that just won't or especially if they shouldn't change, you should use preprocessor directives instead of actual variables. So instead of
int button1 = 2;
use
#define BUTTON1 2
It doesn't have to be upper-case. That's just an unwritten rule that's written down very often (just not as an actual rule).
You're already using preprocessor directives without knowing when you're writing stuff like INPUT_PULLUP, LOW, or HIGH. They're all over the place in Arduino.
Using preprocessor directives for small datatypes should also save some memory which is very limited on microcontrollers. For that to be a problem you would have to make a project which is much more complex to run into problems there. But it also just makes sense that something that isn't variable shouldn't be A variable. With that in mind, you could also just make the variables constant with the const keyword, but that won't change anything on the memory side.
He can make an input array and a midi notes array, or he can define the input int range and the range of the midi notes, or he can define the base offset between the input numbers and the notes.. Out there is a principle called KISS
Except that #define is super risky to use, if you accidentally use the defined string as part of another string it will still replace it.
For example: if you do #define a 1, and then write digitalRead();, it will be interpreted as digit1lRe1d();
const gets compiled perfectly and does not take up more memory than #define, so go for const.
And more importantly: int is fine for beginners. use int.
@@DanielSimu Well, technically that's true, But if you use a more descriptive name than "a", something you should do anyway, it's just very unlikely that this will happen.
And correct me if I'm wrong here, but the difference in memory use is that variables, const or not, are stored in RAM and literals, what preprocessor directives eventually become, won't. Every time you use a literal (as long as the number is small enough for a single word data type), it's taking up one word in flash and every time you're referencing a variable, the address also takes up one word in flash. So that's basically the same.
So it depends on the question if you're running short on RAM while it won't help you much when you're running short on flash.
Of course, that won't be much, but that's why I wrote it won't be a problem in smaller projects, so as you say, it's not a problem for beginners, but even beginners should start to learn good habits instead of unlearning what they've learned later.
Even when I don't think about why this makes sense, I just look at how preprocessor directives are all over the place in Arduino itself at that they probably did it for a reason.
@@asp95video Yes, "keep it simple, stupid", but I don't see how using preprocessor directives isn't as simple using variables.
Using arrays might be the more elegant solution, but my comment was more about variables vs preprocessor directives in general than about this particular case.
@@juschu85 Feel free to keep on using #define, but I disagree that it is unlikely to happen.
For example, in this video there was an int button1 and an int button1beans, if the first had been #define button1 you would have gotten issues with the second.
On a recent memory limit approaching project I had a look at replacing all the consts with #define just to test, and the arduino compiler showed no difference, the sizes were exactly the same. Why would the compiler treat a const differently anyway?
the sound of the midi controller is fantastic!
Sam you‘ re hard workin man. God bless you for your kind presence here on planet earth trying to entertain us with knowledge! knowledge is key to provide the world with a lot of empathy... and words or idioms are fuel for the brain to live the culture.
I hope to see you at the superbooth, you’re a wonderful speaker, musician and inventor. greetings from a french guy with latin roots living in germany working in the software consulting business since 1996 (dedicated hip hop head since 76, making music back in 87 and now turned into a synthesizer and martial art lover). love ya mate!
this is exactly the kind of tutorial i want for everything ! show whats important , explain what it does with as few words as possible but pack everything important into it and keep it practical and entertaining :D
You got me at "dot squiggle" lol. As a C# dev, your code is copypasta, but good enough for someone new to get started like you said. Next step would be to put that repetitive code in a method and call it with parameters.
It's amazing how simple doing midi on Arduino is, and this video gives me motivation to give it a go myself.
you're absolutely one of the most amazing guys on youtube
Your refreshing madness and retro genius always cheers me up.😸
I liked your casual attitude. It makes the whole process, especially the programming, seem less intimidating. Good job!
I've been building a MIDI expression pedal because keyboard velocity sensing is just not the same as turning up the volume, reverb, or vibrato. And who can do that with a knob while your hands are busy playing the keys?!
videos like this are really good. this is what youtube is about. not just showing off stuff, but showing how to make the stuff in use. great job
Dude. Thank you for this. I’m a 40 year old dude and all the physical stuff is easy for me to understand but I’ve always had trouble with code. I’ve got some Sanwa arcade buttons hanging out and I’m ready to build this. Thanks!!
TH-cam was made for you. Besides the videos of people falling, this is What I like, you just fit in this.
I'm a duly appointed hackerey type guru, and I fully appreciate the job you did with the nerdy bits. Good job.
could I just use a USB socket instead of the MIDI, to connect it to a DAW on the computer, or would I need an extra driver for that?
GREAT video by the way =)
Thank you, thank you, thank you! I’ve been trying to piece together all this info through separate videos and tutorials, and look mum, it’s all HERE!!! You make the world a much more understandable place. Headed to Patreon to pay my course fee, haha!
I am not an Arduino-master but couldn't resist screaming at the screen about how much more efficient that code could be...
What is it about people striving towards effficient code on simple stuff. It’s not like that in electronics
No doubt it can be but it’s written like that to make sense to people who aren’t one hand in doritos the other hacking the mainframe ha
Currently building this on an old lump of wood to use as a bass pedal to under my keyboard. I have 12 notes and have added 4 buttons for channel +/- and Octave +/-.......not sure how this will work yet, but fingers crossed. nice video, keeps the amatuers (like me) interested when its not all above our heads!
Groovy video! For a college Embedded Systems class project, I took a toy electronic keyboard and used an Arduino to connect it to a Yamaha YM2151 chip like classic arcade games like Street Fighter 2 used to use for sound. To this day I wish I made it MIDI-capable.
I really commend you going out of your way to go super in depth with the coding despite how it's the antithesis of your existence just to keep true to your goal to make this video a beginner's guide. big ups
Awesome instrucional vid as always, Sam! Just a minor criticism: per the MIDI hardware spec, there should be 220 ohm resistors on pins 4 and 5 of the DIN connector to prevent frying the input optocoupler on the synth you'll be connecting this to. Even though there SHOULD be a resistor inside the controlled synth, I reckon it's better to be safe than sorry. Keep up the amazing work!
Yeah al good tbh I was being lazy: I haven’t bothered so if someone is protective of their synth and I’m around with a midi controller I made don’t let me plug it in ha. I added 220r on the pic on the site when the vid went up al good
@@LOOKMUMNOCOMPUTER Excellent, man! Love all the hacky stuff to bits, just wanted to make sure nobody's equipment would get hurt.
Making the code easy to understand is half the battle, sweet tutorial 🤘
Thank you for this !!!
You made it easy to understand, and that is the important thing for me.
When I understand it, I can always streamline it in the future 😊👍
If you use a variable, then you don't have to make it repeat the on command while held. A debounce is also possible.
Velocity on note-off messages makes actually sense. For example, you could control the release time. Lower velocity -> longer release.
Should you not have inserted some 220 Ohm resisistors into the +5V feed and the data connection to the Midi output socket ?
You are fing AWESOME!! Please give us more of this type of videos, I've been wanting to learn this stuff for so long, but it always confuses the hell out of me. Thank you brother.
So cool. Thanks for giving all this information. I think you've finally got me convinced to give it a go.
Awesome tutorial. Been programming for years, but this was so much fun and super informative as I have never touched midi programming, but needed it for a project. Thanks a ton!
I love your teaching style. Did I already know how to use the arguing midi library? Well, yes, but getting there I did feel alone and a bit lost until I was able to get the hang of coding. Education is important!
Omg i loved this video.
Im a long time game developer/teacher and i found this tutorial the most hilarious yet useful/engaging I've seen.
It reminds me that you don't need fancy code to do amazing things.
I really wanna try these.
(And yeah there were many ways to optimize but is true that that way is easier for beginners (and 100 times more hilarious and creative)).
(I watched this to get offended but failed)
"There are no real rules at all!" love that, man !
You say you're not hackerman, but this seems like hacking to me.
Heck yeah, that turned out really nice 👌👌😊
Nice! I would strongly recommend to follow the midi standard and put a 220ohm resistor in series with the 5V wire to the midi connector. It will probably work without because there should be also a resistor on each midi in port too, but if both of them are omitted it will result in a blown optocoupler...
ofcourse, but almost everything has a resistor that has not been made by me so its ok haha. to be honest i usually never bother with opto couplers on the midi inputs haha. its just a digital signal stream, i have not come up an issue yet. obviously there can be issues but works for me :D. and when imake proper midi things i include optocouplers, but most of the time i just wire straight to midi socket on each sides
Yeah I was thinking the same. Agree you may not need it if you're just bodging your own projects together, but the issue here is that if you were to plug this into some proper synth you may blow up the optocoupler inside it if you exceed the max current of the LED :D.
@@LOOKMUMNOCOMPUTER I agree that for my own circuits, I often don't do "MIDI at the electrical layer" and just connect RX to TX on microcontrollers, and just "MIDI at the software/protocol layer", but as this is being called a MIDI keyboard and has a 5-pin DIN socket it looks for all outward purposes to be for connecting to other equipment, so isn't there a real chance of overloading an input circuit with no resistors?
I think the issue is that the MIDI spec works on the basis of assuming a 5mA current loop, and the circuits suggest three resistors to get it - two on the output side, one on the input side. I am not an electronics person, but as I understand things, with an Arduino driving a MIDI circuit at 5V, using two 220 resistors on MIDI out and one 220 on MIDI in (at the other end) gives you 5/660 = 7.5mA (well it will be less as I've not included the diode Vf). But with no resistors in the MIDI out and just the one on the MIDI in, the current is 5/220 = 23mA (again actually less) but is four times higher than the MIDI spec says is required. Some opto-isolators on input circuits will be fine with this (the H11L1 for example has an input current limit of 60mA I believe). However some might be marginal, the commonly used 6N138 might have an input current limit of just 20mA, so any more would strictly speaking be too much for it.
As with many things, I'm sure there is margin for error and you'd hope expensive equipment has input protections, so it may be fine. And I'm sure it isn't as simple as I'm saying here anyway (as I say, I'm not an electronics person and there are voltage drops involved across the diodes and things too). I often leave out the suggested buffers on outputs, but for the cost and effort of soldering in two resistors, why take that risk? Or at least, don't call it MIDI or use a 5-pin DIN socket, as a reminder to your future self?
Kevin
@@SimpleDIYElectroMusicProjects sure I’ll add a disclaimer to the site and the project. But the margin for error is pretty chunky. Having done this a lot plugging into things I haven’t had any bad experiences but then again maybe that’s luck. A 6n138 for me has been fine for a lot above that. I mean in one project.. the drum trigger sequencer there are no resistors at all anywhere technically it would have burnt out years ago but going strong haha. I probably won’t change my behaviour towards it but I’ll mention it on the project page.
@@rjgscotland as said to the other commenter I will add a note on the site about this.
i feel this video was made in spite of another video.. one i refuse to sit down and watch for over an hour.. don't care, i love it.
Great video and thank you for explaining the code rather than telling everyone to just go download it. I learnt heaps!
and thank you for taking the time to make these videos
i just got around to learning how to solder, and this is definitely on my list of stuff to play with
really love your work!
Is it possible to have a midi controller that is a modular patch bay with switches and knobs for virtual synths? It would be really cool to be able to use actual cables and knobs/faders with different programs.
Super inspiring! I didn't realize I could just knock this still together
I love this tutorial. Also as a coder, this was a great demonstration of arduino for beginners.
My question is, as someone who makes a lot of instruments, do you recommend any buttons to be used as pads? I am not really a fan of arcade buttons, and want to make something like the old MPDs. So some form of larger rubber button (with pressure sensitivity for velocity).
MIDI's a beaut. I've got an old knackered-out (all synth chips dead) Yamaha Electone B35-N organ from the 70s knocking about that I'm waiting to convert into something mean. It's a lot of keys (two sets of 55 or something close to that maybe) with loads of pistons, pedals and levers to wire in. I've got a few candidate arduinos knocking about, but I haven't decided which one to use yet. Thanks for the inspiration needed to tackle the thing. The plan is to build a synth PC i've already prepared (forgive me) into the side. Can't wait to enter shift-register hell getting all those to work
Probably easier to use a load of I2C port expanders, you can put 4 or 8 on the bus depending on how many address channels they have and if you have a MEGA they have multiple I2C ports.
Would it not have also need to connect ground to the midi plug?
Your synth is perfectly in tune ❤️
I'm trying to make exactly this right now but I didn't know where to start, so this is extremely helpful!! Thank you so much for making this video!
come visit the forum linked on the project page in the description! We can help.
I've always wanted to know a simple way to make a custom MIDI pedal board to control my guitar effects. I didn't even know that Arduino had MIDI commands, as I've never used any microcontroller system but have always wanted to learn. I'll be looking into this for sure. Great video. :D
This has helped me no end, your teaching style is far more understandable than the books I have bought before that start with blink then expect you to know everything else. it has explained how i can build part of a larger project. Have you done a midi input video before?
You really are the best fudging communicator and awesome dude.
Thank you heaps for all of your stuff.
Years ago I wanted to electrify an organ console I got. Two full manuals of 61 notes, pedals of 32 notes, 32 stops, and a swell pedal. I didn't even consider not using multiplexers, but I also never finished it.
Speaking as an old code hacker and midi fan, it was great to see this section of this project on coding to generate midi on the Arduino. As you say, it could be optimised, but your point was to make it easy to follow for non programmers, and in that you succeeded. Please do some more.
‘;’ is a semicolon. It’s basically there to make the job of the language compiler/interpreter easier as there is no ambiguity as to the end of the line.
It was chosen as it’s a rarely used symbol and non-arithmetic, possibly because assembly code, from which high level languages like C/C++ grew, used it to mark the start of a comment; and yes, there was a language called B which came before C.
Aaah I remember us talking about you messing about with midi!
@@LOOKMUMNOCOMPUTER cheers Sam, great gig :) I have a denshi block kit in the garage somewhere that I’d like to donate to the museum. Will take a trip over when you’re open later this year. I remember most of those everyday electronics issues :) think I threw the mags away though.
Love the energy mate.
Does the sentiment, “gr8 minds think alike” still apply if the egg came before the chicken tho
I am a software developer. I write Arduino. You get a like because you survived that coding segment. Thought for sure you were about to stroke out on us.
How do you go about connecting, let's say 50 or more buttons?
This was super useful - cheers, Sam!
A few years ago I got some info on Arduino and MIDI from Notes and Volts, but yours was the push I needed to finally try and actually build something!
P.S. Did anyone else notice the tiny image flash at 4:01? "Keep your finger on the f*****g button, Clem Fandango!" 👏😁
THANK YOU! I've been wanting to make a MIDI keyboard for a while but was at a loss for where to start.
Nice timing, I went through this same process the other day. Except mine's a remote controller for a t.c. Finalizer mastering processor that's now become my living room speakers EQ/compression at night. I wanted a nice way to control it so used one of the retro beige Hammond slanted desktop enclosures with the wooden sides. Gonna look sick.
Thanks so much for explaining how this works.
Great tutorial! Thanks man!
Hey! Cool tutorial. Do you have a synthesizer tutorial with MIDI to which I could connect this keyboard?
Thanks ! I will try to do something as I would like to use a pedal synth while playing the bass.. Cheers !
4:00 - "Steven, this is Clem Fandango, can you hear me?" lol
For being known as awfull with computers I actually really liked your Arduino coding section it turned out really nice! Who cares about the names of symbols anyways, it changes for almost any programing language. :D
One cool feature is that you can send a midi note on command with volume 0 to have the same effect as midi note off.
Jesus Christ, I think you just taught me how to code. Well enough to take a class and not be intimidated going in. I was not expecting this. And I'm older than MIDI.
ditto!
Congratulations on 486K subs!
Could anyone make a simple list of every material and gear used in this project(the connectors, buttons, switches, etc), I'm very new to this and can't quite figure out what to get. Thank you for reading.
Clever fun, inspiring, educational and entertaining!
1,2,4,8,16,32,64,128,256 are all common values when it comes to basic computers , all the way up to advanced computers. Had to learn all that when I was studying computer networking to compute binary and then convert to hexadecimal.
I really want to build one of these, but I wish the buttons were pressure sensitive and could send the values of 0-127. That would be nice.
I'be been going down the Arduino rabbit hole recently (not MIDI) and it is so incredibly easy to program and get results.
I have found "ternary operators" are incredibly useful to remove annoying "if" statements, as it sets up a "true" / "false" argument that puts everything on one line.
? : ;
I haven't tried it but would this code work?
(digitalRead(button1) == HIGH) ? (MIDI.sendNoteOn(36,127,1) : (MIDI.sendNoteOff(36,127,1);
Where did you get those lovely buttons?
That's the most unhinged programming tutorial I've seen. Great work!
Crazy to see you pull out my very first keyboard ever! That mk447 took me way back!
how can ein built a midi concertina? Do you have instructions therefor?
definitely gonna try this with an old organ, is there anything is could look out for before buying a busted up organ for cheap?
Dunno. Try to spend no more than 20 quid. Then if it isn’t right you can just smash it up like a mad man
esp32 is around 3.50 ... does midi over ble ( low latency bluetooth )
I've wanted to build a midi controller of my own for some time and this may be the thing that finally gets me to do it! I really appreciate the efficient, no frills, beginner approach. I really liked your code breakdown and it didn't feel too convoluted at all (granted I have a small amount of programming experience). I would love to see a video and hear about how to think about integrating other sorts of switches, as well as maybe joysticks and especially rotary dials and the like for Mod, pitch wheel and effect knob controls (or does that get too complex?) I absolutely love your content- keep it coming!
liked your how to implement the code portion - whole project was great as per your ususal!
I love how he warned the next bit for coders might offend us but i've never laughed harder
Where does one get the parts, such as the 5 pin midi jack?
What a cool project. Pretty good to get started on midi, arruino or even coding.
Also, love the way you named some of the programming symbols haha. I’m going to start calling curly brackets as squiggly things, sound way better :)
You’ve got the 🔑 you got the secret.
You’ve got the keyyyyy to … another place.
I’ll get my coat.
Great great vid. Learnt so much about midi but still feel as useless as I did before. Oh well. Says more about me than any of you experts who also watch this stuff. 🙏 thank you
Do you have a video (or any info) on the big arcade button midi keyboard/visualizer from the Sarabande video?