The BIG Arduino MIDI controller thread
The BIG Arduino MIDI controller thread Posted on: 14.12.2010 by Arcelia Siebeneck Seen a lot of people on here talking about setting up a midi controller based on Arduino recently so thought it might be an idea to get all the relevant information collected into one thread.Here's some useful links:
This is the Arduino basic tutorial on how to get midi up and running: http://arduino.cc/en/Tutorial/Midi
This is some Arduino code that will get 8 potentiometers working:
http://little-scale.blogspot.com/200...i-cc-data.html video of it in action: http://www.youtube.com/watch?v=X7wJDpk_yoA
This is a thread with Arduino code to get 6 potentiometers working: http://www.arduino.cc/cgi-bin/yabb2/...num=1165833586
Here is someone who built a basic Traktor arcade controller using Arduino (includes code): http://www.arduino.cc/cgi-bin/yabb2/...num=1282913420
Arduino midi over usb: http://shiftmore.blogspot.com/2010/0...-over-usb.html
Quite an insightful thread on getting a midi controller working and discussion of analogue multiplexers: http://www.arduino.cc/cgi-bin/yabb2/...num=1264607305
48 analog inputs/digital inputs/digital outputs (in combination): http://mayhewlabs.com/arduino-mux-shield
| |
Darcy Rehfeld 05.02.2013 | Great thread! I'm currently working on a pair of controllers for a college project; one is a midi-fighter clone with a distance sensor and fader. The other is an NES-shaped 8 button controller paired with an accelerometer for motion control. I have a stretch goal to make it MIDI-compatible, but that might not be realistic in my project time frame (I'll definitely add it once I've graduated). I might make a build thread if time allows, and I'll definitely post any useful bits of code I discover over the next few weeks |
Weldon Dilg 03.02.2013 |
Originally Posted by valo
As for motorised faders, you first have to work out a way to make you DAW actually output MIDI when you move a fader. Then you'd have to route this out of the PC and to the device, read the CC, read the current CC of the physical control and compare the difference. Then you'd have to calculate how much power/time the motor needs to get to where it needs to go. Can you program an arduino well? If so you have a chance of succeeding at this. Not to mention the cost, > |
Evelyn Krogmann 31.01.2013 | Hello! I've now got plenty of info to start planning a conversion of an analogue mixing console into a DAW controller. Thanks a lot for this thread. The trouble was, I was looking into what they're selling and most come with only 8 faders. Most of my tracks got anywhere between 40-60 tracks and usually I got around 20 drum tracks in the mix so.. the other option was a 24 fader controller for $2800. But a question came up. Since I'm going to send the MIDI output data into a MIDI controller with 4 inputs/outputs, is there a way to have the logic board read the MIDI data, feed it digitally say to an IC chip which transforms into DC current so I can have motorized faders? I can fix some little stuff and solder a motherboard or build some premade package but I'm quite poor and looking for components or making my own schematics. Would it be possible? If I want to make, say, a 0,5-1dB adjustment on a mouse it would go back to the fader so the mixer and DAW are in perfect sync. Valo, From Finland |
Abby Beeny 16.01.2013 | I want to start off by saying I believe this thread is a great resource. Currently I am in my last semester Electrical Engineering in College and have over the past few months just started to get into djing. If possible I would LOVE to make a controller simular to a Midi Fighter that would run my remix decks in traktor. I was looking at the traktor F1 but after researching about DIY controllers it MIGHT be possible to make something that would work. I am also a drummer so being able to play one-shots easily on controller with out dishing out very much cash would be a huge asset. I have taken a course on program and would say I have a fairly basic understanding of programing. The course had me buy a kit with an arduino Mega 2560. From other kits I have a bunch of resistors and stuff including a couple breadboards. Any suggestions or insite is much appreciated! |
Era Roka 08.01.2013 | one tip, check out the teensy |
Janyce Henningson 19.11.2012 |
Originally Posted by Hobbs
It could be done with Arduino as well though, but if you want to avoid programming then go for the Livid. |
Natasha Lovesee 19.11.2012 | Thanks for the response.... I just don't believe it's time efficient for me to learn C language to build one controller. I mean, I understand it's something that I can build upon and keep with me forever (coding). But I have a family, lol. The only reason I was considering the Arduino/Teensy route was because I could build a controller with a pcb tht could accept the MPC's original pad sensor board more readily...I'm not even sure it's an option with the Livid kit without a major workaround. Has anybody had experience with the pads on the Livid contollers? Is the responsiveness acceptable for finger drumming? |
Julius Schoenhofer 18.11.2012 |
But I have NO interest in learning a programming language to make a MIDI controller...especially if the inherent latency depends totally on the coding.
With that being said...is there any scripts out there already or anybody that has preprogrammed Arduino brains (kind of like Livid)??
Programming an Arduino as a MIDI controller is not difficult though. There's a MIDI library that comes with the software that does all the tricky MIDI stuff for you, you just have to program the Arduino to work with the hardware you're using.
From what I read out there...it seems making a keyboard controller with velocity sensitive pads/keys seems impossible without adding another layer of software that sit between the controller and machine/PC.
|
Natasha Lovesee 17.11.2012 | hey guys I joined up here just to talk Arduino projects... I really want to make my own controller... I have absolutely NO lick of programming experience. (or even building for that matter)...But I can hit the ground running and self teach rather well.. But I have NO interest in learning a programming language to make a MIDI controller...especially if the inherent latency depends totally on the coding. With that being said...is there any scripts out there already or anybody that has preprogrammed Arduino brains (kind of like Livid)?? From what I read out there...it seems making a keyboard controller with velocity sensitive pads/keys seems impossible without adding another layer of software that sit between the controller and machine/PC. |
Gina Raffa 27.08.2011 | I'm using THIS library and it is very easy to implement, specially the midi input, which is handled via "callbacks" where you set them as functions to be triggered when given midi input is read. |
Hoyt Cowper 26.08.2011 | the code i am using is, not sure whos it is exactly now i had so many tabs open at the time. lol i found that i couldnt get the switch pin to work right, i believe im still fuzzy on the pulldown resistor stuff, but have the lady ada tutorial on it ready to read again for my next try. or its a debouncing issue and that requires a bit more reading. lol, either way my solution to the problem was just wiring up a pot and using a couple hundred ohm resistor to ground, the 5v to the other pin, and the output to my a(0) pin on the arduino. basically just have the pot centered, slightly left for off, slightly right for on. not pretty, but it does the job i want for now. i believe the code is from here http://itp.nyu.edu/physcomp/Labs/MIDIOutput [as referenced on the very first page of this thread] and the midi firmware i am using is this one[i believe, ive got a few and i renamed them for ease of DFU programming via linux] http://arduino.cc/en/Hacking/MidiWith8U2Firmware Code:
// The switch is on Arduino pin 10: #define switchPin 10 // Middle C (MIDI note value 60) is the lowest note we'll play: #define middleC 60 // Indicator LED: #define LEDpin 13 // Variables: char note = 1; // The MIDI note value to be played int AnalogValue = 0; // value from the analog input int lastNotePlayed = 0; // note turned on when you press the switch int lastSwitchState = 0; // state of the switch during previous time through the main loop int currentSwitchState = 0; void setup() { // set the states of the I/O pins: pinMode(switchPin, INPUT); pinMode(LEDpin, OUTPUT); // Set MIDI baud rate: Serial.begin(31250); blink(3); } void loop() { // My potentiometer gave a range from 0 to 1023: AnalogValue = analogRead(0); // convert to a range from 0 to 127: note = AnalogValue/8; currentSwitchState = digitalRead(switchPin); // Check to see that the switch is pressed: if (currentSwitchState == 1) { // check to see that the switch wasn't pressed last time // through the main loop: if (lastSwitchState == 0) { // set the note value based on the analog value, plus a couple octaves: // note = note + 60; // start a note playing: noteOn(0x90, note, 0x40); // save the note we played, so we can turn it off: lastNotePlayed = note; digitalWrite(LEDpin, HIGH); } } else { // if the switch is not pressed: // but the switch was pressed last time through the main loop: if (lastSwitchState == 1) { // stop the last note played: noteOn(0x90, lastNotePlayed, 0x00); digitalWrite(LEDpin, LOW); } } // save the state of the switch for next time // through the main loop: lastSwitchState = currentSwitchState; } // plays a MIDI note. Doesn't check to see that // cmd is greater than 127, or that data values are less than 127: void noteOn(char cmd, char data1, char data2) { Serial.print(cmd, BYTE); Serial.print(data1, BYTE); Serial.print(data2, BYTE); } // Blinks an LED 3 times void blink(int howManyTimes) { int i; for (i=0; i< howManyTimes; i++) { digitalWrite(LEDpin, HIGH); delay(100); digitalWrite(LEDpin, LOW); delay(100); } } |
Hoyt Cowper 26.08.2011 | wooohoo!! created a profile just to thank you for this thread. finally got a solid base to start with for my midi controller. got the one pot one button set up perfectly, and going through the LUFA firmware it runs like a charm straight over usb. perfect!!! hopefully my noob ass can build something to be proud of and show off here when im done. thanks so much!! |
Magan Eagleman 21.04.2011 | i |
Louisa Oberc 20.04.2011 |
Originally Posted by Siytek
http://timothytwillman.com/itp_blog/?page_id=240 |
Maryanne Weatherill 20.04.2011 | Hi lads decided to post this in here rather than make a new thread. I want to start to learn Arduino for college projects and of course eventually build my own midi controller but i want to learn the ins and outs so to speak and im just wondering were i should start?? I have a good chomp of change left over from my grant after recently shelling out for a mac I was believeing this > http://www.coolcomponents.co.uk/cata...FQRP4QodQREMHg Or would i be better off buying the arduino mega and just start off from their as i have some components/ breadboard ect laying around here at home from college?? |
Lillia Mestdagh 20.04.2011 |
Originally Posted by manou
|
Magan Eagleman 20.04.2011 | Great Idea Siytek!! I |
Lillia Mestdagh 20.04.2011 |
Originally Posted by MiL0
The pull down resistor is strong enough to limit the analog value to less than 300 when a floating pin suffers interference from the other used analog inputs. That means the unused pin values still fluctuate, but never above about 300 (out of a possible 1023 of the 10-bit analog scale). What this allows me to do is give the user a 'calibration' option which will automatically run on first power up, there will also be a menu option to re-calibrate too should you want to change the design and add or remove any controls. When in calibration mode, the board listens to all the pins. All the user has to do is turn all the POTs up to max and press all the buttons at least once in order for the board to detect the inputs used. The LCD informs the user of every successfully detected input and the board saves this to EEPROM and only reads these inputs when in MIDI mode. To change the amount of inputs, all the user needs to do is select 'calibrate' from the menu to change the config ...at least thats how it will work when I finish the code! This is possible because floating pins cannot cross an analog value in Arduino of about 300, even when suffering maximum interference from used inputs, as the pull-down resistors limit the noise. The MCU is then able to detect what is connected by seeing which inputs significantly cross the 300 boundary. Turning a POT fully up or pressing a button should give you a maximum reading of 1023, indicating to the MCU there must be something connected to this input. |
Arcelia Siebeneck 20.04.2011 | interesting so what about designing the hardware so that there are physical jumpers on the board? depending on which jumper is enabled, the Arduino will know what pots/buttons are connected. or, connecting all the unused inputs directly to ground... would this stop the 'floating' values? |
Lillia Mestdagh 20.04.2011 |
Originally Posted by MiL0
As you repeatedly scan the analog inputs, you check the value to see if it has changed since the last time the input was read ie has the POT moved? That way if the POT has moved the MIDI is outputted, if the POT hasn't moved no MIDI is sent. If this system is not implemented and you just output a MIDI value when the POT is read then a) bombarding the other device with lots of unnecessary MIDI may cause latency and b) 'MIDI learn' functions of programs like Traktor and Ableton will not work properly. ...so here's the problem. It would be quite easy to write a bit of code that scanned all the analog inputs on an Arduino, checked to see if they were different to the last time and if so, output the MIDI data on a different CC number for each analog input. The problem is getting the code to work with different combinations of POTS connected... for example if I wrote the code to read all 6 analog inputs of the Arduino UNO board and you only connected 4 POTS there would be random MIDI messages flying about for the disconnected inputs.... why? ...if you read an analog input that is 'floating' (nothing connected) you will find the analog values fluctuate all over the place. As this is seen by the code as 'a changing value' it will fire out MIDI messages of random values which is not what you want! So the code has to take in to account which inputs are connected and which inputs are not. The user can then adjust a variable in the code to state which inputs are used and which are not before uploading to their Arduino. Here is some code that should work with any Arduino with 1 - 6 analog inputs connected. If anyone finds this useful or anyone believes it would be worth me adding digital intputs to the code, let me know and ill make some time to add it! To suit your needs, just change the very bit at the top... This bit needs to be changed to how many POTs you have connected to the Arduino, entering 6 means all 6 inputs will be scanned for POTs. If you only want to use 3 POTs, change this number to 3. NOTE: Consecutive inputs must be used from the first analog pin, for 3 POTs, use A0, A1, A2. number_of_analog_connections = 6; This bit can be changed if you want specific CC numbers for each POT. The numbers 50 .. 55 correspond to the CC numbers for analog inputs 1 - 6 on the Arduino. If you want the second input to be CC07, change '51' to '7' as shown below control_change_numbers[6] = { 50, 7, 52, 53, 54, 55 }; You can also change the MIDI channel the CC data is outputted on with this line.. midi_channel = x; ..and the LED pin if you are using a custom Arduino board... led_pin = 13; Be warned I have thrown this code together pretty quickly and have only tested it a little bit!! So apologies if there is a prob with it, let me know and ill fix PHP Code:
|
Louisa Oberc 10.04.2011 | oops my bad.. i am 100% incorrect.. I have no idea why I thought you referred to the midi brain... |
Arcelia Siebeneck 10.04.2011 |
Originally Posted by DjNecro
Originally Posted by DjNecro
|
Matha Obray 09.04.2011 |
Originally Posted by DjNecro
|
Louisa Oberc 09.04.2011 | You realize that that is the same product that I linked you to originally... |
Matha Obray 09.04.2011 |
Originally Posted by MiL0
|
Arcelia Siebeneck 09.04.2011 |
Originally Posted by BennyJ
|
Matha Obray 08.04.2011 | Thanks buddy |
Louisa Oberc 08.04.2011 | Okie dokie In that case, I'd suggest that you start here: http://www.ladyada.net/learn/arduino/ The arduino community s are a wealth of information: http://arduino.cc/community / You will have a bunch to learn before you should try your hand at a midi controller. If you can learn the programming and the electronics, a midi controller isn't all that difficult. |
Matha Obray 09.04.2011 | Meh ive looked up that but it cost like 4 times as much as an arduino. im willing to learn. |
Louisa Oberc 09.04.2011 | Well see... You will also have to program it to read all the buttons, decide if they have been pushed (including debouncing to remove button jitter).. You also have to read the analog values of the faders or pots.. To be honest, based on your questions and responses.. You would be much better off using something like this: http://lividinstruments.com/hardware_builder.php instead of an arduino. |
Matha Obray 08.04.2011 | Ohh wow lol didnt know that at all. So how hard is it to program it to send midi notes? |
Louisa Oberc 07.04.2011 | The arduino? Not at all... You can program it to send midi notes though.. The arduino is a development board that allows you to easily program the Atmega328 microcontroller that it contains (or whatever chip the board uses [ATmega1280 or ATmega2560 in the mega's]). The microcontroller is a general purpose cpu that can do just about anything you want to it to do... Examples would include: Self Balancing arduino robot directly controlled with a Wiimote Arduino Dice Game Arduino TVout Light Pen Demo My Arduino Web Server v2.0 |
Matha Obray 07.04.2011 | I thought it just sent midi notes...sorry i am a noob and their site is pretty vague |
Louisa Oberc 07.04.2011 | How else is it going to do what you want it to do? |
Matha Obray 07.04.2011 | Yeah but why do u need to program it |
Louisa Oberc 07.04.2011 | You program the arduino in C/C++ |
Matha Obray 07.04.2011 | Im gonna use an arduino for my project...i hope i can understand the code tho! what is the coding actually used to tell the arduino? |
Louisa Oberc 07.04.2011 | That tutorial is for creating libraries for use in the arduino environment.. NOT how to create a program for the arduino... A better tutorial would be: http://www.ladyada.net/learn/arduino/ As for leds, yep, you can use the remaining pins for leds... In order to get more you would use shift registers (such as a 74hc595). |
Magan Eagleman 07.04.2011 | no... absolutely not Maybe a friend of mine could help me... I believe i |
Louisa Oberc 06.04.2011 | 45 pins would be required for your setup, so the mega should work okay without using multiplexers. As for coding it yourself... Do you know C++? Have you programmed before? |
<< Back to Reviews of DJ equipment Reply