Teensy Midi Controller Project Advice/Journal

Status
Not open for further replies.

briandtinker

Well-known member
Just ordered a Teensy 3.2 with the pins and 5 momentary footswitches.

I plan to have more switches than this and make a more ambitious controller in the future but this will be my first arduino project.

Purpose of the controller is to use with guitar vst plugins on PC

I think it should be relatively simple.

5 buttons. In mode 1 they send PC change codes to change presets on vst or maybe to select channel on or off in reaper or something like that.

in mode 2 they work as CC code changes to turn on and off different fx in the patch.

I want to have one of the buttons work to change which mode I am either by a long press or by a double tap or something like that.

Any advice is great. Not sure where to start...just have seen some have done it.
 
Do you have any programming experience?

Good to start small. Great thing with your project plan is the hardware can stay static as you learn to implement the features you want.

If you plan on staying with a small number of switches you can start with the example code for buttons and just keep adding features.

But if you have plans for many more switches is may be beneficial to start with a version that uses arrays to keep track of switch parameters. Some find arrays confusing but they allow you to build 'for' loops to cycle through each switch with the same code.

Here are some example files using arrays I've posted in the past:

For an array based controller you can have a look at my example sketch (which also includes an analog section for potentiometers but this can be removed or just commented out from the main loop).
https://forum.pjrc.com/threads/45376-Example-code-for-MIDI-controllers-with-Pots-and-Buttons
This sketch is also in the example files that load with Teensyduino (I'm told I never checked after updating).

For toggle control you ignore the switch when it disconnects and look only for when it connects but you then need an array to keep track of what the current state is so you know the correct message to send on the next toggle.
https://forum.pjrc.com/threads/3816...ING-in-Ableton?p=119491&viewfull=1#post119491


For mode or banks to be added you need to also track which bank is selected and what messages are sent for each bank.
Two-dimensional arrays makes this easy but only once you understand arrays.
This example uses a dedicated button to change modes but you could instead change the mode only if the contact (risingEdge) and release (fallingEdge) are at least two seconds apart on the switch that doubles to select mode/bank.
https://forum.pjrc.com/threads/49532-MIDI-Foot-Controller?p=167619&viewfull=1#post167619


Start small, consider doing the basic tutorials first.
When you get stuck come ask questions here but please post your code and a careful description and/or photo of your breadboard/prototype.
 
I mean i am familiar with HTML coding and CSS classes and ids and styling code things like that. I am fairly confident I could pick up the programming relatively quickly.
 
the end result im looking for is to have a row of preset control with bank up and down. 5 presets and then bank up and down

then i want to have switches for stomps. maybe 5. I want to have maybe something for tap tempo too.

Will want to eventually include LCD readouts for the switches. And eventually if I get really in depth with presets...would like to customize the CC code per stomp with custom label when the preset is loaded. IE when I pick PC 1 it sets the stomp labels to specific words.

Including a looper controls will be good too.

Would love to have a large LCD to readout things eventually like reading tuner information from the PC VST if possible.
 
Great... it's very different kind of programming but it helps to have any coding background.

If you get very lost with the basics you might want to try the tutorials under 'getting started' from the web site.
 
ok the teensy and footswitches arrived today. want to get some software loaded on the board before i wire it up to the switches.

I installed arduino and then the teensyduino files. opened arduino and set my board to teensy 3.2 and set usb to midi.

now it wants me to write code and i have no idea how to start. where should i look for help?
 
i found this sample code that I might be able to use to learn on.

right away by reading his notation i would want to change the mode toggling from a switch to long press from one of the switches.

Code:
/* Simple Teensy DIY USB-MIDI controller.
  Created by Liam Lacey, based on the Teensy USB-MIDI Buttons example code.

   Contains 8 push buttons for sending MIDI messages,
   and a toggle switch for setting whether the buttons
   send note messages or CC messages.

   The toggle switch is connected to input pin 0,
   and the push buttons are connected to input pins 1 - 8.

   You must select MIDI from the "Tools > USB Type" menu for this code to compile.

   To change the name of the USB-MIDI device, edit the STR_PRODUCT define
   in the /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/usb_midi/usb_private.h
   file. You may need to clear your computers cache of MIDI devices for the name change to be applied.

   See https://www.pjrc.com/teensy/td_midi.html for the Teensy MIDI library documentation.

*/

#include <Bounce.h>

//The number of push buttons
const int NUM_OF_BUTTONS = 8;

// the MIDI channel number to send messages
const int MIDI_CHAN = 1;

// Create Bounce objects for each button and switch. The Bounce object
// automatically deals with contact chatter or "bounce", and
// it makes detecting changes very simple.
// 5 = 5 ms debounce time which is appropriate for good quality mechanical push buttons.
// If a button is too "sensitive" to rapid touch, you can increase this time.

//button debounce time
const int DEBOUNCE_TIME = 5;

Bounce buttons[NUM_OF_BUTTONS + 1] =
{
  Bounce (0, DEBOUNCE_TIME),
  Bounce (1, DEBOUNCE_TIME),
  Bounce (2, DEBOUNCE_TIME),
  Bounce (3, DEBOUNCE_TIME),
  Bounce (4, DEBOUNCE_TIME),
  Bounce (5, DEBOUNCE_TIME),
  Bounce (6, DEBOUNCE_TIME),
  Bounce (7, DEBOUNCE_TIME),
  Bounce (8, DEBOUNCE_TIME)
};

const int MIDI_MODE_NOTES = 0;
const int MIDI_MODE_CCS = 1;

//Variable that stores the current MIDI mode of the device (what type of messages the push buttons send).
int midiMode = MIDI_MODE_NOTES;

//Arrays the store the exact note and CC messages each push button will send.
const int MIDI_NOTE_NUMS[NUM_OF_BUTTONS] = {40, 41, 42, 43, 36, 37, 38, 39};
const int MIDI_NOTE_VELS[NUM_OF_BUTTONS] = {110, 110, 110, 110, 110, 110, 110, 110};
const int MIDI_CC_NUMS[NUM_OF_BUTTONS] = {24, 25, 26, 27, 20, 21, 22, 23};
const int MIDI_CC_VALS[NUM_OF_BUTTONS] = {127, 127, 127, 127, 127, 127, 127, 127};

//==============================================================================
//==============================================================================
//==============================================================================
//The setup function. Called once when the Teensy is turned on or restarted

void setup()
{
  // Configure the pins for input mode with pullup resistors.
  // The buttons/switch connect from each pin to ground.  When
  // the button is pressed/on, the pin reads LOW because the button
  // shorts it to ground.  When released/off, the pin reads HIGH
  // because the pullup resistor connects to +5 volts inside
  // the chip.  LOW for "on", and HIGH for "off" may seem
  // backwards, but using the on-chip pullup resistors is very
  // convenient.  The scheme is called "active low", and it's
  // very commonly used in electronics... so much that the chip
  // has built-in pullup resistors!

  for (int i = 0; i < NUM_OF_BUTTONS + 1; i++)
  {
    pinMode (i, INPUT_PULLUP);
  }

}

//==============================================================================
//==============================================================================
//==============================================================================
//The loop function. Called over-and-over once the setup function has been called.

void loop()
{
  //==============================================================================
  // Update all the buttons/switch. There should not be any long
  // delays in loop(), so this runs repetitively at a rate
  // faster than the buttons could be pressed and released.
  for (int i = 0; i < NUM_OF_BUTTONS + 1; i++)
  {
    buttons[i].update();
  }

  //==============================================================================
  // Check the status of each push button

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

    //========================================
    // Check each button for "falling" edge.
    // Falling = high (not pressed - voltage from pullup resistor) to low (pressed - button connects pin to ground)

    if (buttons[i + 1].fallingEdge())
    {
      //If in note mode send a MIDI note-on message.
      //Else send a CC message.
      if (midiMode == MIDI_MODE_NOTES)
        usbMIDI.sendNoteOn (MIDI_NOTE_NUMS[i], MIDI_NOTE_VELS[i], MIDI_CHAN);
      else
        usbMIDI.sendControlChange (MIDI_CC_NUMS[i], MIDI_CC_VALS[i], MIDI_CHAN);
    }

    //========================================
    // Check each button for "rising" edge
    // Rising = low (pressed - button connects pin to ground) to high (not pressed - voltage from pullup resistor)

    else if (buttons[i + 1].risingEdge())
    {
      //If in note mode send a MIDI note-off message.
      //Else send a CC message with a value of 0.
      if (midiMode == MIDI_MODE_NOTES)
        usbMIDI.sendNoteOff (MIDI_NOTE_NUMS[i], 0, MIDI_CHAN);
      else
        usbMIDI.sendControlChange (MIDI_CC_NUMS[i], 0, MIDI_CHAN);
    }

  } //for (int i = 0; i < NUM_OF_BUTTONS; i++)

  //==============================================================================
  // Check the status of the toggle switch, and set the MIDI mode based on this.
  if (buttons[0].fallingEdge())
  {
    midiMode = MIDI_MODE_NOTES;
  }
  else if (buttons[0].risingEdge())
  {
    midiMode = MIDI_MODE_CCS;
  }

  //==============================================================================
  // MIDI Controllers should discard incoming MIDI messages.
  // http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
  while (usbMIDI.read())
  {
    // ignoring incoming messages, so don't do anything here.
  }
  
}
 
