Help Needed: MIDI Controller with Arduino Pro Micro in Neural DSP

Hi everyone,

I am working on a DIY MIDI controller using an Arduino Pro Micro, and I have an issue when I am using with Neural DSP. My MIDI controller works perfectly fine in Reaper, and also test with MidiView. However, I can not get it to function with Neural DSP even though it is recognized as a MIDI device. MIDI Channel and CC are the same when using both Reaper and Neural DSP.

Thanks in advance!

i did not understand what should this mean

sorry for my english, I mean that in Reaper i assign midi button channel 1 and cc#1 to mute the track and it works, but when I assign my channel 1 and cc#1 to activate OD-1 pedal in Neural DSP it does not response.

ah, ok, because it sounds like you're plugging Reaper and NDSP into the Micro at the same time.
can you see NDSP receive midi signals?

I can not find where is the MIDI message in NDSP but the MIDI learn function in NDSP is also not working in both plugin version and standalone version.

maybe NSDP have own forum or discord channel, maybe developers are already working on this issue.
just to be sure you can post code sketch and schematic diagram, maybe something is not as usual. do not forget put code between CODE tags

here is the code

/*
  Based on Sketch built by Gustavo Silveira (aka Music Nerd)
  Modified by Dolce Wang

  This code is only for Arduinos that use ATmega32u4 (like Micro, Pro Micro, Leonardo...)
  Remember to also assign the correct board in the IDE (like Tools / Boards / Sparkfun AVR / Pro Micro...)

*/

// Change any fields with //**


// LIBRARY

#include "MIDIUSB.h"  

// BUTTONS
const int NButtons = 1; //***  total number of buttons
const int buttonPin[NButtons] = {10}; //*** define Digital Pins connected from Buttons to Arduino; (ie {10, 16, 14, 15, 6, 7, 8, 9, 2, 3, 4, 5}; 12 buttons)
                                            
int buttonCState[NButtons] = {};        // stores the button current value
int buttonPState[NButtons] = {};        // stores the button previous value

      
// debounce
unsigned long lastDebounceTime[NButtons] = {0};  // the last time the output pin was toggled
unsigned long debounceDelay = 50;    //** the debounce time; increase if the output flickers


// POTENTIOMETERS
const int NPots = 8; //*** total number of pots (knobs and faders)
const int potPin[NPots] = {A9, A8, A7, A6, A3, A2, A1, A0}; //*** define Analog Pins connected from Pots to Arduino; Leave nothing in the array if 0 pots {}
int potCState[NPots] = {0}; // Current state of the pot; delete 0 if 0 pots
int potPState[NPots] = {0}; // Previous state of the pot; delete 0 if 0 pots
int potVar = 0; // Difference between the current and previous state of the pot

int midiCState[NPots] = {0}; // Current state of the midi value; delete 0 if 0 pots
int midiPState[NPots] = {0}; // Previous state of the midi value; delete 0 if 0 pots

const int TIMEOUT = 300; //* Amount of time the potentiometer will be read after it exceeds the varThreshold
const int varThreshold = 10; //* Threshold for the potentiometer signal variation
boolean potMoving = true; // If the potentiometer is moving
unsigned long PTime[NPots] = {0}; // Previously stored time; delete 0 if 0 pots
unsigned long timer[NPots] = {0}; // Stores the time that has elapsed since the timer was reset; delete 0 if 0 pots


// MIDI Assignments 
byte midiCh = 1; //* MIDI channel to be used
byte note = 36; //* Lowest note to be used; 36 = C2; 60 = Middle C
byte cc = 1; //* Lowest MIDI CC to be used


// SETUP
void setup() {

  // Baud Rate
  // 31250 for MIDI class compliant | 115200 for Hairless MIDI

  // Buttons
  // Initialize buttons with pull up resistors
  for (int i = 0; i < NButtons; i++) {
    pinMode(buttonPin[i], INPUT_PULLUP);
  }

}

////
// LOOP
void loop() {

  buttons();
  // potentiometers();

}

////
// BUTTONS
void buttons() {

  for (int i = 0; i < NButtons; i++) {

    buttonCState[i] = digitalRead(buttonPin[i]);  // read pins from arduino

    if ((millis() - lastDebounceTime[i]) > debounceDelay) {

      if (buttonPState[i] != buttonCState[i]) {
        lastDebounceTime[i] = millis();

        if (buttonCState[i] == LOW) {

          // Sends the MIDI note ON 
          
         // use if using with ATmega32U4 (micro, pro micro, leonardo...)
          // noteOn(midiCh, note + i, 127);  // channel, note, velocity
          controlChange(1,1,127);
          MidiUSB.flush();


        }
        else {

          // Sends the MIDI note OFF accordingly to the chosen board

          // use if using with ATmega32U4 (micro, pro micro, leonardo...)
          // noteOn(midiCh, note + i, 0);  // channel, note, velocity
          controlChange(1,1,0);
          MidiUSB.flush();

        }
        buttonPState[i] = buttonCState[i];
      }
    }
  }
}

