This is a library for creating a MIDI controller using an Arduino or Teensy board.

Overview

MIDI controller

This is a library for creating a MIDI controller using an Arduino board.
It enables you to easily create MIDI controllers or instruments with very few lines of code. It supports digital inputs, like pushbuttons and switches, analog inputs, like faders, potentiometers, light sensors, and rotary encoders, like jogwheels. The library works on pretty much all Arduino and Teensy boards, like the Arduino Uno, Mega, Zero, Due, Leonardo, Micro, Teensy 3.2, ...

It uses a MIDI-over-USB connection to connect to your computer, and can be used in your favourite DJ or DAW software.

Control Surface

The MIDI Controller library has been obsoleted by its successor, the Control Surface library.

It has more features, a better architecture, unit tests, continuous integration, clearer documentation, support for more and newer Arduino boards, etc.
It adds support for MIDI input, SysEx, the Mackie Control Universal protocol, VU meters, LEDs, OLED displays, audio over USB, MIDI over Bluetooth, MIDI routing ...

https://github.com/tttapa/Control-Surface


Support

I no longer offer support for the MIDI Controller library, and I won't be adding any new features.
For new projects, it is highly recommended to use the Control Surface library instead of the MIDI Controller library.
Control Surface is well-supported, and new features are added regularly. It completely replaces MIDI Controller.
If you need help porting your existing MIDI Controller project to Control Surface, feel free to open an issue.

Download

Download the latest stable version here.
Please read the installation instructions first.

Features

Analog inputs

The library can take input from a variety of analog devices, such as variable resistors, potentiometers, linear faders, light sensors ...
It filters the inputs and applies hysteresis, to get smooth transitions and to reduce noise.
You have full control over the value mapping, control curves, and the range of the inputs.
Accuracy up to 10 bits supported using pitch bend events.

Analog inputs can be mapped to controls like volume, balance, effect parameters, EQ ...

Digital inputs

The library can be used with a wide range of digital inputs as well, like pushbuttons, latching switches, footswitches ...
Buttons are debounced and can be inverted if necessary.

Digital inputs can be mapped to controls like transport control (play/pause/stop/cue/... buttons), mute/solo/rec buttons, effect enable/disable, looping options, sample triggers ...

Button matrices

There is support for matrices of buttons as well. This allows you to use a very large number of buttons with only a limited number of IO pins.
Just like with Digital inputs, these buttons can be mapped to controls like transport control (play/pause/stop/cue/... buttons), mute/solo/rec buttons, effect enable/disable, looping options, sample triggers ...

Rotary encoders

Another way to input continuous values is by using rotary encoders or jog wheels. Unlike potentiometers, they can turn indefinitely, and allow for more precise controls.
The library has many settings for accuracy and speed.
Different MIDI modes are available for compatibility with a huge range of music production, DJ or DAW software.

Rotary encoders can be mapped to controls like volume, balance, effect parameters, EQ, jog wheels, timeline scrolling, library scrolling ...

MIDI over USB

The library will automatically detect what kind of Arduino-compatible board you are using, and it will use the USB connection for MIDI communication (if available). This means that you can just plug it into your computer or tablet (PC, Mac, Linux, iOS, Android ...), it will be automatically detected as a MIDI device, and you can start playing right away.
If your board doesn't support MIDI over USB, it will default to the Serial USB interface. More information on the MIDI over USB Wiki page.

For maximum flexibility, you can use the MIDI functions to send your own custom MIDI events, without having to worry about compatibility issues between different boards.
The debug mode allows you to print the MIDI events in the serial monitor for easier developing, testing and debugging.
MIDI interfaces on hardware serial ports as well as SoftwareSerial ports are supported as well, to use the controller with MIDI devices that use a 5-pin DIN MIDI connector.

Extended IO

Use analog multiplexers and shift registers to save IO pins. Using the Extended IO classes and the ExtIO namespace, you can treat them as if they were normal input/output pins, without having to worry about the actual implementation.

New in version 3.1.0

  • Improved filtering
  • Header-only rotary encoder classes to remove Encoder.h dependency

New in version 3.0.0

  • Completely reworked library structure
  • Added more MIDI interface options
  • Added ButtonMatrix control element
  • Added debounce for buttons
  • Automatically average analog inputs
  • Added Bank and BankSelector classes instead of bank() method per class
  • Added files containing constants to use Control Change controller names instead of magic numbers
  • Automatically refresh all MIDI Control elements at once
  • Added support for analog multiplexers and shift registers using Extended IO classes

New in version 2.1.0

  • Cleaner and more efficient code
  • Bank functionality for rotary encoders
  • Minor bug fixes

New in version 2.0.0

  • Easier access to debug mode using USBMidiController.begin(baud, true);
  • More examples
  • Minor bug fixes

Installation

Installing the MIDI_controller library

To install this library, download the latest version as a .ZIP file. Then open the Arduino IDE, go to Sketch > Include Library > Add .ZIP library, and open the .ZIP file you just downloaded.

Dependencies

The MIDI_controller library depends on the PJRC Encoder library for using rotary encoders and jog wheels. Download the .ZIP library from GitHub and install it.

If you are using an Arduino with native USB support, like the Leonardo, Due, Zero, Micro ... you'll need to install the MIDIUSB library. Install it using the Arduino IDE's library manager (Sketch > Include Library > Manage Libraries). Search for 'MIDIUSB', and install it. Alternatively, download the .ZIP library from GitHub and install it.

If you're using a Teensy board, you have to install the Arduino core for Teensy (aka Teensyduino). Download it here, if you haven't already.

Installing Atmel Flip or DFU-programmer (Uno and Mega only)

The Arduino Uno and Mega don't have native USB support, so they need extra firmware to be installed to the USB-to-Serial chip in order to work as a MIDI device. To flash this firmware, you have to install a DFU programmer. On Windows, you can use Atmel Flip. On OSX and Linux, install dfu-programmer.
Windows: Download and install Atmel Flip:

  1. Download the latest Java Runtime Environment from the Java site.
  2. Run the java installer.
  3. Click 'install'.
  4. Close the installer when finished.
  5. Download 'Flip' from the Atmel site.
  6. Run the installer.
  7. Click 'next'.
  8. Accept the terms in the License agreement and click 'next'.
  9. Click 'next'.
  10. Click 'install'.
  11. Click 'next' when completed.
  12. Click 'finished'.

Mac:
sudo port install dfu-programmer

Linux:
sudo apt-get install dfu-programmer

More information can be found here.


Using the library

Arduino boards with native USB support

Open one of the example sketches, connect your Arduino, select the right port from the Tools menu, and hit upload.

Teensy boards

Open one of the example sketches, connect your Teensy, select the right port from the Tools menu, select 'MIDI' (or 'Serial + MIDI') as the USB type, and hit upload.

Arduino Uno or Mega

Open one of the example sketches, connect your Arduino, select the right port from the Tools menu, and hit upload. When the upload is complete, take a ballpoint pen (or anything conductive) and reset the ATmega16U2 by connecting the reset pin of the 6-pin ISP header (next to the USB connector) to ground, as shown in the following picture. DFU-resetting the ATmega16U2

Windows

Install the drivers for the ATmega16U2:

  1. Make sure you have reset the ATmega16U2 to put it in DFU mode (Device Firmware Update). Read more here.
  2. Go to the Control Panel in Windows. Click 'Hardware and Sound'.
  3. Under 'Devices and Printers', click 'Device Manager'.
  4. In Device Manager, there is a category 'Other devices'. In this category, there should be something like 'Arduino Uno DFU' or 'ATmega16U2 DFU'. Right click the device, and select 'Update Driver Software'.
  5. Choose 'Browse my computer for driver software'
  6. Then hit 'Browse...' and browse to C:\Program Files\Atmel\Flip 3.4.7\usb in the new window.
  7. Make sure 'Include subfolders' is checked, then click 'Next'.
  8. In the Windows Security window that pops up, click 'Install'.
  9. You should get a notification that Windows has successfully updated the driver software for 'AT90USB162'.