i guess i would change const int NUM_OF_BUTTONS = 8; to 5 since i have 5 buttons and then I will have 5 bounces.

Read that Bounce is how to detect the state of the switch. Mine are momentary spst's

const int MIDI_MODE_NOTES = 0;
const int MIDI_MODE_CCS = 1;

//Variable that stores the current MIDI mode of the device (what type of messages the push buttons send).
int midiMode = MIDI_MODE_NOTES;

Are notes the same as PC changes? I might not even need to differentiate between CC and PC.

I will be using this in Reaper for now, either turning an fx on or off or switching a channel on or off which can all be done with either PC or CC i imagine.

I will want the long press to either change from PC to CC or to add 1 to each value so I get double the amount of switches
 
Here's the changes to reduce to five buttons and a to make button 0 both an event button and a mode-select button when held for more than 2 seconds:
Code:
#include <Bounce.h>

elapsedMillis modeHold;
boolean held;

//The number of push buttons
const int NUM_OF_BUTTONS = 5;

// the MIDI channel number to send messages
const int MIDI_CHAN = 1;

// Create Bounce objects for each button and switch. The Bounce object
// automatically deals with contact chatter or "bounce", and
// it makes detecting changes very simple.
// 5 = 5 ms debounce time which is appropriate for good quality mechanical push buttons.
// If a button is too "sensitive" to rapid touch, you can increase this time.

