Go Down

Topic: MIDI Code (Read 1 time) previous topic - next topic

Exo78

Jan 27, 2017, 10:19 pm Last Edit: Jan 28, 2017, 01:34 am by Exo78
I'm trying to make a MIDI controller that has 13 input buttons from C4 to D5, including the sharps. I have all of the hardware minus the Arduino board.
I haven't picked one yet because I want to make sure everything works correctly, which leads to my second thing.
I have absolutely no experience with C or C++, so I can't write the little bit of code that I need to make the controller work for those 13 notes. I've looked around on the arduino website and the forums, and I have seen people saying that the code would be really easy to write, especially if there was no velocity sensitivity, which I don't need.

Anyway, I would really appreciate it if someone could post which arduino board can give a direct MIDI output, and if someone could maybe paste all the code that I would need to put on the board for it to work, since it doesn't seem like it would need much. Thanks, and again, I'd really appreciate any help with these two things.

DVDdoug

#1
Jan 27, 2017, 10:59 pm Last Edit: Jan 27, 2017, 11:05 pm by DVDdoug
Quote
I need a board that gives an actual MIDI output, since I need to connect it directly into a sound module...

...which arduino board can give a direct MIDI output (not serial),
Sorry, I don't understand...    MIDI is serial (or USB).   Or you can use MIDI files in software-only and virtual (software) instruments to create sound or to make a sound-file.    

If you just want to "make sound"when you jpress a button, you don't need MIDI and you can use the Arduino itself to make square-wave tones.    But, you'd be limited to playing one note at a time.

...There is a Play Melody Example that plays a pre-programmed sequence of notes (frequencies) and there's no MIDI involved.    (You could modify that program to play notes based on key-presses.)  

Quote
I have absolutely no experience with C or C++, so I can't write the little bit of code that I need to make the controller work for those 13 notes. I've looked around on the arduino website and the forums, and I have seen people saying that the code would be really easy to write,
If you've never programmed in any language, I wouldn't say it's going to be "easy"...    You need to understand the basic building-blocks of programming, such as variables, if-statements, loops, etc.   Then, you need to understand the basics of MIDI.

Grumpy_Mike

Quote
since I need to connect it directly into a sound module
So what sort of MIDI input does this module have?
If it is the normal 5 pin MIDI socket it is easy. If it is a USB connector then it is much more difficult.

Exo78

#3
Jan 28, 2017, 01:46 am Last Edit: Jan 28, 2017, 04:12 am by Exo78
The MIDI sound module just has the 5 pin DIN connector input, so I would just need to be able to connect whatever arduino board to the module with that.
And with the no experience limitation that I'm facing myself with, there's no way I can write the needed code myself, so all I really need at this point is what the best board to use in order to input into a 5 pin, along with either the code needed itself, or a link to the code that I would have to put on it in order to just have 13 buttons in a row with no velocity sensitivity that each send a MIDI signal when pressed (like the leftmost button would play the note D4, the next DS4, then E4, etc. up to E5). Again, I'd really appreciate help, especially with the code.

sparx266

Hello Exo78

Are you sure you have researched this?

Let's start with the basics. Get yourself an Arduino Uno, an Arduino Nano or an Arduino Mega. You choose.

You will also need two 220 ohm resistors and a 5 pin DIN socket for the MIDI out.
Get some buttons too.

This really is easy, but you are going to have to put some effort in yourself. You won't learn anything if you get someone else to do it for you.
It may seem a bit daunting, but all journeys start with a small step.

S




Grumpy_Mike

Quote
The MIDI sound module just has the 5 pin DIN connector input, so I would just need to be able to connect whatever arduino board to the module with that.
Any Arduino will cope with this. You need a small circuit that converts the signal from the serial port to a MIDI socket. You can buy these or make them yourself, here is one I made earlier. http://www.thebox.myzen.co.uk/Hardware/MIDI_Shield.html
Or you can buy one, just search for "MIDI Shield" Here is one MIDI Shield

Then the software is quite simple, this project has the basics of what you want although the switches are some what different. http://www.thebox.myzen.co.uk/Hardware/Pendulum.html

What you want to make is not called a MIDI controller, that is used to described a box that sends MIDI control messages not note on messages. You want a MIDI keyboard.

However exactly what you want with software and a full explanation of how it works, along with lots of other stuff can be found in my book. Arduino Music projects

Exo78

#6
Jan 29, 2017, 12:30 am Last Edit: Jan 29, 2017, 12:37 am by Exo78
Picked up a copy of the book, just wondering if you could point me towards the pages with the software and the circuitry that could be used for 13 button MIDI on off keyboard. Thanks

Grumpy_Mike

It's chapter 5, the Spoon-o-Phone project. Just replace the spoon and conductive ink keyboard with the switches.

Exo78

I just had two more quick questions.

First, would this work as a MIDI shield, since the shipping on all of the ebay ones are from China and go as far out as March, which doesn't work out with some time constraints https://www.sparkfun.com/products/12898
Also, if this didn't work, would it work just as well to make the one from the schematic on pg 38 of your book?

And other question, for the buttons connecting to the arduino, would I connect all 17 ground wires into the single ground point on the board, or could I solder all 17 wires to a single wire and put that into the ground point to make it a bit easier?

Grumpy_Mike

Yes both those would work. Note for sending only you only need half the circuit. Also the Sparkfun one has some buttons and two pots so leaving them off the kit when you make it will leave all the pins free for your switches.

Yes connect all the ground pins of all the switches together then put one wire to the Arduino.

Go Up