SUPER SIMPLE MIDI KEYBOARD DIY HOW TO

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so you may or may not remember just before christmas i did a video where i made a musical instrument of a bunch of santa claus toys i know what you're thinking sam you can't say the s word in non-christmas times and i apologize now for that but now i'm stuck with a musical instrument made from a bunch of santas i could hide it in the loft or i could set up to be interactive at this museum's not obsolete even not in christmas time just set it up and people can have santa all year round the issue with this is it doesn't have a keyboard it's a musical instrument that receives commands via midi midi is like usb for musical instruments it's been around for 40 years now and it's a means of plugging pretty much any synthesizer or musical instrument kind of thing into another synthesizer musical instrument kind of thing to make them play each other in the case of this santa machine it has a midi input and what you plug into it is either a keyboard so you can play the santas with the keys or something like a sequencer which is what i plugged it in in the video so today we're going to tick off one of the video projects on the really long list that i've got and it's going to be making a super simple midi keyboard what's a midi keyboard well you may have seen one before i mean this is a midi keyboard it's got a midi output on the back you may recognize that port that's what a midi port usually looks like all this does is it controls other musical instruments you plug it into something like a synthesizer that's got midi you push down a key and hopefully if it's all set up right that will play the synthesizer over midi you can have control changes that means you can actually twist knobs and that can adjust parameters on the synthesizer or whatever you're plugging it into midi for a 40 year old protocol has aged very well and it's still extremely useful i even have a midi cable between the sequences down here on cosmo and the synthesizer so this part of the setup doesn't make any noise at all it merely tells the synthesizer to make music so if you're not really experienced with diy electronics and you sort of want to make maybe a midi keyboard all the way from one or two keys up to 50 keys then this project in this video might be of use there's only 11 santas so this keyboard only needs 11 keys anyway let's go and build the hardware for an enclosure i'm going to use this hammer enclosure because it's lovely and i'm a change man so i'm gonna use a ruler to actually measure out some holes and then i measure out for the rk buttons i've only got 10 of them so i'm going to drill a hole for each of those and uh yeah be careful with this i've used the wrong drill bit for this so shhh and then for the 11th i'm going to use this key because why not bite me and then pop it in admire workmanship then we need to drill some holes for the power and the midi connector lovely jobly then attach all of the buttons to the bottom of the arcade buttons then i wired all of the lights on the arcade buttons so they lit up you don't have to do this it's an added level of complexity but by gosh when you finish this it does look bloody lovely after that we wire ground to one of the switch contacts on each of the switches and then after that we connect these wires which are connecting to all of the digital pins on the arduino so you go from d2 to d11 one for every switch look at the close-up there it looks lovely i've literally just soldered it onto the arduino so the midi we wire one wire to the tx pin and one to the five volts and then you solder those onto the midi and the connections are going to be chatted about later in the video and then you add my workmanship because you know it looks bloody lovely it's really that simple so there we go we built the hardware it's not the neatest wiring job in the world i've quickly hashed together a quick drawing and it's right here but all you need to worry about is that all of the switches connect to ground gnd on the arduino and then each of the switches other contacts connect to a digital pin so i've got a wired in d2 d3 d4 d5 d6 d7 d8 d9 d10 and d11 on the arduino if you look at the arduino here it's very hard to mess up because all of the pins have labels so i've literally got them soldered directly onto the arduino and then i've kind of double sticky taped it on the back it's not the most beautiful thing in the world but the great thing is is it's gonna work so the only wires you really need to worry about are the wires that connect all of the buttons to ground and then there's the wires that go between each of the buttons to the separate pins on the arduino that means when you push the button it sends that switch to ground it forces the arduino to go to ground and then it tells the arduino that something's happening we're doing it this way round when you push the button it goes to ground instead of when you push the button it goes to 5 volts because when you push the button and it goes to 5 volts you need to use an extra resistor to stop the arduino from getting confused this keeps it simple so just just trust us on that one another quick thing to bear in mind is the midi cable there are five pins on this but you only need to wire in two of them and you can get easily confused because they connect to these two pins so if we're looking at it from the front the purple wire is the tx pin and the pink wire is the five volts it's easy to mess these up so if you finish this project and it doesn't work the first thing to do is swap these over and then see if it works you're not going to break anything don't worry so this currently isn't going to work what we need to do now is quickly write a piece of code for the arduino and upload it via the usb socket right so i was trying to think about the best way of doing the next part of this video without a being boring as fudge and b uh not just being weird and complicated and it kind of got me a bit stumped so the next 10 minutes is designed for people who haven't got a fudging clue about code they're slightly interested in getting into arduinos and stuff like that but they find all of the codes a little bit like weird and confusing i've sort of made it like step-by-step blocks so it sort of hopefully makes sense however if you're a self-titled coding aficionado then maybe have a sick bag at the ready because this may offend you i don't mind because it works but you know you might and likewise if you want to completely skip this bit and just go straight over to the website and download the code and just prompt it on anyway then be my guest the time tag to skip it is down in the description anyway let's get going right so you've downloaded the arduino program now you're stuck with this blank screen and some random words on it what do we do the first thing we need to do is we need to bring in something called the midi library what the midi library is is it's uh basically a bunch of buzzwords hot words that kind of do a load of code in themselves so it simplifies the whole process and that's the great thing about arduino and c plus plus coding and stuff like that i don't know what i'm on about so the first thing right at the top of the code we need to put include and then it's midi and then the midi file for the uh for the library is midi.h so that's the midi library included the next thing we need to do is we need to start that up we need to start the midi thing so it's like midi i've just realized i've just removed the void setup and void loop the void setup is the setup state for the arduino everything that you included that kind of piece of the code is what happens when the arduino turns on the void loop is what keeps on looping around that's the program that keeps on thinking so uh void that's like um of a sad void like my heart set up uh what we're going to do is we're going to put one of those fancy symbols in and the first thing we're going to do is begin the midi by the way if you want to make a piece of writing on the code uh for a little bit of like to remember what the fudge it's doing you could just do two of those liny things don't know what those liner things are called either this is how useless i'm on a computer and it's like this is gonna be beginning midi things as you can see i'm not very good at writing comments it's set up it's ready to listen to midi it's like yeah i'm ready to do this and then we've got void loop so whatever happens between this and this uh is what's in the loop and what happens between this and this is what's in the setup kind of part yeah first we know the pins that we soldered all the buttons to so the first button that we soldered pin number two d2 so what we do button one this is the first button we're gonna call it button one and that button one was on digital digital pin two so on pin two so there we go and we end it always end it with one of those dots and squiggles you're gonna be shouting at the screen soon because i just don't know in the name of any of these so that's just above the sap that's kind of like for reference now we're going to tell the arduino get ready this pin is going to have something on it so what we need to do now is we need to go pin mode uh button one also if you search up arduino reference library it will say a load of these kind of buzz words that we're using right now uh but what they do i've misspelled input pin mode button one input pull up what input pull up means is it's saying it's an input but it's got a pull-up resistor so what that means is inside the arduino it's going to have a little resistor probably 10k or something that is wired to 5 volts so what that means is when that that that pin is always at five volts unless you send the ground into it so when we send ground into it actually goes down and then that's what we're gonna use as the kind of thing to know when there's a button that's been a button that's been pushed right now we've got everything there so what we need to do now is the first part of the loop is we need to see if there's been a button pushed so what we need to do is digital read yeah digital read that's another fancy word that's in the arduino that reads the digital pin and the digital pin we want to read is button one which when you look at the top is pin two so we've already said button one p is pin two so digital read button one and then end it with one of those things remember that so if i put a comment reads status of button yeah yeah and when it's in gray it doesn't do anything it's merely commentary commentating but we need to transfer that into a sort of value so we need to actually go up here again button uh one value uh this is um it doesn't you can call it whatever you want you can call it button one funky monkey number so button one funky monkey number i'm not gonna do that because that's just gonna get really confusing and we're starting with zero so at the top is zero you could probably put anything there and then what we do over here is we actually do button one value equals so you listen to the digital input button one whatever that state is is now button one value we could call it button one beans uh let's let's that's better button one beans button one beans there we go now we need to do something with that what we've done so far is we've pushed a button and the arduino is listening to that and said oh the button's being pushed but we're not telling the arduino to do anything with that newly found knowledge that it's got if uh that's how you spell if and then you brackets this is the question so if button one beans is and then absolutely is it's like two equals check on the arduino reference value what these mean because i can't bloody remember if it's low so what low means is another term for ground so high is the five volts so the digital pin has gone up to five volts it's like i'm receiving signal low is it's receiving ground i'm being pulled down to the bottom that pin is being pushed low so when we push the button push the button if it's been pushed low we need to do something if it's not being pushed then it's automatically high because it's being pulled up high remember input pull up at the top what we're going to do is uh make another one of these fancy little uh whatever they're called this is when we use the midi library these are a couple of quick buzzwords that make it quite easy to code it's a little bit more long-winded if the if you didn't use the midi include midi library so what we do now is midi dot send note on button one has been hit if it's gone low that means it's gone to ground which is what we've told the button to do every time we push the button it sends that pin to ground it's going to say midi send no on and then we're going to put in brackets now what we need to do is we need to figure out what midi note we want to send so we have a look at a midi uh note chart i've got one right here actually i've got it printed out and what it says is i'm c note i'm gonna go for c two that's um thirty six sometimes they say c one is thirty six so i'm gonna go for midi note 36 it ends up being a c i'm pretty sure the santa is on a c anyway so that's fine so we type that in then we need to type in what velocity that signal is being sent the velocity is how hard the button is usually being pushed and how loud the note becomes so that is a value of anywhere between zero and 127. that means there's 128 values including zero so zero's on top of 127 128. all of the midi values are 128 not super obvious in this chat i've just i've loaded that information onto you but let's say we want to make it maximum velocity we type in one two seven if we want to make it half velocity we type in i don't know 60 breathe but we don't we're going to do full full the velocity and then we need to do another comma after that what we need to do is what midi channel it is on so midi is amazing because you can send it to 16 different channels on it so let's say you've got midi output plugged into two midi instruments you have one midi instrument assigned to midi channel one one mini instruments assigned to midi channel 10. you can do that so what we need to do is we need to choose which midi channel to send it to if you write in a zero here it actually sends it to all of them it sends it on omni mode but we're gonna send it to midi channel one there we go boom and then we're gonna close that bracket somehow press enter at the same time and now we're gonna do that unfinished uh dot and dash thingamajiggy and then we're gonna close that kind of command box with that other signal at the start bit of a comment bosh bash that is done we've pushed the button now and that has transferred that pushing button kind of motion into a midi signal going out of the midi channel into a midi instrument the problem is is when we take our finger off that button it doesn't do anything it doesn't know what to do we we it's going to be on you've told it to turn it on but you haven't told it to turn off when you lift your finger off the button so what we need to do now now we're gonna do another if it doesn't matter it works it works if button one beans is high this is the other kind of state it's in midi are you gonna are you guessing this already send notes off problem is if we type midi send note off to 37 for instance what that's going to do is it's going to send the note off command to 37 but it's going to keep number 36 is not being told to turn off so make sure this matches up and then you can type in whatever velocity you want in this point because it's been turned off but for now i'm just gonna do velocity zero in case some reason it's a stupid synth so on midi channel one so now we've sent a midi note on command and a midi note off command and these two uh are the the box for the loop now we've done that i'm gonna just basically copy this premise but for every single button there's loads of ways of doing this quicker there's loads of ways of doing it much more streamlined and neater however this is the way i think makes the most sense to somebody looking at a piece of code like this who hasn't got a fudging clue what the fudge you know you know they're not hacker man okay so let's let's try this so what i'm doing here is i'm copying and pasting everything and changing the values and figures to match up with different buttons with different midi numbers you'll see i'm changing the numbers in the more and you can look at the code closer on the website the link is below although it makes sense doing it this way if you haven't really done much code if you're not hacker man and you're just trying to bloom and get a midi keyboard to work all in all this took me half an hour and i put the full length video of that up on my patreon and it was julie pointed out by a commenter called twin turbo that it could have been a little bit simpler i could have just skipped the button one beans part completely and just shoved the digital reed straight into the if statement anyway let's see if it works so the other end of this midi cable is wired into a midi input of another synthesizer which is set to listen to midi channel 1. we're going to plug this in to the midi channel of this which hopefully sends out from midi channel 1. let's test it [Music] [Music] [Music] the reason one of the switches is under lock and key is basically just a cruel joke because you can only access that santa uh if you've got the key so and but the cool thing about it is you can use any switch you damn well want with this there's no real rules at all and yeah we can leave it to drone [Music] there we go so this method could be used to expand the amount of notes all you need to do is just copy and paste all of the parameters again and again there is something called an arduino mega which has more uh pin inputs and i strongly feel that this is the way to go if you're a beginner just wanting to get a diy midi keyboard sorted you know you could go down the route of using multiplexes and stuff like that but for the sake of soldering just a few more wires i think from the troubleshooting all that kind of point of view this is actually a simpler and quicker way for instance my controller keyboard is made from an organ keypad and an arduino mega right down there the great thing about organ key beds most of them they're wired like this where you push down a button and then there's a single wire that comes out of that switch underneath there and then there's one common rail that is connected between all of them so how this is wired is exactly the same as that box there's a common ground that is soldered to the uh rail that goes across the top of all the switches and then every single one of the buttons just go over to a digital pin on this arduino mega right here and then obviously made the code copy and pasted it to get more and more notes you know but there's loads of options available i'm going to take this over to the museum and set up with the santas there'll be a video on this museum's not obsolete youtube channel when that is done anyway that's it from me for now there's a link to the project page on the website below i built this in real time on a builder's live stream over on patreon which you can still watch back and you can obviously watch loads of others and more to come there is also the full length unedited video of making the code i hope this video has helped some people and i look forward to seeing some successful projects anyway i'm looking up no computer if you like these kind of videos don't forget to subscribe and don't be scared to try it [Music] [Applause] [Music] [Applause] [Music] [Applause] [Music] [Applause] [Music] [Applause] [Music] so [Music] you
Info
Channel: LOOK MUM NO COMPUTER
Views: 117,811
Rating: undefined out of 5
Keywords: diy, electronics, how to, electronics project, look mum no computer, synthesizer, midi, science, home made, lmnc, soldering, coding, music, musical instrument, instrument building, andrew huang, did you know
Id: wY1SRehZ9hM
Channel Id: undefined
Length: 19min 52sec (1192 seconds)
Published: Tue Jan 11 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.