////
// POTENTIOMETERS
void potentiometers() {


  for (int i = 0; i < NPots; i++) { // Loops through all the potentiometers

    potCState[i] = analogRead(potPin[i]); // reads the pins from arduino

    midiCState[i] = map(potCState[i], 0, 1023, 0, 127); // Maps the reading of the potCState to a value usable in midi

    potVar = abs(potCState[i] - potPState[i]); // Calculates the absolute value between the difference between the current and previous state of the pot

    if (potVar > varThreshold) { // Opens the gate if the potentiometer variation is greater than the threshold
      PTime[i] = millis(); // Stores the previous time
    }

    timer[i] = millis() - PTime[i]; // Resets the timer 11000 - 11000 = 0ms

    if (timer[i] < TIMEOUT) { // If the timer is less than the maximum allowed time it means that the potentiometer is still moving
      potMoving = true;
    }
    else {
      potMoving = false;
    }

    if (potMoving == true) { // If the potentiometer is still moving, send the change control
      if (midiPState[i] != midiCState[i]) {

        // Sends  MIDI CC 
        // Use if using with ATmega32U4 (micro, pro micro, leonardo...)
        controlChange(midiCh, cc + i, midiCState[i]); //  (channel, CC number,  CC value)
        MidiUSB.flush();

        potPState[i] = potCState[i]; // Stores the current reading of the potentiometer to compare with the next
        midiPState[i] = midiCState[i];
      }
    }
  }
}


// if using with ATmega32U4 (micro, pro micro, leonardo...)


// Arduino MIDI functions MIDIUSB Library
void noteOn(byte channel, byte pitch, byte velocity) {
  midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity};
  MidiUSB.sendMIDI(noteOn);
}

void noteOff(byte channel, byte pitch, byte velocity) {
  midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity};
  MidiUSB.sendMIDI(noteOff);
}

void controlChange(byte channel, byte control, byte value) {
  midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value};
  MidiUSB.sendMIDI(event);
}

one button?!

yes, I have only 1 button.

#include "MIDIUSB.h"

void setup() {
  pinMode(10, INPUT_PULLUP);
}

void loop() {
  static uint32_t lastDebounceTime = 0;
  static bool buttonPState = false;
  bool buttonCState = digitalRead(10);  // read pins from arduino

  if ((millis() - lastDebounceTime) > 20) {

    if (buttonPState != buttonCState) {
      lastDebounceTime = millis();

      if (buttonCState == LOW)controlChange(1, 1, 127);
      else controlChange(1, 1, 0);
      buttonPState = buttonCState;
    }
  }
}

void controlChange(byte channel, byte control, byte value) {
  midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value};
  MidiUSB.sendMIDI(event);
  MidiUSB.flush();
}

i have watched one video about "QuadCore" by NeualDSP and not seen it take ControlChange commands . is it possible that it eat only NoteOn/Off? if it do, try this sketch:

#include "MIDIUSB.h"

void setup() {
  pinMode(10, INPUT_PULLUP);
}

void loop() {
  static uint32_t lastDebounceTime = 0;
  static bool buttonPState = false;
  bool buttonCState = digitalRead(10);  // read pins from arduino
  if ((millis() - lastDebounceTime) > 20) {
    if (buttonPState != buttonCState) {
      lastDebounceTime = millis();
      if (buttonCState == LOW)go(1, 36, 127);
      else go(1, 36, 0);
      buttonPState = buttonCState;
    }
  }
}

void go(byte channel, byte Byte1, byte value) {
  midiEventPacket_t event = {0x09, 0x90 | channel, Byte1, value};
  MidiUSB.sendMIDI(event);
  MidiUSB.flush();
}
1 Like

I think the NDSP can recieve CC but I will try using NoteOn/Off.

I can not fill that input if Type are CC Absolute/ CC toggle/ CC Relative

what about CC Value ?
grafik

127 when I press the button and 0 when I release it.

i mean:
grafik


Only True and Flase can be selected, and not working for both value.

it is difficult without manual

Now I am sure that the problem is with NDSP. Today, I brought a MIDI keyboard controller, and the NDSP does not respond to it either.

Thanks @kolaha for helping me