//button debounce time
const int DEBOUNCE_TIME = 5;

Bounce buttons[NUM_OF_BUTTONS] =
{
  Bounce (0, DEBOUNCE_TIME),
  Bounce (1, DEBOUNCE_TIME),
  Bounce (2, DEBOUNCE_TIME),
  Bounce (3, DEBOUNCE_TIME),
  Bounce (4, DEBOUNCE_TIME)/*,
  Bounce (5, DEBOUNCE_TIME),
  Bounce (6, DEBOUNCE_TIME),
  Bounce (7, DEBOUNCE_TIME),
  Bounce (8, DEBOUNCE_TIME)*/
};

const int MIDI_MODE_NOTES = 0;
const int MIDI_MODE_CCS = 1;

//Variable that stores the current MIDI mode of the device (what type of messages the push buttons send).
int midiMode = MIDI_MODE_NOTES;

//Arrays the store the exact note and CC messages each push button will send.
const int MIDI_NOTE_NUMS[NUM_OF_BUTTONS] = {41, 42, 43, 36, 37};
const int MIDI_NOTE_VELS[NUM_OF_BUTTONS] = {110, 110, 110, 110, 110};
const int MIDI_CC_NUMS[NUM_OF_BUTTONS] = {24, 25, 26, 27, 20};
const int MIDI_CC_VALS[NUM_OF_BUTTONS] = {127, 127, 127, 127, 127};

//==============================================================================
//==============================================================================
//==============================================================================
//The setup function. Called once when the Teensy is turned on or restarted

void setup()
{
  // Configure the pins for input mode with pullup resistors.
  // The buttons/switch connect from each pin to ground.  When
  // the button is pressed/on, the pin reads LOW because the button
  // shorts it to ground.  When released/off, the pin reads HIGH
  // because the pullup resistor connects to +5 volts inside
  // the chip.  LOW for "on", and HIGH for "off" may seem
  // backwards, but using the on-chip pullup resistors is very
  // convenient.  The scheme is called "active low", and it's
  // very commonly used in electronics... so much that the chip
  // has built-in pullup resistors!

  for (int i = 0; i < NUM_OF_BUTTONS + 1; i++)
  {
    pinMode (i, INPUT_PULLUP);
  }

}

//==============================================================================
//==============================================================================
//==============================================================================
//The loop function. Called over-and-over once the setup function has been called.

