Author Topic: Midi CC to PC switching interface  (Read 2166 times)

Steviebabes

Midi CC to PC switching interface
« on: February 11, 2019, 03:56:58 PM »
Hi,

Has any one built or considered building a CC to PC converter?

I've got a Boss GT 100 and it can only send PC changes when you select a patch.
My Blackstar Series One Amp happily receives PC changes.

The Boss can send CC messages from within a patch  and what I'd like to do though is change amp channels from within a patch.

It can be done with a Midi Solutions Event Processor (http://midisolutions.com/prodevp.htm)

It would be quite nice to do it as DIY box on something like an Ardurino :)

Can anyone point me in the right direction??

Thanks in advance

ElectricDruid

Re: Midi CC to PC switching interface
« Reply #1 on: February 11, 2019, 06:08:31 PM »
That should be simple to do with an Arduino. You'd need a MIDI shield of some sort (haven't looked, but there must be plenty of those). There's certainly library functions that do most of the MIDI nitty-gritty for you. After that, it'd be a question of keeping track of what's coming in, spotting the message(s) you're interested in, and sending the other one(s) instead.

Eminently do-able. Go for it.

HTH,
Tom

Ben N

  • Awesome!
  • ****
  • Posts: 4176
  • Total likes: 351
  • Ben N. - really! Now Israel, once Baltimore
Re: Midi CC to PC switching interface
« Reply #2 on: February 12, 2019, 03:46:10 AM »
... You'd need a MIDI shield of some sort (haven't looked, but there must be plenty of those).
Easy enough to roll your own, too. Coupla 5-pin jacks, optocouplers, and resistors, and a bit of perfboard, and wahla.
« Last Edit: February 12, 2019, 03:47:55 AM by Ben N »

potul

Re: Midi CC to PC switching interface
« Reply #3 on: February 12, 2019, 08:40:58 AM »
It's a perfect project for a small arduino. You don't even need any shield, just some resistors and an optocoupler will do the trick.
There are a couple of MIDI libraries ready to be used that you can grab.
You can take my MIDI Switcher project as a starting point, and change the relay control for a MIDI OUT function. The hardware is even there (both MIDI OUT and IN), although I only used MIDI IN in the software

https://www.diystompboxes.com/smfforum/index.php?topic=112424.0

I can help with the software changes, drop me a message if you want me to help.

Mat

ElectricDruid

Re: Midi CC to PC switching interface
« Reply #4 on: February 12, 2019, 03:29:19 PM »
... You'd need a MIDI shield of some sort (haven't looked, but there must be plenty of those).
Easy enough to roll your own, too. Coupla 5-pin jacks, optocouplers, and resistors, and a bit of perfboard, and wahla.

It is indeed. The general IN/OUT/THRU schematic looks like this:

https://electricdruid.net/wp-content/uploads/2016/04/MIDISchematic-3.jpg


Steviebabes

Re: Midi CC to PC switching interface
« Reply #5 on: February 12, 2019, 05:54:28 PM »
Hi Guys,

Thanks in advance for the offers of help  - I've ordered some bits and will be back in touch when they arrive :)

I'm a bit confused, will I need the opto - isolators or can the Midi sockets connect straight on to the board?

Steve

ElectricDruid

Re: Midi CC to PC switching interface
« Reply #6 on: February 13, 2019, 08:47:00 AM »
In order to meet the MIDI spec, the IN needs an optoisolator. Since all MIDI Inputs are opto-isolated, there's no need for outs or thrus to have optos.

In fact, you can wire a MIDI OUT from a processor with just a plug and a couple of resistors. It can be fantastically simple. The IN circuit is always more complicated.

HTH,
Tom

potul

Re: Midi CC to PC switching interface
« Reply #7 on: February 13, 2019, 10:32:21 AM »
Hi Guys,

Thanks in advance for the offers of help  - I've ordered some bits and will be back in touch when they arrive :)

I'm a bit confused, will I need the opto - isolators or can the Midi sockets connect straight on to the board?

Steve

You need it for MIDI IN. Take a look at my project, you have a midi in and out already there using a 6n138 opto. With this and 4 resistors you have both midi in and out setup.


Willypp