Download the ATmega16U2 firmware:

  1. Download the Arduino firmware from the Arduino GitHub page: Arduino-usbserial-atmega16u2-Uno-Rev3.hex or Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex
  2. Download Dimitri Diakopoulos's HIDUINO firmware from his GitHub page: arduino_midi.hex

Flash the MIDI firmware:

  1. Open the Flip software.
  2. Hit CTRL+S to select a device, choose 'ATmega16U2', and click 'OK'.
  3. Hit CTRL+U, and click 'Open' to open the USB connection.
  4. Hit CTRL+L to load a HEX file.
  5. Browse to your Downloads folder and load the 'arduino_midi.hex' file you just downloaded.
  6. Make sure all 4 boxes on the left hand side are checked, and click 'Run'.
  7. Once this is finished, you can unplug the Arduino. Now it is no longer in DFU mode.
  8. Go back to the Device Manager, and check if the Arduino shows up as a MIDI device, under 'Sound, video and game controllers'.
  9. Now your Arduino is a working MIDI controller!
  10. To upload a new program, just repeat these same steps again, but use the Arduino firmware you downloaded previously.

OSX

==TODO==
(probably just transcoding the Linux Bash scripts to OSX Bash)

Linux

Go to the folder where you installed this library (usually ~/Arduino/libraries/MIDI_controller) and go to 'DFU scripts/Linux' and open it in a terminal. Then allow execution of the scripts:
chmod +x *

And run the script to flash the MIDI firmware:
./MIDI*
Type 'y' to confirm, and enter your root password if necessary. The script will download and install the firmware to the Arduino. When the script is finished, unplug the Arduino and plug it back in: your computer should now recognize it as a MIDI device.

Now that the MIDI firmware is running on the USB-to-Serial converter, you can't upload new sketches to the Arduino. To upload a new sketch, install the Arduino Serial firmware again: put the Arduino into DFU mode again, by connecting the reset pin to ground, and run the second script in the 'DFU scripts/Linux' folder:
./Serial*
This script will download the Arduino Serial firmware and install it to the Arduino. When it's finished, unplug the Arduino, plug it back in, and upload your new sketch.
Then you can install the MIDI firmware again.

MIDI over USB

Read more on how different boards use differents methods to send MIDI over USB in the Wiki.

Documentation

You can find the entire library documentation with a description of all available functions in the Wiki.

Hardware

In the Wiki, you can also find a page that explains how to connect the hardware, like pusbuttons, potentiometers and rotary encoders.

Examples

The library includes a whole lot of example sketches that demonstrate the usage of the library. You can find them under File > Examples > Examples from custom libraries > MIDI Controller or in the examples folder on GitHub.

Tested boards

I have tested this library with an Arduino Uno, an Arduino Leonardo and a Teensy 3.2.
Other users have successfully used the library with an Arduino Mega 2560 and an Arduino Micro.

Boards that use an FTDI USB-to-Serial chip (like the Nano and some older boards) do not support MIDI over USB, but can still use Serial MIDI.

If you try this library with a different board, please let me know whether it works or not. If it doesn't, please open an issue. Thanks!