void loop()
{
  //==============================================================================
  // Update all the buttons/switch. There should not be any long
  // delays in loop(), so this runs repetitively at a rate
  // faster than the buttons could be pressed and released.
  for (int i = 0; i < NUM_OF_BUTTONS; i++)
  {
    buttons[i].update();
  }

  //==============================================================================
  // Check the status of each push button

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

    //========================================
    // Check each button for "falling" edge.
    // Falling = high (not pressed - voltage from pullup resistor) to low (pressed - button connects pin to ground)

    if (buttons[i].fallingEdge())
    {
      //If in note mode send a MIDI note-on message.
      //Else send a CC message.
      if (midiMode == MIDI_MODE_NOTES)
        usbMIDI.sendNoteOn (MIDI_NOTE_NUMS[i], MIDI_NOTE_VELS[i], MIDI_CHAN);
      else
        usbMIDI.sendControlChange (MIDI_CC_NUMS[i], MIDI_CC_VALS[i], MIDI_CHAN);
    }

    //========================================
    // Check each button for "rising" edge
    // Rising = low (pressed - button connects pin to ground) to high (not pressed - voltage from pullup resistor)

    else if (buttons[i].risingEdge())
    {
      //If in note mode send a MIDI note-off message.
      //Else send a CC message with a value of 0.
      if (midiMode == MIDI_MODE_NOTES)
        
        usbMIDI.sendNoteOff (MIDI_NOTE_NUMS[i], 0, MIDI_CHAN);
    else 
        usbMIDI.sendControlChange (MIDI_CC_NUMS[i], 0, MIDI_CHAN);// do you want to turn off the effect when the button is released??
    }

  } //for (int i = 0; i < NUM_OF_BUTTONS; i++)

  //==============================================================================
  // Check the status of the toggle switch, and set the MIDI mode based on this.
  if (buttons[0].fallingEdge())
  {
    //midiMode = MIDI_MODE_NOTES;
    held = true;
    [COLOR="#FF0000"]modeHold = 0;[/COLOR]
  }
  else if (buttons[0].risingEdge())
  {
    if (held && modeHold>2000){
      if (midiMode==MIDI_MODE_CCS) {
        midiMode = MIDI_MODE_NOTES;
      } else {
        midiMode = MIDI_MODE_CCS;
      }
    }
    held = false;
  }

  //==============================================================================
  // MIDI Controllers should discard incoming MIDI messages.
  // http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
  while (usbMIDI.read())
  {
    // ignoring incoming messages, so don't do anything here.
  }
  
}

Mostly it's just taking out the separate button for mode select and all the +1's that added to the code.

Beside that is a somewhat awkward scheme to recall whether the special control button is currently held and to change mode once it's more than 2000 milliseconds.