Re: Midi CC to PC switching interface
« Reply #8 on: June 29, 2020, 09:57:17 PM »
This is something I'm massively interested in.  I have a Boss MS-3 and can only send PC changes on patch changes too.  Some devices like the Iridium and Neuron can accept a full range of CC# to control pretty much anything, but I'm looking at a Mooer Preamp Live which only accepts PC....
« Last Edit: July 01, 2020, 06:58:49 AM by Willypp »

potul

Re: Midi CC to PC switching interface
« Reply #9 on: July 02, 2020, 02:16:38 AM »
If I understand it right, you need a device that converts PC messages into CC messages, right?

Take into account that PC messages do not have any parameter, while CC messages have a 0-127 parameter... so it's not really a direct match, you will need to define what CC number AND CC value to use for each PC.

Do you have this clear?

Willypp

Re: Midi CC to PC switching interface
« Reply #10 on: July 02, 2020, 07:28:48 PM »
Other way around, sorry.

I want to send something on, say, CC16, with a value of y, and convert it to a PC with the same value of y.

So CC16, 1, would become PC1

potul

Re: Midi CC to PC switching interface
« Reply #11 on: July 03, 2020, 03:25:01 AM »
This code should do the trick.  Any incoming CC messages in controller number 16 will generate a PC message.
I haven't tested it myself, but it should work as is.

Code: [Select]
#include <MIDI.h>

#define CCNUMBER 16   //The CC number that will be monitored and converted to PC messages

MIDI_CREATE_DEFAULT_INSTANCE();

// -----------------------------------------------------------------------------
// This function will be automatically called when a CC message is received.
// if the CC number matches CCNUMBER confifured above, it will send a PC message
// with the program number matching the CC value, and using the same MIDI channel.

void handleCC(byte channel, byte number, byte value)
{
   if (number==CCNUMBER){
    MIDI.sendProgramChange(value,channel);
   }
}

// -----------------------------------------------------------------------------

void setup()
{
    // Connect the handleCC function to the library,
    // so it is called upon reception of a CC message
    MIDI.setHandleControlChange(handleCC);  // Put only the name of the function

    // Initiate MIDI communications, listen to all channels
    MIDI.begin(MIDI_CHANNEL_OMNI);
}

void loop()
{
    // Call MIDI.read the fastest you can for real-time performance.
    MIDI.read();

}

Willypp

Re: Midi CC to PC switching interface
« Reply #12 on: July 03, 2020, 05:01:34 AM »
Holy hell.... that was quick, and fairly simple.  Wow.  Thanks heaps. I'm just waiting for my arduino stuff to arrive and I'll give it a crack.

Willypp

Re: Midi CC to PC switching interface
« Reply #13 on: July 09, 2020, 07:18:25 AM »
Well, the code has compiled and uploaded ok.  Going to hook up all the other stuff around it and see if I can't mess this up.

Willypp

Re: Midi CC to PC switching interface
« Reply #14 on: July 13, 2020, 09:18:31 PM »
Ok, I have a little black box with this layout all hooked up - but - does Pin 2 on the Midi In need to go to Pin 2 on the Midi Out?

potul

Re: Midi CC to PC switching interface
« Reply #15 on: July 14, 2020, 03:04:58 AM »
No

Midi In pin 2 is left unconnected, and Midi OUT pin 2 is connected to ground. Something like this:





Willypp

Re: Midi CC to PC switching interface
« Reply #16 on: August 01, 2020, 08:36:55 AM »
Well, I've built it.  I'm just waiting for another midi patch cable and my Mooer Preamp Live to arrive...





Willypp

Re: Midi CC to PC switching interface
« Reply #18 on: August 15, 2020, 06:36:33 AM »
My build doesn't seem to be working, it doesn't even pass PC commands atm (the midi works if I connect directly from MS-3 to Mooer Preamp Live).  I have another nano I'll have a crack with, but I also have a Uno midi shield and Uno on the way to try.  I've probably got my pins hooked up wrong or something.
« Last Edit: August 15, 2020, 07:50:59 AM by Willypp »

ElectricDruid

Re: Midi CC to PC switching interface
« Reply #19 on: August 15, 2020, 11:49:13 AM »
Have you got some way you can get the MIDI output into the computer? A MIDI monitor program is invaluable for MIDI debugging.

I once got stuck for days with some MIDI code. It was sending bytes, but nothing was being understood at the other end. Eventually when I thought to feed it to a MIDI monitor I discovered all the byte values were wrong - I'd been sending the data back to front!!