Issues
  • Smoothing pots.

    Smoothing pots.

    Having problems with smoothing a potentiometer, when choosing the hires potentiometer exampe i get signal but it seems rather constant... and i really want single values so i dont loose midi info.

    I also had to manually include som librarys it couldn't find when i was trying to compile the code. I dont know why this problem keeps happening. Could it be because i dont have the librarys installed in the default folders.

    1 pot

    Arduino Leonardo

    Schematic: ?

    Software versions:

    MIDI Controller library: 3.0.0
    Arduino IDE: ? 1.8.5
    Operating System: Windows Operating System version: 10 (Teensyduino): ? 1.40 ? (Encoder library): Where do i find this? (MIDIUSB library): Where do i find this?

    Settings in the IDE

    Full code

    #include <Encoder.h>
    
    /*
    This is an example of the "AnalogHiRes" class of the MIDI_controller library.
    Connect a potentiometer to analog pin A0. It will send MIDI Pitch Bend messages on channel 1
    Map it in your DAW or DJ software.
    
    Written by Pieter P, 08-09-2017
    https://github.com/tttapa/MIDI_controller
    */
    
    #include <MIDI_Controller.h> // Include the library
    
    // Create a new instance of the class 'AnalogHiRes', called 'potentiometer', on pin A0, 
    // that sends MIDI Pitch Bend messages on channel 1
    AnalogHiRes potentiometer(A0, 1);
    
    void setup() {}
    
    void loop() {
      // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
      MIDI_Controller.refresh();
    }
    

    i pretty much just put in the encoder library manually as i was getting errors saying that it couldn't find it.

    i want to make a MIDI controller to control my DAW (FL Studio).

    opened by Birdy404 32
  • Rotary Encoder outputing strange things

    Rotary Encoder outputing strange things

    Description of the problem or question

    When i am using rotary encoders. They dont send Control Change, but some random stuff like timing clocks etc.

    Steps to reproduce the problem

    I used the example with RotaryEncoder

    Hardware

    Arduino Uno schema

    Software versions:

    **MIDI Controller library> latest Arduino IDE: ? 1.8.4 ?
    Operating System: ? Windows **Operating System version 10

    Settings in the IDE

    Full code

    /*
      This is an example of the "RotaryEncoder" class of the MIDI_controller library.
      Connect the A and B pins of the encoder to 2 interrupt pins (2 and 3). 
      It's recommended to use 100nF capacitors between the A and B pins and ground (hardware debounce).
      Connect the common (C) pin to the ground. Pull-up resistors are not necessary, since the internal ones will be used.
      Map the control change message 0x14 to the right control in your DJ or DAW software, 
      and select 'relative' instead of 'absolute'.
    
      If you are using a jog wheel, use JOG, if you are using a normal encoder 
      (for normal controls like EQ or volume etc.) use NORMAL_ENCODER.
      If you have strange results in your software, try a different relative mode: 
      TWOS_COMPLEMENT, BINARY_OFFSET or SIGN_MAGNITUDE.
      If the control works, but it goes in the wrong direction, swap the pins A and B of the encoder 
      (either physically, or by swapping the pin numbers in the RotaryEncoder constructor).
    
      Written by Pieter P, 22-08-2017
      https://github.com/tttapa/MIDI_controller
    */
    #define USE_ROTARY_ENCODER
    #include <MIDI_Controller.h>
    
    const uint8_t Channel = 1;       // MIDI channel 1
    const uint8_t Controller = 20; // MIDI Control Change controller number
    const int speedMultiply = 1;     // No change in speed of the encoder (number of steps is multiplied by 1)
    
    // Create a new instance of the class 'RotaryEncoder', called 'enc', on pin 2 and 3, controller number 0x14, on channel1,
    // no change in speed (speed is multiplied by 1), it's used as a jog wheel, and the sign mode is set to two's complement.
    RotaryEncoder encoder(2, 3, Controller, Channel, speedMultiply, JOG, TWOS_COMPLEMENT);
    
    void setup() {}
    
    void loop() {
      // Refresh the encoder (check whether the position has changed since last time, if so, send the difference over MIDI)
      MIDI_Controller.refresh();
    }
    

    Steps taken to try to diagnose or solve the problem

    ? Tried the MIDI debug mode, used a MIDI monitor, ... ?

    The goal of your project and aditional information

    reporting midi control change values into pc and the using them in light room schema

    opened by MistrKernnunos 20
  • Adding Sustain CC 64.

    Adding Sustain CC 64.

    Everything so far is working great, I am very happy with my midified organ. So far I have all potentiometers. How do I add a sustain pedal? This would be a digital input on cc# 64.

    opened by rabbiccu 17
  • Please add support for CD74HC4067 ! CD74HC4051 provide only 1-8pins

    Please add support for CD74HC4067 ! CD74HC4051 provide only 1-8pins

    Please add support for CD74HC4067 ! I want to use banksellector with this mux like i can do it now with CD74HC4051. Also option for DigitalMultiplexor will be nice.

    Bank pots(16);  
    BankSelector bankselector(pots, 10, LED_BUILTIN, BankSelector::MOMENTARY); 
    
    AnalogMultiplex multiplexer(A0, { 2, 3, 4, 5 } ); //CD74HC4067
    // Create 8 new instances of the class 'Analog', on the 8 pins of the multiplexer,
    // that send MIDI messages with controller 7 (channel volume) on channels 1 - 8
    Analog potentiometers[] = {
      {multiplexer.pin(0), MIDI_CC::Channel_Volume, 1},
      {multiplexer.pin(1), MIDI_CC::Channel_Volume, 2},
      {multiplexer.pin(2), MIDI_CC::Channel_Volume, 3},
      {multiplexer.pin(3), MIDI_CC::Channel_Volume, 4},
      {multiplexer.pin(4), MIDI_CC::Channel_Volume, 5},
      {multiplexer.pin(5), MIDI_CC::Channel_Volume, 6},
      {multiplexer.pin(6), MIDI_CC::Channel_Volume, 7},
      {multiplexer.pin(7), MIDI_CC::Channel_Volume, 8},
      {multiplexer.pin(8), MIDI_CC::Channel_Volume, 9},
      {multiplexer.pin(9), MIDI_CC::Channel_Volume, 10},
      {multiplexer.pin(10), MIDI_CC::Channel_Volume, 11},
      {multiplexer.pin(11), MIDI_CC::Channel_Volume, 12},
      {multiplexer.pin(12), MIDI_CC::Channel_Volume, 13},
      {multiplexer.pin(13), MIDI_CC::Channel_Volume, 14},
      {multiplexer.pin(14), MIDI_CC::Channel_Volume, 15},
      {multiplexer.pin(15), MIDI_CC::Channel_Volume, 16}
    };
    void setup() {
    pots.add(potentiometers, Bank::CHANGE_ADDRESS); // Add the control elements to the bank
    }
    

    CD74HC4067 :

    |pin4|pin3|pin2|pin1|Channel| |---|---|---|---|---| |on | on | on | on | 1| |on | on | on | off | 2| |on | on | off | on | 3| |on | on | off | off | 4| |on | off | on | on | 5| |on | off | on | off | 6| |on | off | off | on | 7| |on | off | off | off | 8| |off | on | on | on | 9| |off | on | on | off | 10| |off | on | off | on | 11| |off | on | off | off | 12| |off | off | on | on | 13| |off | off | on | off | 14| |off | off | off | on | 15| |off | off | off | off | 16|

    Maybe you can add something like "if (numPinsOut > 8) pinMode(5, OUTPUT);" , and both 4051 and 4067 will be supported at the same time. Also will be so cool if there is a any way to use encoders thru those multiplexers! If you make this work I will be so happy :) I believe many other ppl too! Thank you very much I know i will be easy task for you! Best regards!

    opened by userdsp 15
  • Mackie Protocol

    Mackie Protocol

    I have a prototype for mackie protocol controller that has multiple encoders controlling the same V-Pot output (controller 0x10 -0x17) but in different modes. (V-Pot is just mackie's name for the 8 encoders on a mackie control and modes are changed with a midi note)

    Library works great thanks. But I have to add a note on command before each of my encoders sends a CC, this works fine...except in JOG mode where the note commands overwhelm the CC.

    So really I just want to send the note commad each time a NEW controller is touched not before each CC command.

    I added a variable to the function like this in RotaryEncoder.cpp and RotaryEncoder.h

    RotaryEncoder::RotaryEncoder(uint8_t pinA, uint8_t pinB, uint8_t controllerNumber, uint8_t channel, int speedMultiply, uint8_t pulsesPerStep, relativeCCmode mode, int mackieID)

    Where MackieID is the note command that would normally change the V-Pot mode for the 8 encoders on a mackie control.

    so I have this in RotaryEncoder.cpp:

    value = enc.read();
    void RotaryEncoder::refresh() // Check if the encoder position has changed since last time, if so, send the relative movement over MIDI
    {
      long value = enc.read();
      long difference = (value - oldVal) / pulsesPerStep;   
      if (difference != 0)
        {
        USBMidiController.send(0x80, 1, mackieID, 127); // Send note to change the function of CCs 0x10 to 0x17 
        }
    
     while  (difference != 0)
       {
        if (difference > 15) // constrain relative movement to +/-15 for Mackie Control Universal compatibility
          difference = 15;
        if (difference < -15)
          difference = -15;
        uint8_t msgVal = mapRelativeCC(difference * speedMultiply, mode);
        if (bankEnabled && !digitalRead(bankPin))                        // if the bank mode is enabled, and the bank switch is in the 'alternative' position (i.e. if the switch is on (LOW))                                                                
          USBMidiController.send(CC, altChannel, altController, msgVal); // send a Control Change MIDI event with the 'alternative' channel and controller number
        else                                                             // if the bank mode is disabled, or the bank switch is in the normal position
          USBMidiController.send(CC, channel, controllerNumber, msgVal); // send a Control Change MIDI event with the normal, original channel and controller number
          oldVal += difference * pulsesPerStep; // If difference was in [-15, 15], difference * pulsesPerStep == value,
        // otherwise difference * pulsesPerStep == the value on the computer (after receiving the MIDI event above)
    value = enc.read();
    difference = (value - oldVal) / pulsesPerStep;
       }
    }
    

    I have tried adding another variable to store the lastSentMackieID either globally or for each instance of the RotaryEncoder class but can't seem to get it working. Any ideas would be greatly appreciated.

    opened by RussCoty 13
  • MIDI signals non-stop

    MIDI signals non-stop

    I have sporadic behavior when I go to tinker daily on this project. My faders (10k fader pots) have stopped working all together, although at one time I was able to get a logarithmic response from them.

    I have ordered a multimeter and will be testing my hardware, but is there any reason for this that could be software related? The following screenshot shows the flow of midi signals, never stopping.

    capture_midi

    I am using code mentioned in other issues I've opened:

    
    /*
    This is an example of the "Analog" class of the MIDI_controller library.
    Connect a potentiometer to analog pin A0. This will be the MIDI channel volume of channel 1.
    Map it in your DAW or DJ software.
    Set 'minimumValue' to the analog value read when the potentiometer is in the minimum position.
    Set 'maximumValue' to the analog value read when the potentiometer is in the maximum position.
    Written by Pieter P, 20-09-2017
    https://github.com/tttapa/MIDI_controller
    */
    
    #include <MIDI_Controller.h> // Include the library
    
    // Create a new instance of the class 'Analog', called 'potentiometer', on pin A0, 
    // that sends MIDI messages with controller 7 (channel volume) on channel 1
    Analog potentiometer_A(A0, MIDI_CC::Sound_Controller_1, 1);
    Analog potentiometer_B(A1, MIDI_CC::Sound_Controller_2, 1);
    Analog potentiometer_C(A2, MIDI_CC::Sound_Controller_3, 1);
    Analog potentiometer_D(A3, MIDI_CC::Sound_Controller_4, 1);
    Analog potentiometer_E(A4, MIDI_CC::Sound_Controller_5, 1);
    
    
    
    void setup() {
    
    }
    
    void loop() {
      // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
      MIDI_Controller.refresh();
    }
    

    Update

    I wired all inputs to the same pot (position 1 on my breadboard). All 5 messages were being received by MIDI-OX just fine. When I took the input for the second channel and put it to the second pot, the diarrhea began for that channel only. Same for the 3rd 4th and 5th. Any channel peeled off the first pot and put on its own pot become non-sense.

    So I thought maybe I only have one good pot, since all the inputs on the arduino are fine. So I took the pot from position 2 and put it in position 1. I wired all the inputs to the output of this fader 2 in position 1 and they worked. I went down the line and they all worked in position 1.

    I hope this makes sense. So this leads me believe 2 things. Unlikely, but is the code getting confused by having 5 unique inputs? Surely not. Another thing is maybe the wiring on my breadboard is wrong. There must be a configuration issue because each pot and each input on the arduino has proven it can work.

    I have a 5v going straight to the +bus bar and GND going to the negative and have each pot's pins jumping directly to that busbar. This really has me baffled - because the wiring works but only on a seemingly arbitrary place on the breadboard! Can distance from the 5v terminal cause a problem?

    Update 2

    I took everything off the breadboard and rewired the 5 pots to their own channels. Pots 1 2 & 3 were able to control their values but 4 and 5 (A3 and A4) were doing the diarrhea thing. I took a jumper and went from the corner where the initial 5v jump point is on the breadboard over to the other side near 4 and 5 and the diarrhea stopped, however they do not control their inputs, but have gone silent. I am totally baffled.

    Could the power supply be an issue? I can reliably operate the first three inputs, 4 and 5 are sporadic but if I gang them onto pot 1 I can control their inputs that way.

    opened by rabbiccu 12
  • No midi output over usb Teensy

    No midi output over usb Teensy

    Hello, I was trying your encoder example, and everything compiled fine but i don't get midi output. Im using a Teensy 3.1 with MIDI as the Usb type and all the needed libraries and software installed. The Led lights up when i move the encoder so the enc.refresh(); seems to work. I'm used to send midi using the pjrc library, like usbMIDI.sendControlChange for example. How does your library send midi over USB? Do i need to setup anything else?

    opened by mattlamperouge 12
  • Can not compile on Teensy++ 2.0

    Can not compile on Teensy++ 2.0

    Description of the problem or question

    Can not compile any of your examples on Teensy++ 2.0, since always it gives the following error: "Please select a 'Serial + MIDI' option in the 'Tools > USB Type' menu" But Teensy++ 2.0 did not offer the Serial + MIDI option. This option only exits from Teensy LC upwards to Teensy 3.6. I can select either USB or Serial.

    Teensy MIDI examples installed by Teensyduino Installer are compiling without problems.

    FYI: On my Pro Micro your examples are compiling without errors.

    Steps to reproduce the problem

    Have tested two different PC's using Win 10 and 7, also different Arduino IDE 1.6.x to 1.8.x and various Teensyduino. On both PC's the same result. Pro micro > yes, Teensy++ 2.0 >no.

    Hardware

    Teensy++ 2.0

    Software versions:

    MIDI Controller library: 3.0.1 Arduino IDE: 1.8.5 Operating System: Windows 7/10 (Teensyduino): 1.4.1
    (Encoder library): 1.4.1
    (MIDIUSB library): 1.0.3

    Full code

    for example:

    In file included from C:\Users\xxxx\Documents\Arduino\libraries\MIDI_controller-3.0.1\examples\Ex.13.Shift-Register\Ex.13.Shift-Register.ino:18:0:

    C:\Users\xxxx\Documents\Arduino\libraries\MIDI_controller-3.0.1\src/MIDI_Controller.h:7:2: error: #error Please select a 'Serial + MIDI' option in the 'Tools > USB Type' menu.

    #error Please select a 'Serial + MIDI' option in the 'Tools > USB Type' menu.

    ^

    Fehler beim Kompilieren für das Board Teensy++ 2.0.

    opened by DH1KLM 11
  • Compilation error

    Compilation error

    Hi, I'm trying to use your projet for mine.

    when I want to upload an exemple (Analog_array_exemple.ino), the arduino IDE display an error message :

    Arduino : 1.8.3 (Mac OS X), Carte : "Arduino/Genuino Uno"
    
    In file included from /Users/vjdobermann/Documents/Arduino/libraries/MIDI_controller-master/src/MIDI_controller.h:9:0,
                     from /Users/vjdobermann/Documents/Arduino/libraries/MIDI_controller-master/examples/Analog_array_example/Analog_array_example.ino:14:
    /Users/vjdobermann/Documents/Arduino/libraries/MIDI_controller-master/src/RotaryEncoder.h:6:21: fatal error: Encoder.h: No such file or directory
     #include "Encoder.h"
                         ^
    compilation terminated.
    exit status 1
    Erreur de compilation pour la carte Arduino/Genuino Uno
    

    what does it means ?

    opened by vjdobermann 10
  • buttons doing unexpected stuff

    buttons doing unexpected stuff

    Hi, i have a problem. I am using buttons conected to teensy 3,2 through mux (74hc4051). the core of it is that, i have two buttons, that when i press onei recive midi signals like i pushed both.

    Arduino board: ? Arduino UNO, Arduino Leonardo, Arduino DUE, Arduino MEGA, Arduino Micro, Teensy 3.2, ... ?
    Schematic: ?

    Software versions:

    MIDI Controller library: ? 3.1.0 ?
    **Arduino IDE: 1.8.5?
    Operating System: ? Windows Operating System version: ? 10 (Teensyduino): ? 1.42 ?

    Settings in the IDE

    midi+usb, max clock speed, but not overc

    Full code

    
    #define USE_ROTARY_ENCODER
    #include <MIDI_Controller.h>
    
    
    const uint8_t Channel = 1;       // MIDI channel 1
    const int speedMultiply = 1;     // No change in speed of the encoder (number of steps is multiplied by 1)
    
    RotaryEncoder encoder1(1, 0, 22, Channel, speedMultiply, 4, TWOS_COMPLEMENT);
    RotaryEncoder encoder2(3, 2, 24, Channel, speedMultiply, 4, TWOS_COMPLEMENT);
    RotaryEncoder encoder3(5, 4, 25, Channel, speedMultiply, 4, TWOS_COMPLEMENT);
    RotaryEncoder encoder4(7, 6, 26, Channel, speedMultiply, 4, TWOS_COMPLEMENT);
    RotaryEncoder encoder5(8, 9, 27, Channel, speedMultiply, 4, TWOS_COMPLEMENT);
    RotaryEncoder encoder6(10, 11, 28, Channel, speedMultiply, 4, TWOS_COMPLEMENT);
    RotaryEncoder encoder7(12, 13, 23, Channel, speedMultiply, 4, TWOS_COMPLEMENT);
    RotaryEncoder encoder8(14, 15, 21, Channel, speedMultiply, 4, TWOS_COMPLEMENT);
    
    
    
    
        //buttons
      AnalogMultiplex multiplexers[] = {
        
      {16,{19, 20, 21}},
      {17,{19, 20, 21}},
      {18,{19, 20, 21}}
      
      };
    
      DigitalCC buttons[] = {
    {multiplexers[0].pin(0), 6, 1},
    {multiplexers[0].pin(1), 5, 1},
    {multiplexers[0].pin(2), 4, 1},
    {multiplexers[0].pin(3), 2, 1},
    {multiplexers[0].pin(4), 7, 1},
    {multiplexers[0].pin(5), 8, 1},
    {multiplexers[0].pin(6), 3, 1},
    {multiplexers[0].pin(7), 1, 1},
    
    
    {multiplexers[1].pin(0), 37, 1},
    {multiplexers[1].pin(1), 38, 1},
    {multiplexers[1].pin(2), 44, 1},
    {multiplexers[1].pin(3), 39, 1},
    {multiplexers[1].pin(4), 32, 1},
    {multiplexers[1].pin(5), 45, 1},
    {multiplexers[1].pin(6), 43, 1},
    {multiplexers[1].pin(7), 33, 1},
    
    {multiplexers[2].pin(0), 35, 1},
    {multiplexers[2].pin(1), 31, 1},
    {multiplexers[2].pin(2), 36, 1},
    {multiplexers[2].pin(3), 42, 1},
    {multiplexers[2].pin(4), 41, 1},
    {multiplexers[2].pin(5), 34, 1},
    {multiplexers[2].pin(6), 30, 1},
    {multiplexers[2].pin(7), 40, 1},
      };
    
    void setup() {
      // put your setup code here, to run once:
    
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    MIDI_Controller.refresh();
    }
    

    Steps taken to try to diagnose or solve the problem

    photo of midi monitor obrazek

    opened by MistrKernnunos 9
  • No Midi Messages in Mixx or elsewhere, unable to re-establish connection with Leonardo.

    No Midi Messages in Mixx or elsewhere, unable to re-establish connection with Leonardo.

    Description of the problem or question

    Arduino shows up as a MIDI Contoller, but no MIDI messages being passed into Mixx program during learning. Configured the faders and pots with numerous wiring pinout and still nothing.

    Hardware

    Arduino Leonardo. B10k pots, B103 faders, breadboard. miniUSB-->Computer

    Software versions:

    MIDI Controller library: 3.0.1
    Arduino IDE: 1.6.8
    Operating System: Windows 10
    Operating System version: ? 10, 16.04, ... ?
    (Teensyduino): latest (Encoder library): latest
    (MIDIUSB library): latest (THESE LAST THREE ARE SET TO LATEST BECAUSE ANOTHER ISSUE. AFTER UPLOADING THE FIRST TIME I HAVE BEEN UNABLE TO UPLOAD AGAIN AS THE PORT MENU IN ARDUINO IDE IS GREYED OUT. I GET A ERROR MESSAGE ABOUT THE PORT NOT BEING THERE ) WHEN I TRY TO REUPLOAD TO ENSURE LIBRARY VERSIONS ETC I GET:

    `Arduino: 1.6.8 (Windows 10), Board: "TeeOnArdu, MIDI, 16 MHz, US English"
    
    C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\admin\AppData\Local\Arduino15\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\admin\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\admin\Documents\Arduino\libraries" -fqbn=TeeOnArdu:avr:TeeOnArdu:usb=midi,speed=16,keys=en-us -ide-version=10608 -build-path "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\admin\Desktop\MIDI_Controller_Leonardo_-_Analog\MIDI_Controller_Leonardo_-_Analog.ino"
    C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\admin\AppData\Local\Arduino15\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\admin\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\admin\Documents\Arduino\libraries" -fqbn=TeeOnArdu:avr:TeeOnArdu:usb=midi,speed=16,keys=en-us -ide-version=10608 -build-path "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp" -warnings=none -prefs=build.warn_data_percentage=75 -verbose "C:\Users\admin\Desktop\MIDI_Controller_Leonardo_-_Analog\MIDI_Controller_Leonardo_-_Analog.ino"
    WARNING: Spurious .github folder in 'MIDI controller' library
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10608 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Arduino"' '-DUSB_PRODUCT="TeeOnArdu"' -DUSB_MIDI -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\cores\TeeOnArdu" "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\variants\leonardo" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\sketch\MIDI_Controller_Leonardo_-_Analog.ino.cpp" -o "nul"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10608 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Arduino"' '-DUSB_PRODUCT="TeeOnArdu"' -DUSB_MIDI -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\cores\TeeOnArdu" "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\variants\leonardo" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\sketch\MIDI_Controller_Leonardo_-_Analog.ino.cpp" -o "nul"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10608 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Arduino"' '-DUSB_PRODUCT="TeeOnArdu"' -DUSB_MIDI -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\cores\TeeOnArdu" "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\variants\leonardo" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\sketch\MIDI_Controller_Leonardo_-_Analog.ino.cpp" -o "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
    "C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10608 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Arduino"' '-DUSB_PRODUCT="TeeOnArdu"' -DUSB_MIDI -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\cores\TeeOnArdu" "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\variants\leonardo" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\sketch\MIDI_Controller_Leonardo_-_Analog.ino.cpp" -o "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\sketch\MIDI_Controller_Leonardo_-_Analog.ino.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc" -c -g -x assembler-with-cpp -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10608 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR  -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Arduino"' '-DUSB_PRODUCT="TeeOnArdu"' -DUSB_MIDI -DLAYOUT_US_ENGLISH "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\cores\TeeOnArdu" "-IC:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\variants\leonardo" "C:\Program Files (x86)\Arduino\hardware\TeeOnArdu\avr\cores\TeeOnArdu\wiring_pulse.S" -o "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_pulse.S.o"
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\WInterrupts.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\hooks.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\keylayouts.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\teensyduino.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\usb.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_analog.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_digital.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_pulse.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_shift.c.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial0.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial1.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial2.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial3.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\IPAddress.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\Print.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\Stream.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\Tone.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\USBAPI.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\WMath.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\WString.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\abi.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\main.cpp.o
    Using previously compiled file: C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\new.cpp.o
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_pulse.S.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\WInterrupts.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\hooks.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\keylayouts.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\teensyduino.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\usb.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_analog.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_digital.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_pulse.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\wiring_shift.c.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial0.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial1.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial2.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\HardwareSerial3.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\IPAddress.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\Print.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\Stream.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\Tone.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\USBAPI.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\WMath.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\WString.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\abi.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\main.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-ar" rcs  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\core.a" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\core\new.cpp.o"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc" -w -Os -Wl,--gc-sections -mmcu=atmega32u4  -o "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp/MIDI_Controller_Leonardo_-_Analog.ino.elf" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp\sketch\MIDI_Controller_Leonardo_-_Analog.ino.cpp.o" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp/core\core.a" "-LC:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp" -lm
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp/MIDI_Controller_Leonardo_-_Analog.ino.elf" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp/MIDI_Controller_Leonardo_-_Analog.ino.eep"
    "C:\Users\admin\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-objcopy" -O ihex -R .eeprom  "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp/MIDI_Controller_Leonardo_-_Analog.ino.elf" "C:\Users\admin\AppData\Local\Temp\build05e956ed821e7a998eb94654329edf25.tmp/MIDI_Controller_Leonardo_-_Analog.ino.hex"
    
    Sketch uses 3,020 bytes (10%) of program storage space. Maximum is 28,672 bytes.
    Global variables use 197 bytes (7%) of dynamic memory, leaving 2,363 bytes for local variables. Maximum is 2,560 bytes.
    Couldn't find a Board on the selected port. Check that you have the correct port selected.  If it is correct, try pressing the board's reset button after initiating the upload.`
    

    Settings in the IDE

    Board: TeeOnArdu Processor: 16MHZ USB Type: MIDI NO PORT MENU, GREYED OUT Programmer: AVRISP mkII

    Full code

    ///* This is the code for the Arduino Leonardo, it will not work on the Uno. */
    
    /* These are constants: If you want to change the number of analog inputs, you can simply do it once on this line, instead of changing it everywhere in your code.*/
    #define NUMBER_OF_ANALOG_INPUTS  12 // The Leonardo has 12 analog inputs, we'll use all of them in this example. If you only need 6, change this to 6, and you'll be able to use A6 to A11 as normal I/O pins.
    
    #define CHANNEL  1 //Send all messages on channel 1
    
    /* The list with the corresponding controller numbers: for example, the values of the potentiometer on A0 will be sent as the first controller number in this list, A1 as the second, etc...
      Here's the list with all controller numbers:  http://midi.org/techspecs/midimessages.php#3  You can change them if you want.*/
    int controllers[NUMBER_OF_ANALOG_INPUTS] = {
      0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B
    };
    
    int analogVal[NUMBER_OF_ANALOG_INPUTS];  // We declare an array for the values from the analog inputs
    
    int analogOld[NUMBER_OF_ANALOG_INPUTS]; // We declare an array for the previous analog values.
    
    void setup() {
      for (int i = 0; i < NUMBER_OF_ANALOG_INPUTS; i++) { // We make the values of analogOld -1, so it will always be different from any possible analog reading.
        analogOld[i] = -1;
      }
      delay(1000);  // Wait 1 second before sending messages, to be sure everything is set up, and to make uploading new sketches easier.
    }
    
    void loop() {
      for (int i = 0; i < NUMBER_OF_ANALOG_INPUTS; i++) {                       // Repeat this procedure for every analog input.
        analogVal[i] = analogRead(i + A0) / 8;                                   // The resolution of the Arduino's ADC is 10 bit, and the MIDI message has only 7 bits, 10 - 7 = 3, so we divide by 2^3, or 8.
        if (analogVal[i] != analogOld[i]) {                                   // Only send the value, if it is a different value than last time.
          usbMIDI.sendControlChange(controllers[i], analogVal[i], CHANNEL);
          /* Send the MIDI control change message: choose the i'th controller in the array above, get the right value from the analogVal array, on the predefined channel.
            NOTE: the compiler will not recognize this command if you don't have TeeOnArdu installed, if the board type is not TeeOnArdu, or if the USB type is not set to MIDI.*/
          analogOld[i] = analogVal[i];                                        // Put the analog values in the array for old analog values, so we can compare the new values with the previous ones.
        }
      }
    
    }
    
    

    Steps taken to try to diagnose or solve the problem

    I have been trying to re-establish connection with the Arduino so I can upload some new code/libraries thinking there is probably an error somewhere in the current code. The Arduino does show up as a MIDI controller and has the ANALOG Example uploaded to it. Being locked out of the Arduino has hindered my ability to troubleshoot.

    The goal of your project and aditional information

    I want 9 Faders, 2 Knobs and an external TRS female jack for an expression pedal. I want this to run an organ VST's drawbars, overdrive, and expression pedal.

    opened by rabbiccu 9
  • Octave change for multiplexer buttons

    Octave change for multiplexer buttons

    Hey,

    Awesome library! Thanks.

    I have built my first midi keyboard with 2 octaves (piano layout, 24 keys). I am using two multiplexers to get all the inputs for my arduino pro micro.

    My first code was constructed from your multiplexer example. I made the multiplexer pinscorrespond the midi values for piano keys. This worked perfect, but what I would love to do is have a 3- way switch to change between octaves (add or substract 12 from each key value that is given for the multiplexers buttons) I tried to make "if" and "else" functions to the code...but because the loop function only has the midi_controller.refresh command, I dont understand how to make the uint8_t variables to change keys.

    I this kind of a octave change possible in the main code or does this require sone tweaks on the library?

    Wish to hear from you all though this library is quite old 😁.

    From Finland (sorry my bad english)

    opened by hajozo 4
  • [Feature request] Can you add support for piezo inputs?

    [Feature request] Can you add support for piezo inputs?

    Hello, i would like to see added support for piezo inputs (piezo connected over analog in)

    This is just to have a simple quiet pad that i can press. No need for velocity - i don't want to add a drum like pad

    Is that possible?

    I have seen that you previously closed similar issues with no explanation, so if you decline please tell me why.

    Thank you!

    PS. Love this lib..

    opened by marekhalmo 1
  • Create 4 midi banks controlled by 1 potentiometer

    Create 4 midi banks controlled by 1 potentiometer

    I have a working code and midi device for 16 buttons and 5 potentiometers. I want to use one of these potentiometers to choose between 4 banks notes. The notes need to be programmed into each bank, probably an array. The first bank is the one i got working already obviously, the only one, and it holds note numbers 45-60(c3-c4). i want bank2 to be 61-76, 3 to be 77-92, and 4 to be 92-107. This first bank is in an array already. I have this accomplished on an arduino uno using 2 8x1 MUX and a 2x1 MUX to act as the 4th selection bit to cover all 16 buttons. MUX1 is arduino pin 6, MUX2 is arduino pin 7, and MUX1 select pins go to pins 2,3,4 on arduino. A goes to 4, B goes to 3, C goes to 2. 2x1 MUX select is pin 5 and output is pin 8.

    Arduino Uno (0-13)(A0-A5)

    Using ddiakopoulos/hiduino flashed firmware. arduino is now native usb. I can use arduino as ISP(seperate arduino as programmer) to still upload sketches.)

    using Midi.h, controller.h, and <midi_controller.h> (can use control_surface if forced to.) Arduino 1.8.13 Windows 10 20h2 64 bit

    (The variables defined after the pots are defined are my attempts to try to make these banks work, they werent in the original working code. Its to give you guys an idea of what im trying to do. Take particular note of the getKey() function. that function is supposed to select the right note to play based on which button i have pressed(the variable pressed), and which bank im in which is determined by the position of A5. I want to use a click rotary encoder but dont have one so this pot is for testing purposes for now. The function is also supposed to map pot values 1-255 to 0, 256-512 to 1, 513-768 to bank 2, and 769-1023 to bank 3. This is supposed to simulate the encoder, although im not sure its needed. Next, note where i actually send the NoteOn command in the updateMuxButtons() function. (case 0) i Have added the "+ getKey(i)" there in an attempt to play the correct note based on which bank im in determined by all the above. Finally, you can take note of the bankSelect() function at the bottom, which may be a better solution overall. Right now i have the program variable set to 0 but im not sure this is correct. Ideally it needs to store all 64 notes in an array and know which one to pick based on which bank im in and which button i press. Can anyone help me?

    #include <MIDI.h>
    #include "Controller.h"
    #include <MIDI_Controller.h>
    
    /*************************************************************
      MIDI CONTROLLER
    
      by Notes and Volts
      www.notesandvolts.com
    
      Version 1.2 **Arduino UNO ONLY!**
     *************************************************************/
    
    MIDI_CREATE_DEFAULT_INSTANCE();
    
    //************************************************************
    //***SET THE NUMBER OF CONTROLS USED**************************
    //************************************************************
    //---How many buttons are connected directly to pins?---------
    byte NUMBER_BUTTONS = 0;
    //---How many potentiometers are connected directly to pins?--
    byte NUMBER_POTS = 5;
    //---How many buttons are connected to a multiplexer?---------
    byte NUMBER_MUX_BUTTONS = 16;
    //---How many potentiometers are connected to a multiplexer?--
    byte NUMBER_MUX_POTS = 0;
    //************************************************************
    
    //***ANY MULTIPLEXERS? (74HC4067)************************************
    //MUX address pins must be connected to Arduino UNO pins 2,3,4,5
    //A0 = PIN2, A1 = PIN3, A2 = PIN4, A3 = PIN5
    //*******************************************************************
    //Mux NAME (OUTPUT PIN, , How Many Mux Pins?(8 or 16) , Is It Analog?);
    
    
    Mux M1(6, 8, false); //Digital multiplexer on Arduino pin 10
    Mux M2(7, 8, false); //Analog multiplexer on Arduino analog pin A0
    //*******************************************************************
    
    
    //***DEFINE DIRECTLY CONNECTED POTENTIOMETERS************************
    //Pot (Pin Number, Command, CC Control, Channel Number)
    //**Command parameter is for future use**
    
    Pot PO1(A0, 0, 1, 1);
    Pot PO2(A1, 0, 1, 1);
    Pot PO3(A2, 0, 1, 1);
    Pot PO4(A3, 0, 1, 1);
    Pot PO5(A5, 0, 1, 1);
    
    const int potMax = 1023;
    int channel = 1
    int pressed;   // one of 16 buttons (1 - 16)
    int program = 0;   // one of 64 keys (0-63) on scale starting from C2
    int bank = 1234;  // one of 4 banks (1-4)
    
    //*******************************************************************
    //Add pots used to array below like this->  Pot *POTS[] {&PO1, &PO2, &PO3, &PO4, &PO5, &PO6};
    Pot *POTS[] {&PO1, &PO2, &PO3, &PO4, &PO5};
    //*******************************************************************
    
    
    //***DEFINE DIRECTLY CONNECTED BUTTONS*******************************
    //Button (Pin Number, Command, Note Number, Channel, Debounce Time)
    //** Command parameter 0=NOTE  1=CC  2=Toggle CC **
    
    //Button BU1(2, 0, 60, 1, 5 );
    //Button BU2(3, 0, 61, 1, 5 );
    //Button BU3(4, 0, 62, 1, 5 );
    //Button BU4(5, 0, 63, 1, 5 );
    //Button BU5(6, 0, 64, 1, 5 );
    //Button BU6(7, 0, 65, 1, 5 );
    //Button BU7(8, 1, 64, 1, 5 );
    //Button BU8(9, 2, 64, 1, 5 );
    //*******************************************************************
    //Add buttons used to array below like this->  Button *BUTTONS[] {&BU1, &BU2, &BU3, &BU4, &BU5, &BU6, &BU7, &BU8};
    Button *BUTTONS[] {};
    //*******************************************************************
    
    
    //***DEFINE BUTTONS CONNECTED TO MULTIPLEXER*************************
    //Button::Button(Mux mux, byte muxpin, byte command, byte value, byte channel, byte debounce)
    //** Command parameter 0=NOTE  1=CC  2=Toggle CC **
    
    Button MBU1(M1, 13, 0, 45, 1, 5);
    Button MBU2(M1, 14, 0, 46, 1, 5);
    Button MBU3(M1, 15, 0, 47, 1, 5);
    Button MBU4(M1, 12, 0, 48, 1, 5);
    Button MBU5(M1, 1, 0, 49, 1, 5);
    Button MBU6(M1, 5, 0, 50, 1, 5);
    Button MBU7(M1, 2, 0, 51, 1, 5);
    Button MBU8(M1, 4, 0, 52, 1, 5);
    Button MBU9(M2, 13, 0, 53, 1, 5);
    Button MBU10(M2, 14, 0, 54, 1, 5);
    Button MBU11(M2, 15, 0, 55, 1, 5);
    Button MBU12(M2, 12, 0, 56, 1, 5);
    Button MBU13(M2, 1, 0, 57, 1, 5);
    Button MBU14(M2, 5, 0, 58, 1, 5);
    Button MBU15(M2, 2, 0, 59, 1, 5);
    Button MBU16(M2, 4, 0, 60, 1, 5);
    //*******************************************************************
    ////Add multiplexed buttons used to array below like this->  Button *MUXBUTTONS[] {&MBU1, &MBU2, &MBU3, &MBU4, &MBU5, &MBU6.....};
    Button *MUXBUTTONS[] {&MBU1, &MBU2, &MBU3, &MBU4, &MBU5, &MBU6, &MBU7, &MBU8, &MBU9, &MBU10, &MBU11, &MBU12, &MBU13, &MBU14, &MBU15, &MBU16};
    
    //*******************************************************************
    
    
    //***DEFINE POTENTIOMETERS CONNECTED TO MULTIPLEXER*******************
    //Pot::Pot(Mux mux, byte muxpin, byte command, byte control, byte channel)
    //**Command parameter is for future use**
    
    //Pot MPO1(M2, 0, 0, 1, 1);
    //Pot MPO2(M2, 1, 0, 7, 1);
    //Pot MPO3(M2, 2, 0, 50, 1);
    //Pot MPO4(M2, 3, 0, 55, 2);
    //Pot MPO5(M2, 4, 0, 50, 1);
    //Pot MPO6(M2, 5, 0, 55, 2);
    //Pot MPO7(M2, 6, 0, 50, 1);
    //Pot MPO8(M2, 7, 0, 55, 2);
    //Pot MPO9(M2, 8, 0, 50, 1);
    //Pot MPO10(M2, 9, 0, 55, 2);
    //Pot MPO11(M2, 10, 0, 50, 1);
    //Pot MPO12(M2, 11, 0, 55, 2);
    //Pot MPO13(M2, 12, 0, 50, 1);
    //Pot MPO14(M2, 13, 0, 55, 2);
    //Pot MPO15(M2, 14, 0, 50, 1);
    //Pot MPO16(M2, 15, 0, 55, 2);
    //*******************************************************************
    //Add multiplexed pots used to array below like this->  Pot *MUXPOTS[] {&MPO1, &MPO2, &MPO3, &MPO4, &MPO5, &MPO6.....};
    Pot *MUXPOTS[] {};
    //*******************************************************************
    
    void setup() {
      MIDI.begin ();
    }
    
    int getKey(int pressed){
      bank = map(analogRead(A4), 0, potMax, 0, 3);  // this is the MONEY!!!
      return bank * 16 + pressed;
    }
    
    void loop() {
      if (NUMBER_BUTTONS != 0) updateButtons();
      if (NUMBER_POTS != 0) updatePots();
      if (NUMBER_MUX_BUTTONS != 0) updateMuxButtons();
      if (NUMBER_MUX_POTS != 0) updateMuxPots();
    }
    
    //*****************************************************************
    void updateButtons() {
    
      // Cycle through Button array
      for (int i = 0; i < NUMBER_BUTTONS; i = i + 1) {
        byte message = BUTTONS[i]->getValue();
    
        //  Button is pressed
        if (message == 0) {
          switch (BUTTONS[i]->Bcommand) {
            case 0: //Note
              MIDI.sendNoteOn(BUTTONS[i]->Bvalue, 127, BUTTONS[i]->Bchannel);
              break;
            case 1: //CC
              MIDI.sendControlChange(BUTTONS[i]->Bvalue, 127, BUTTONS[i]->Bchannel);
              break;
            case 2: //Toggle
              if (BUTTONS[i]->Btoggle == 0) {
                MIDI.sendControlChange(BUTTONS[i]->Bvalue, 127, BUTTONS[i]->Bchannel);
                BUTTONS[i]->Btoggle = 1;
              }
              else if (BUTTONS[i]->Btoggle == 1) {
                MIDI.sendControlChange(BUTTONS[i]->Bvalue, 0, BUTTONS[i]->Bchannel);
                BUTTONS[i]->Btoggle = 0;
              }
              break;
          }
        }
    
        //  Button is not pressed
        if (message == 1) {
          switch (BUTTONS[i]->Bcommand) {
            case 0:
              MIDI.sendNoteOff(BUTTONS[i]->Bvalue, 0, BUTTONS[i]->Bchannel);
              break;
            case 1:
              MIDI.sendControlChange(BUTTONS[i]->Bvalue, 0, BUTTONS[i]->Bchannel);
              break;
          }
        }
      }
    }
    //*******************************************************************
    void updateMuxButtons() {
    
      // Cycle through Mux Button array
      for (int i = 0; i < NUMBER_MUX_BUTTONS; i = i + 1) {
    
        MUXBUTTONS[i]->muxUpdate();
        byte message = MUXBUTTONS[i]->getValue();
    
        //  Button is pressed
        if (message == 0) {
          switch (MUXBUTTONS[i]->Bcommand) {
            case 0: //Note
              MIDI.sendNoteOn(MUXBUTTONS[i]->Bvalue + getKey(i), 127, MUXBUTTONS[i]->Bchannel);
              break;
            case 1: //CC
              MIDI.sendControlChange(MUXBUTTONS[i]->Bvalue, 127, MUXBUTTONS[i]->Bchannel);
              break;
            case 2: //Toggle
              if (MUXBUTTONS[i]->Btoggle == 0) {
                MIDI.sendControlChange(MUXBUTTONS[i]->Bvalue, 127, MUXBUTTONS[i]->Bchannel);
                MUXBUTTONS[i]->Btoggle = 1;
              }
              else if (MUXBUTTONS[i]->Btoggle == 1) {
                MIDI.sendControlChange(MUXBUTTONS[i]->Bvalue, 0, MUXBUTTONS[i]->Bchannel);
                MUXBUTTONS[i]->Btoggle = 0;
              }
              break;
          }
        }
        //  Button is not pressed
        if (message == 1) {
          switch (MUXBUTTONS[i]->Bcommand) {
            case 0:
              MIDI.sendNoteOff(MUXBUTTONS[i]->Bvalue + getKey(i), 0, MUXBUTTONS[i]->Bchannel);
              break;
            case 1:
              MIDI.sendControlChange(MUXBUTTONS[i]->Bvalue, 0, MUXBUTTONS[i]->Bchannel);
              break;
          }
        }
      }
    }
    //***********************************************************************
    void updatePots() {
      for (int i = 0; i < NUMBER_POTS; i = i + 1) {
        byte potmessage = POTS[i]->getValue();
        if (potmessage != 255) MIDI.sendControlChange(POTS[i]->Pcontrol, potmessage, POTS[i]->Pchannel);
      }
    }
    //***********************************************************************
    void updateMuxPots() {
      for (int i = 0; i < NUMBER_MUX_POTS; i = i + 1) {
        MUXPOTS[i]->muxUpdate();
        byte potmessage = MUXPOTS[i]->getValue();
        if (potmessage != 255) MIDI.sendControlChange(MUXPOTS[i]->Pcontrol, potmessage, MUXPOTS[i]->Pchannel);
      }
    }
    void bankSelect() {
      if (potMax <= 255) {
    MIDI_Controller.MIDI()->send(CONTROL_CHANGE, channel, MIDI_CC::Bank_Select,     (bank >> 4) & 0x7F);
    MIDI_Controller.MIDI()->send(CONTROL_CHANGE, channel, MIDI_CC::Bank_Select_LSB, (bank >> 0) & 0x7F); 
    MIDI_Controller.MIDI()->send(PROGRAM_CHANGE, channel, program);
      }...
    }
    

    MidiOx as monitor

    This is my capstone project for college and i appreciate all the help i can get! I hope this issue is understandable and solvable, im not seeing anywhere else of people using a pot as a bank selector. Short Summary of goal: 16 buttons, 4 banks (covers 64 of 88 keys) and 4 regular FX pots. Thanks guys!

    opened by brosekerg 3
  • Documentation

    Documentation

    Hello, good afternoon, first of all, thank you for your work, I think it is very good and useful, the second is that I am trying to see how the different functions of the library are used and I would like to know if apart from the examples, there is any more detailed documentation of each of the functions.

    A greeting

    opened by salmantino 1
  • Problem to reload the code

    Problem to reload the code

    Hello I followed the instructions you have detailed and everything works perfectly for me. The problem comes when i want to add more code to the board when the ATMega has already been updated, when i upload the code in the arduino ID it gives me error and does not let me. In the last part of your instructions you say that to put the code back you have to do it with the previously downloaded arduino fireware is only codes of numbers and letters and i do not understand it I hope it will help because i only need that to complete my project Sorry for my bad training, i have started this project for a very short time Thanks for your time Greetings

    opened by dagame1981 19
  • Use Momentary as Toggle

    Use Momentary as Toggle

    Hi! I'm super new at this and I'm sure this is a very simple task to achieve. I need to send CC messages to control Bias FX pedals and have done this so far: `#include <Control_Surface.h>

    HairlessMIDI_Interface midi;

    CCButton buttons[] = { {2, {MIDI_CC::Foot_Controller, CHANNEL_1}} };

    void setup() { // put your setup code here, to run once: Control_Surface.begin(); }

    void loop() { // put your main code here, to run repeatedly: Control_Surface.loop(); }`

    But every time I press the button it sends on (127) when I press and off (0) when I release the button. How can I change my code to make the button behave as a toggler?

    Huge thanks in advance!!

    opened by fristaildg 2
Releases(3.1.1)
  • 3.1.1(Aug 12, 2019)

  • 3.1.0(Aug 9, 2018)

  • 3.0.1(Nov 8, 2017)

  • 3.0.0(Sep 24, 2017)

    • Completely reworked library structure
    • Added more MIDI interface options
    • Added ButtonMatrix control element
    • Added debounce for buttons
    • Automatically average analog inputs
    • Added Bank and BankSelector classes instead of bank() method per class
    • Added files containing constants to use Control Change controller names instead of magic numbers
    • Automatically refresh all MIDI Control elements at once
    • Added support for analog multiplexers and shift registers using Extended IO classes
    • Bugfixes
    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Aug 17, 2017)

    Comments were added to all source files and they were made much more readable by formatting the code, by organizing the files using helper functions, and by renaming some of the variables. Large parts of the code for rotary encoders and for sending MIDI has been rewritten. Bank functionality was added to the RotaryEncoder class, along with new aliases for the different sign modes. Some examples were added as well.

    Source code(tar.gz)
    Source code(zip)