But it does not give you toggle behavior which requires an array to track the state of the button (since you can't use which edge is detected to know wether to send off or on in the next one).



...will post that one shortly but the variables change and I thought you might want to try to find the changes in getting the mode and number of switches to work.
 
Last edited:
maybe the code for this is not right then. I think the first thing I need to figure out is what codes are actually needed to do the switching. I have not figured that out yet.

Do I need to haveanthing in between the switches and the pins on the board?
 
the way you wrote it makes me think the the mode is changed only when it is held down and that when you lift the foot off the switch it will revert back to the other mode.

is that correct?
 
...

Do I need to have anthing in between the switches and the pins on the board?
Nothing... I'm testing with a piece of wire between the ground and pins on a breadboard -- no switches at all but it still works.

the way you wrote it makes me think the the mode is changed only when it is held down and that when you lift the foot off the switch it will revert back to the other mode.

is that correct?
No... I have toggle working on the mode... you hold down switch zero for two seconds and the mode will change.

I don't have toggle working with the CC messages but I'd assume these would be for latching effects and so we'll need to add a active memory array to keep track of them.

Oh... I think I screwed up... it looked like it was working for me but now not so much.

Looks like I wasn't resetting the timer to zero so of course it was not working

see red code line in above post
 
Last edited:
...I think the first thing I need to figure out is what codes are actually needed to do the switching. I have not figured that out yet.
...
That can be the last thing you do... but to test you need to be able to see what midi messages you are generating or you have no chance of troubleshooting problems.

You need some kind of MIDI monitoring software that will show you exactly which messages are being sent.

Trying to use the software you want to control to test if things are working can lead to frustration as you chase dead ends
 
oh ok so after holding switch zero for 2 seconds the mode changes. So that means for mode PC i need to assign the switches PC codes in these arrays?

Code:
//Arrays the store the exact note and CC messages each push button will send.
const int MIDI_NOTE_NUMS[NUM_OF_BUTTONS] = {41, 42, 43, 36, 37};
const int MIDI_NOTE_VELS[NUM_OF_BUTTONS] = {110, 110, 110, 110, 110};
const int MIDI_CC_NUMS[NUM_OF_BUTTONS] = {24, 25, 26, 27, 20};
const int MIDI_CC_VALS[NUM_OF_BUTTONS] = {127, 127, 127, 127, 127};
 
yes of course. was trying to get a base program in place before wiring everything up.

Now i have just the teensy and 5 switches and some cat5 cable I can tear up for wire and a solderin iron.

Will i need anything other than that to wire it all up?
 
Try this... looks like it was working but I should have turned the BOUNCE time way up to use with a wire to ground.
Code:
#include <Bounce.h>

elapsedMillis modeHold;
boolean held;
const int NUM_OF_BUTTONS = 5;
const int MIDI_CHAN = 1;
const int DEBOUNCE_TIME = 5;

Bounce buttons[NUM_OF_BUTTONS] =
{
  Bounce (0, DEBOUNCE_TIME),
  Bounce (1, DEBOUNCE_TIME),
  Bounce (2, DEBOUNCE_TIME),
  Bounce (3, DEBOUNCE_TIME),
  Bounce (4, DEBOUNCE_TIME)
};

const int MIDI_MODE_NOTES = 0;
const int MIDI_MODE_CCS = 1;

int midiMode = MIDI_MODE_NOTES;

const int MIDI_NOTE_NUMS[NUM_OF_BUTTONS] = {41, 42, 43, 36, 37};
const int MIDI_NOTE_VELS[NUM_OF_BUTTONS] = {110, 110, 110, 110, 110};
const int MIDI_CC_NUMS[NUM_OF_BUTTONS] = {24, 25, 26, 27, 20};
const int MIDI_CC_D2_ON = 127;
const int MIDI_CC_D2_OFF = 0;

boolean MIDI_CC_STATE[NUM_OF_BUTTONS] ;

void setup(){
  for (int i = 0; i < NUM_OF_BUTTONS + 1; i++)
  {
  pinMode (i, INPUT_PULLUP);
  }
}

void loop(){
  for (int i = 0; i < NUM_OF_BUTTONS; i++)  {
    buttons[i].update();
  
    if (buttons[i].fallingEdge()){
      if (midiMode == MIDI_MODE_NOTES){
        usbMIDI.sendNoteOn (MIDI_NOTE_NUMS[i], MIDI_NOTE_VELS[i], MIDI_CHAN);
      } else {
        if (MIDI_CC_STATE[i]){
          usbMIDI.sendControlChange (MIDI_CC_NUMS[i], MIDI_CC_D2_OFF, MIDI_CHAN);
        }else{
          usbMIDI.sendControlChange (MIDI_CC_NUMS[i], MIDI_CC_D2_ON, MIDI_CHAN);
        }
          modeHold = 0;
        MIDI_CC_STATE[i] = !MIDI_CC_STATE[i] ;// toggle state in memory to match message sent
      }

    } else if (buttons[i].risingEdge()) {
      if (midiMode == MIDI_MODE_NOTES){
        usbMIDI.sendNoteOff (MIDI_NOTE_NUMS[i], 0, MIDI_CHAN);
      } else {
        // do nothing on rising edge in CC mode
      }    
    }
  } //for (int i = 0; i < NUM_OF_BUTTONS; i++)


  if (buttons[0].fallingEdge()) {
    held = true;
  } else if (buttons[0].risingEdge()) {
    if (held && modeHold>2000){
      if (midiMode==MIDI_MODE_CCS) {
        midiMode = MIDI_MODE_NOTES;
      } else {
        midiMode = MIDI_MODE_CCS;
      }
      modeHold = 0;
    }
    held = false;
  }
  
  while (usbMIDI.read())  {
  // ignoring incoming messages, so don't do anything here.
  }
}
Sorry but I stripped out all the comments. Funny but all the tricky stuff in that sketch was uncommitted but there's a full paragraph on active low signaling.
 
oh ok so after holding switch zero for 2 seconds the mode changes. So that means for mode PC i need to assign the switches PC codes in these arrays?

Code:
//Arrays the store the exact note and CC messages each push button will send.
const int MIDI_NOTE_NUMS[NUM_OF_BUTTONS] = {41, 42, 43, 36, 37};
const int MIDI_NOTE_VELS[NUM_OF_BUTTONS] = {110, 110, 110, 110, 110};
const int MIDI_CC_NUMS[NUM_OF_BUTTONS] = {24, 25, 26, 27, 20};
const int MIDI_CC_VALS[NUM_OF_BUTTONS] = {127, 127, 127, 127, 127};
Almost... CC is not the same as program change

usbMIDI.sendControlChange(control, value, channel);
usbMIDI.sendProgramChange(program, channel);


I suspect CC will work better with your DAW if you want to turn an effect off and on because the value parameter contains the off/on info (0 / 127).

But these are the arrays. MIDI_CC_NUMS holds the CC control. I don't see the point of the value array for ON values.. I'd have used a single scalar const.

yes of course. was trying to get a base program in place before wiring everything up.

Now i have just the teensy and 5 switches and some cat5 cable I can tear up for wire and a solderin iron.

Will i need anything other than that to wire it all up?
If you really just want five buttons the it's as simple as wiring them to ground on one side and the pin on the other... note this sketch does not allow you to configure the pin numbers so you need to use the first five 0-4. This can be changed if you want.
 
If you really just want five buttons the it's as simple as wiring them to ground on one side and the pin on the other... note this sketch does not allow you to configure the pin numbers so you need to use the first five 0-4. This can be changed if you want.

Should say why this is... Teensy has switchable, internal pull-up resistors that, when configured, return the pin to HIGH voltage when there is no connection to ground. This is what the code in the setup loop is for. Each pin is set up as an input and with the pullup resistor active.

https://www.pjrc.com/teensy/td_digital.html
 
Almost... CC is not the same as program change

usbMIDI.sendControlChange(control, value, channel);
usbMIDI.sendProgramChange(program, channel);


I suspect CC will work better with your DAW if you want to turn an effect off and on because the value parameter contains the off/on info (0 / 127).

But these are the arrays. MIDI_CC_NUMS holds the CC control. I don't see the point of the value array for ON values.. I'd have used a single scalar const.

If you really just want five buttons the it's as simple as wiring them to ground on one side and the pin on the other... note this sketch does not allow you to configure the pin numbers so you need to use the first five 0-4. This can be changed if you want.

ok I am going to wire this up when I get home today and open up Reaper and try out some midi learn functions...see what it is expecting for changes
 
MIDI learn with latching can be tricky... I don't recall what Reaper is like but the problem is telling the software which is off and which is on without sending both while it's figuring it out.

Sometimes it's easier to use manual assignment features rather than MIDI-learn.

You may be disappointed with one aspect of this sketch's behaviour. You can't switch modes without sending a message from button zero before you give the two-second pause and there's really nothing you can do about it if you want your messages sent on contact (fallingEdge). A dedicated switch may be preferable.
 
MIDI learn with latching can be tricky... I don't recall what Reaper is like but the problem is telling the software which is off and which is on without sending both while it's figuring it out.

Sometimes it's easier to use manual assignment features rather than MIDI-learn.

You may be disappointed with one aspect of this sketch's behaviour. You can't switch modes without sending a message from button zero before you give the two-second pause and there's really nothing you can do about it if you want your messages sent on contact (fallingEdge). A dedicated switch may be preferable.

Maybe I should write it differently then?

Maybe I have something where a long press changes the bank. And Each button on long press loads up a bank of 5 PC codes.
that way I could just declare what those 25 codes are and use only those to program whatever VST or DAW switching i need.
 
so my knowledge of midi is based on PC being definintive commands and CC being like on and off things. Maybe I am not going for the right goal here. I can use one PC code to assign to multiple things in the DAW i believe so I might only need something with banks.
 
actually if i am going to use Reaper SWS live config extension to program my live presets then I will have to use CC codes in my controller. The extension uses CC codes for all of its switching.
 
If you are not using to play sounds (where synchronization is important) then you can have the CC messages that change the DAW sent only on the release of the button.

With that change I think you'll get much closer to an ideal setup as you can supress the CC associated with the button when you're holding it to change the bank.


I suggest we take the A/B bank example from my first post here and change it as follows:

Note on/off becomes CC 127/0
Send CC only on releasing the witch (risingEdge) and only if timer is below 2000 mS
Reset timer on fallingEdge - start counting the timer only when a switch is down
If timer > 2000 mS when risingEdge is detected then toggle mode/bank and do not send CC for the button pressed

FYI - with this scheme we could make it so it changes mode if ANY button is held for >2000ms.

If this sounds OK to you let me know and I'll make a version with these changes later tonight.
 
Status
Not open for further replies.
Back
Top