Midi Auduino For Newby

Hi Guys,

With the failure of a midi input device to my PC I have been looking around for something to replace it.

There are a few that are UNO based but to me appear expensive. I have subsequently found out that not many of these retail offerings have native midi over usb support. A stamp and/or 'flip' firmware being required because of the differing baud rates midi - usb etc.

I have since learnt that the AVR ATmega32U4 chip has native support for midi over usb so am looking to use one of these in my project. So for my first go at using this device can anybody suggest a decent quality Midi library for me to upload. 6 analog ins, 14 digital ins note names and cc's imaterial as can asign in pc daw.

As I said a total newby so go gentle with me pse!

Thanks

Have a look at my MIDI Controller library. It does everything you need.
It supports pretty much any Arduino or Teensy board, however, Teensy boards or Arduino boards with native USB support (e.g. Leonardo) are much easier to use. If you want to use an Uno or Mega, you'll need to flash custom MIDI firmware, which is very cumbersome.
Read more here.

Pieter

Yes use a Leonardo or Micro and that can simply be used to look like a MIDI input / output device from your computer.
Use this GitHub - rkistner/arcore: MIDI-USB Support for Arduino

can anybody suggest a decent quality Midi library for me to upload. 6 analog ins, 14 digital ins note names and cc's imaterial as can asign in pc daw.

No need for any libiary to do that, it is not the sort of thing MIDI libraries do.

Grumpy_Mike:
Yes use a Leonardo or Micro and that can simply be used to look like a MIDI input / output device from your computer.
Use this GitHub - rkistner/arcore: MIDI-USB Support for Arduino

No need for any special cores. Arcore hasn't been updated for 2 years now.
Just use the MIDIUSB library.

Pieter

Hi Guys,

Many thanks for your comments. Would this be suitable?

http://www.ebay.co.uk/itm/Original-Leonardo-R3-Pro-ATmega32U4-Micro-USB-Arduino-Compatible-Without-Cable-/301662962733?epid=1888712201&hash=item463c83842d:g:r7cAAOSwDNdV5Xsh

My concern is that although it appears to have the ATmega32U4 (and thus usb - midi ok) and states it is a genuine Leonardo it also states it is a compatible device. Any Good?

PeterP.

Many thanks for your comments. I have exactly zero experience of using a auduino so where do I start? You are obviously Midi savvy so would make sense to me to start with your library. Am I correct in thinking that this is more a collection of individual building blocks which are assigned to the auduino in/outs accordingly?

