Midi CC to PC switching interface

Started by Steviebabes, February 11, 2019, 03:56:58 PM

Previous topic - Next topic

Steviebabes

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

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

#2
Quote from: ElectricDruid on February 11, 2019, 06:08:31 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.
  • SUPPORTER

potul

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

Quote from: Ben N on February 12, 2019, 03:46:10 AM
Quote from: ElectricDruid on February 11, 2019, 06:08:31 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

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

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

Quote from: Steviebabes 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

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

#8
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....

potul

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

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

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.

#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

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

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

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

No

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





Willypp

Well, I've built it.  I'm just waiting for another midi patch cable and my Mooer Preamp Live to arrive...





Willypp

#18
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.

ElectricDruid

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!!