Owner
Pieter P
Pieter P
Library and command line backend for the Raspberry Pi OPL3 emulator and midi player

About this repository This repository holds the source code for the pioplemidi backend. You can compile it if you only want to use the library or the

iAmInAction 2 Dec 2, 2021
A C library to read standard MIDI files.

A C library to read standard MIDI files.

Philip Bennefall 19 Jul 1, 2022
OpenDeck is a platform suited both for prototyping and developing custom MIDI controllers with easy to use web configurator

Software and hardware platform for simpler building of MIDI controllers with support for DMX.

Shantea Controls 437 Aug 8, 2022
Wolf MidiCurve is a MIDI remapping plugin.

Wolf MidiCurve is a MIDI remapping plugin. It can be built as an LV2 or VST plugin and as a standalone Jack application.

Wolf Plugins 7 Nov 18, 2021
C++17 library for creating macOS Audio Server plugins.

libASPL Synopsis Instructions Versioning API reference Example driver Quick start Object model Types of setters Customization Thread and realtime safe

Victor Gaydov 26 Jul 27, 2022
RetroWave is a hardware sound board series that uses vintage sound chips and works with modern hardware.

RetroWave Authentic sounds from vintage sound chips, on modern hardware! Introduction RetroWave is a hardware sound board series that uses vintage sou