Just a few questions on hardware issues. Am I correct in thinking that the Teensy has less in/out capability than its larger cousin? Also at my age ( mid 60's) connecting to the auduino may be an issue. It appears on looking at some that they have socket/plug configuration which would suit me. Is this correct?

Again, would welcom your comments,
Thanks,
Willy

A cursor look at the photos looks like a real one but is is coming from China and has a very low price so that means a clone. That might not even be the photograph of the board you get.

From one mid sixties man to another can I recommend to you my book

The link you posted is not an official Arduino board. It's not a clone either, it's just a fake copy. It should probably work nonetheless, however I wouldn't buy it, on principle.
I do sometimes buy Chinese clones though, boards with the same layout and components as a genuine Arduino, but that don't claim to be official Arduino boards.

If you buy a genuine Arduino product, you support the development of this platform. That's why they cost a little extra. Arduino is open source, so other manufacturers can use the same design and sell it. These boards are called clones, and are generally cheaper, because you only pay for hardware and manufacturing, not for hardware and software development.
Selling these clones under the name "Arduino" is illegal though.

Quality wise, in my personal experience, there is not really a significant difference between an official Arduino and a clone.

Pretty much any Arduino has the same pin spacing of 2.54mm (0.1"). The main difference is that boards like the Leonardo are pretty large, and you can plug things directly into the header connections. Teensies on the other hand, are much smaller. While you could connect some wires directly (either by soldering or by using female Dupont connectors), most people use it plugged into a breadboard.

The MIDI Controller library uses different objects for all your controls, it's very simple. For example, if you need 6 potentiometers, you create 6 Analog objects. If you want to add 20 buttons, you add 20 Digital objects.
Then in the loop, refresh the MIDI Controller indefinitely.

Take a look at the examples included with the library, that's the only way to really learn how to use it. If you want more information, you can check out the library documentation on the GitHub Wiki page, however, it is pretty extensive, and might be overwhelming if you're completely new to Arduino and C/C++ programming.

Apart from control elements (e.g. Analog and Digital), there are many other "building blocks" as well (custom MIDI outputs, IO expanders, banks of control elements, inputs to select which bank to use ...) but you don't really need them.

For example:

#include <MIDI_Controller.h> // Include the library

const uint8_t velocity = 0b1111111; // Maximum velocity (0b1111111 = 0x7F = 127)
const uint8_t channel = 1; // MIDI channel 1

// Create an array of 14 new instances of the class 'Digital', called 'buttons', 
// on pins 0,1, ..., 13 that send MIDI messages with notes 
// 12, 13, ..., 25 on MIDI channel 1, with maximum velocity (127)
Digital buttons[] = {
  { 0, 12, channel, velocity }, // button connected to pin 0, sends MIDI note 12 on channel 1 with velocity 127
  { 1, 13, channel, velocity },
  { 2, 14, channel, velocity },
  { 3, 15, channel, velocity },
  { 4, 16, channel, velocity },
  { 5, 17, channel, velocity },
  { 6, 18, channel, velocity },
  { 7, 19, channel, velocity },
  { 8, 20, channel, velocity },
  { 9, 21, channel, velocity },
  {10, 22, channel, velocity },
  {11, 23, channel, velocity },
  {12, 24, channel, velocity },
  {13, 25, channel, velocity }
};

// Create an array of 6 new instances of the class 'Analog', called 'potentiometers', 
// on pins A0, A1, .., A5 that send MIDI CC messages with controller numbers 16, 17, ... 21
// on MIDI channel 1
Analog potentiometers[] = {
  { A0, 16, channel }, // potentiometer connected to pin A0, sends CC #16 on MIDI channel 1
  { A1, 17, channel },
  { A2, 18, channel },
  { A3, 19, channel },
  { A4, 20, channel },
  { A5, 21, channel },
};

void setup() {} // nothing to set up

void loop() {  // Refresh the buttons and potentiometers (check whether a button's state or a potentiometer's position has changed since last time, if so, send it over MIDI)
  MIDI_Controller.refresh();
}

The MIDI Controller will automatically use the MIDI USB connection. You can use a different MIDI interface if you need to. (E.g. hardware MIDI or debug print MIDI events.)

Pieter

Hi Guys,

Many thanks as always for your comments.

From one mid sixties man to another can I recommend to you my book

Possibly Mike but as a complete beginner and having no prior knowledge would it be suitable?

If you buy a genuine Arduino product, you support the development of this platform.

Fair comment but how and where to purchase? As you said these clones are sold under the Auduino banner which is illegal. How doe's one deduce which is legal or not? Me I want the quality of a known product.

Pretty much any Arduino has the same pin spacing of 2.54mm (0.1"). The main difference is that boards like the Leonardo are pretty large, and you can plug things directly into the header connections. Teensies on the other hand, are much smaller. While you could connect some wires directly (either by soldering or by using female Dupont connectors), most people use it plugged into a breadboard.

The teensy is too small for I me thinks! Which auduino is the easiest to connect to mechanically/electrically? Can a pin/socket arrangement be used or breadboard headers? How do you connect the auduino to in out pins etc?

Apart from control elements (e.g. Analog and Digital), there are many other "building blocks" as well (custom MIDI outputs, IO expanders, banks of control elements, inputs to select which bank to use ...) but you don't really need them.

These elements are of interest to me as I gain more expierience

Am I correct in thinking that the auduino can be powered fromn the usb bus?

Peiter the example code. Is it ready to go? Is there more for me to learn?

It seems to me that all I need to change is analog cc no's?

Is it really that simple?

Sorry guys lots of questions I know but still a newby who has gained a little bit of knowledge!

Thanks,
Willy

Am I correct in thinking that the auduino can be powered fromn the usb bus?

Yes it can, but if you are powering it from the bus then you can also get the USB connection to carry the MIDI data.

It seems to me that all I need to change is analog cc no's?

In effect yes but:-

Is it really that simple?

While a cut and paste approach repeating sections of code will work it is very turgid and difficult to follow. You will do well to learn a bit about arrays and for loops to make your code much much shorter.

a complete beginner and having no prior knowledge would it be suitable?

While initially a lot of it might seem over your head when you first pick it up their is an introductory chapter that tells you about schematics and how to wire things up. The projects range from the very simple to the very complex so their is a lot of growing room in the book, as my mum used to say when she got me jackets much too big for me. :slight_smile:

Muso64:
Fair comment but how and where to purchase? As you said these clones are sold under the Auduino banner which is illegal. How doe's one deduce which is legal or not? Me I want the quality of a known product.

Either buy them from the online Arduino store directly, or from one of the official resellers. (Note that it's called Arduino, not Auduino.)

Muso64:
The teensy is too small for I me thinks! Which auduino is the easiest to connect to mechanically/electrically? Can a pin/socket arrangement be used or breadboard headers? How do you connect the auduino to in out pins etc?

Teensies being smaller than Arduinos is not really a problem, in my opinion. In many cases, it's actually an advantage. As mentioned before, the size and distance of the pins is exactly the same as any other Arduino.
You can use male Dupont connectors to connect wires to a normal Arduino. For breadboard-friendly Arduinos, such as the Micro, or Teensies, you can plug them into a breadboard for prototyping, or use female Dupont connectors.
Some Arduinos are available without any headers, so you can solder the wires directly to the PCB. This is great for the final version of your project, but not for prototyping, as soldering is pretty permanent.
Female headers + male Dupont connectors tend to come loose after some time (due to vibrations, shaking the device ...). Hot glue or tape helps, but I still prefer soldering my final product.

Muso64:
Peiter the example code. Is it ready to go? Is there more for me to learn?

It seems to me that all I need to change is analog cc no's?

Is it really that simple?

Yes, it should be ready to go.

If you were to write everything from scratch, it wouldn't be that simple, of course. Once you get everything working, and you are a bit more familiar with C++/Arduino, you can check out the actual implementation of the different classes in the MIDI Controller library: for example, the Analog class or the Digital class.

Pieter

Hi Grumpy Mike and PieterP,

Sorry for not responding sooner I have infact been busy with other aspects of this project!
I have decided to go with a teensie option using the Dupont connectors as suggested above.

If only for now, (I'll Be back) may I thank you both for all your comments and advice which was much appreciated.

Thanks,
Willy