SudoMaker 45 Aug 8, 2022
Capture audio from a microphone on your Raspberry Pi Pico or any RP2040 based board. 🎤

Capture audio from a microphone on your Raspberry Pi Pico or any RP2040 based board. ??

Arm Developer Ecosystem 107 Jul 31, 2022
Arduino+Python to create a ultrasound sensor array based on the HC-SR04

Using the cheap HC-SR04 ultrasonic sensor and an arduino nano we can build a low cost sensor array for robotics. The arduino code will poll all the sensors and send byte packets via serial interface with the index and the distance to a Python app to process.

Alberto 26 Aug 2, 2022
Arduino Audio Tools (Music Player, Music Recorder supporting I2S, Microphones, DAC, ADC, A2DP, Url)

Arduino Audio Tools Some basic header-only C++ classes that can be used for Audio Processing provided as Arduino Library: a simple I2S class (to read

Phil Schatzmann 367 Aug 3, 2022
PendulumSynth is an on-going and open-source project, running on Arduino platform with the goal of mixing real-world physics into music composition and musical performance.

PendulumSynth PendulumSynth is an on-going and open-source project, running on Arduino platform with the goal of mixing real-world physics into music

Mohammadreza Anvari 4 Jun 19, 2022
A light-weight music Discord bot using Orca.

What's the "Music Discord bot with C"? A light-weight music Discord bot using Orca for it's bot. It's easy to use and install. How to download and use

ThePedro 9 Jul 18, 2022
An experimental music sequencer using Uxn, designed to run inside of sndkit.

uxnseq An experimental music sequencer using Uxn, designed to run inside of sndkit. The core motivation of this project to test how easily the Uxn VM

Paul Batchelor 6 Feb 6, 2022
A simple C++ library for reading and writing audio files.

AudioFile A simple header-only C++ library for reading and writing audio files. Current supported formats: WAV AIFF Author AudioFile is written and ma

Adam Stark 615 Aug 2, 2022
A C library for reading and writing sound files containing sampled audio data.

libsndfile libsndfile is a C library for reading and writing files containing sampled audio data. Authors The libsndfile project was originally develo

null 1k Aug 4, 2022
C library for cross-platform real-time audio input and output

libsoundio C library providing cross-platform audio input and output. The API is suitable for real-time software such as digital audio workstations as

Andrew Kelley 1.6k Aug 7, 2022
C++ Audio and Music DSP Library

_____ _____ ___ __ _ _____ __ __ __ ____ ____ / \\_ \\ \/ / |/ \| | | | \_ \/ \ | Y Y \/ /_ \> <| | Y Y \ | |_|

Mick Grierson 1.3k Aug 3, 2022
Single file audio playback and capture library written in C.

A single file library for audio playback and capture. Example - Documentation - Supported Platforms - Backends - Major Features - Building - Unofficia

David Reid 2.4k Aug 10, 2022
Minimalistic MP3 decoder single header library

minimp3 Minimalistic, single-header library for decoding MP3. minimp3 is designed to be small, fast (with SSE and NEON support), and accurate (ISO con

Lion 1.2k Aug 8, 2022
🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)

Verovio is a fast, portable and lightweight library for engraving Music Encoding Initiative (MEI) digital scores into SVG images. Verovio also contain

RISM Switzerland 493 Aug 3, 2022