Author Topic: GR-55 -External expression pedal connected to GR55 jumpy if operated quickly  (Read 501 times)

0 Members and 1 Guest are viewing this topic.

Offline philjynx

Hi everyone. I've built a Teensy 3.2 based midi controller. It uses usb midi for bidirectional communication with Circular Labs Mobius looper, and DIN Midi to send messages to the GR55. There are 16 buttons on my plank, which gives it effectively over 37 buttons (I lost count at 37) as many of them act differently if two are pressed at once and most of them are assigned short press and long press functions.

Mobius: I have all the control over Mobius (Record, Overdub, Undo, Multiply, Reverse and Mute) that I want and the LEDs in my footswitches show which track Mobius is on, which Loop is selected and the status (Record/Overdub/Mute) so the LEDs show what is actually happening in Mobius, not what the pedal has asked for. I have it set up for four tracks and four loops.

GR55: 14 or so bank selections on the plank - more than enough - and I've duplicated the four main footswitches of the GR55 on my guitar using near invisible tactile switches in the scratchplate. While I was at it, I thought it would be fun to build a Pandora Mini into the guitar and an EHX PI Nano circuit. So I've ended up with a 25 pin guitar lead fat enough to tow a truck with. That carries all the Roland signals and separate power for the Pandora, the EHX and the EMG pickups. All a bit daft really....

All this stuff functions perfectly.

Now to the problem.
I added a TRS socket to the plank and the appropriate additional wiring to allow an expression pedal to be plugged into the plank.
After a bit of fannying around I've eliminated all 'hunting' from the equation so you only get a cc message when you actually move the expression pedal. This is done by taking 5 analogue readings in succession, and only if THEY are all the same but they DIFFER the last reading that was sent to the GR55 then we send a cc to the GR55. This works very nicely. When the serial.print statements are enabled for testing, I can operate the pedal as fast as I possibly can and the listing shows ALL values between 0 and 127 and no rogue readings. Lovely stuff.

For those that care about that here's how:

  The CPU is cycling at 72MHz, the rest of the code (not shown) processes the 16 footswitches and  switches sending any messages it needs to to the GR55 and or Mobius, and updates the LEDs depending on what Mobius has told it. Then it finally checks the position of the expression pedal-

  SampleExpression = (analogRead(13) * 5);
  if (!(HeldExpression == SampleExpression)) {
    SamplesExpression = 0;
    for (int i = 0; i <= 4; i++) {
      SamplesExpression += analogRead(13);
    }
    if ((SamplesExpression) == SampleExpression) {
      SendExpression = (SampleExpression / 40);
     /* divide by 5 to compensate for 5 samples divide by 8 (so divide by 40) to normalise 0 - 1023 range to 0-127 midi range */
      HeldExpression = SampleExpression;
      if (!(LastSentExpression == SendExpression)) {
        MIDI.sendControlChange(68, SendExpression, RolandChannel);
        LastSentExpression = SendExpression;
       /* Serial.print("analog 13 is: ");
        Serial.print(SendExpression);
        Serial.print(" comparing: ");
        Serial.print(SamplesExpression);
        Serial.print(" with ");
        Serial.println(SampleExpression);
        */
      }
    }
  }


Ah, wait, I said this works very nicely didn't I?
I lied.
The problem is, if you operate the expression pedal anything other than pretty slowly, you don't get the response you'd like from the GR55 at all.
This is despite the fact that the full range of values (IE 0 to 127) is being sent.

What happens is that the GR55 only seems to notice a very small number of the cc messages. So, lets say that we have a simple assign to control the level of one of the tones from none to max. Instead of fading up or down, it may jump from none to max, or sometimes not even respond.

Now, I don't have an oscilloscope so I can't monitor the midi signal, and I can't use MIDI OX on this as this is DIN Midi from the plank to the GR55.


Any clues anyone, am I alone in this or has anyone else ever had an external midi controller behave like this?

« Last Edit: September 17, 2016, 03:30:51 PM by admsustainiac »
I am playing all the right notes. But not necessarily in the right order.

Online admsustainiac

Quote
The problem is, if you operate the expression pedal anything other than pretty slowly, you don't get the response you'd like from the GR55 at all.
This is despite the fact that the full range of values (IE 0 to 127) is being sent.

What happens is that the GR55 only seems to notice a very small number of the cc messages. So, lets say that we have a simple assign to control the level of one of the tones from none to max. Instead of fading up or down, it may jump from none to max, or sometimes not even respond. Any clues anyone, am I alone in this or has anyone else ever had an external midi controller behave like this?

You are not alone - is a known issue - the GR-55 CPU is already running near capacity ( we obseve the GR-55 controls and onboard expression pedal react sluggishly anytime there is a USB connection ) and there is no reserve for many real time control tasks

This explains why the GR-55 lacks the typical External Expression pedal / CTRL 2/3  input Jack as found on most Roland / Boss Floor processors


 

« Last Edit: September 17, 2016, 03:37:22 PM by admsustainiac »

Offline gumtown

I notice there is no delay after the midi command is sent, so if the pedal is moved too fast the GR-55 won't know the end of the previous and start of the next message.

Usually a delay of 20ms is required between messages.

Any reason for the 5 x times sampling?

this what I would write

      SampleExpression = (analogRead(13)/8);
      if (LastSentExpression != SendExpression) {
        MIDI.sendControlChange(68, SampleExpression, RolandChannel);
        LastSentExpression = SendExpression;
        Serial.print("analog 13 is: ");
        Serial.println(SendExpression);
        Delay(20);       
      };
Free "GR-55 FloorBoard" editor software from http://sourceforge.net/projects/grfloorboard/

Offline philjynx

Interesting.... full range movement of pedal 127 increments * 20 ms.
That would mean that an action that physically took (say) half a second would be spread out over 2.5 seconds, or it not buffered, be chopped up into 5 samples - yikes!

It's actually 6 times sampling. One sample is taken and then compared with 5 more. This is to prevent fluctuations in the sample being sent. Without that multiple sampling, at certain wiper positions you'd see a constant stream of readings in serial monitor (that's part of the Arduino IDE for those who don't know) like
975,976,975,976,975. If they were taken as actual movement of the pedal there was a continuous stream of midi messages being spewed out. Summing 5 samples and comparing that figure with the first sample pretty much eliminates that stuttery (is that a word?) effect.

Back to the delay, this bit of code is in the main loop. If I put that delay in, it would be insignificant as far as button pressing is concerned as obviously a human being cannot operate the expression pedal and then move their foot to operate a button in 20ms, so no harm done. But, a rapid movement of the expression pedal would get chopped up into perhaps as few as 5 cc messages, so what you might have intended as a rapid smooth transition from one sound to another, would actually be more like a blunt toggle transition. I figure you can fully move the pedal in not much more than half a second (500ms) so a bit of arithmetic on that suggests that you could end up with only 5 incremental readings instead of 127.

That said, I'll give that a try just for fun. The expression pedal (my external one) is not vital, I just thought it would be a nice addition. The 16 buttons are the important part and I have no issues with those.

Thanks for your thoughts...

Rather than add another post, here's the outcome of adding a 20ms delay after sending cc to GR55.
Surprisingly usable result.
I've trying this out doing a cross-fade from strings to 12 string acoustic. Slow pedal movement give you a nice soft transition from entirely strings to quieter strings with 12 string 'up front' - I don't kill the strings entirely. Fast pedal movement gives a quick but not unpleasant transition. The key thing here is that at least the GR55 ends up set at whatever the last pedal position is without a glitch.

Thanks Gumtown for the delay! ;)
Great stuff.
« Last Edit: September 18, 2016, 04:51:26 AM by philjynx »
I am playing all the right notes. But not necessarily in the right order.

Offline philjynx

You are not alone - is a known issue - the GR-55 CPU is already running near capacity ( we obseve the GR-55 controls and onboard expression pedal react sluggishly anytime there is a USB connection ) and there is no reserve for many real time control tasks

This explains why the GR-55 lacks the typical External Expression pedal / CTRL 2/3  input Jack as found on most Roland / Boss Floor processors
(Image removed from quote.)

Well, that's crap isn't it?  :(
I am playing all the right notes. But not necessarily in the right order.

Offline sixeight

Quote
Back to the delay, this bit of code is in the main loop. If I put that delay in, it would be insignificant as far as button pressing is concerned as obviously a human being cannot operate the expression pedal and then move their foot to operate a button in 20ms, so no harm done. But, a rapid movement of the expression pedal would get chopped up into perhaps as few as 5 cc messages, so what you might have intended as a rapid smooth transition from one sound to another, would actually be more like a blunt toggle transition. I figure you can fully move the pedal in not much more than half a second (500ms) so a bit of arithmetic on that suggests that you could end up with only 5 incremental readings instead of 127.

Getting the timing right is crucial in commucating with all Boss and Roland devices. For the GR55 I wrote a short function to deal with the delay, only when it is necessary. The processor could do all sorts of other useful stuff, so I try to avoid the delay command in my code.

Code: [Select]
#define GR55_SYSEX_DELAY_LENGTH 10 // time between sysex messages (in msec)
unsigned long GR55sysexDelay = 0;

void GR55_check_sysex_delay() { // Will delay if last message was within GR55_SYSEX_DELAY_LENGTH (10 ms)
  while (millis() - GR55sysexDelay <= GR55_SYSEX_DELAY_LENGTH) {}
  GR55sysexDelay = millis();
}

I found 10 ms is enough. This should allow for 100 midi messages per second.

Offline philjynx

Thanks, that's a neat solution - only delay if there was a recent send.
One question though, just a naming convention thing, you've called it GR55sysexDelay, but I'm assuming that the need for a message delay is not restricted to sysex messages, but to all midi message types?
Apoligies if that is an irritating question.
OCD + pedantic nature = coder!
I am playing all the right notes. But not necessarily in the right order.

Offline gumtown

I came up with the 20ms value, which I use in GT-FxFloorBoard editors, when sending bulk sysx data in 256 byte chunks, 20ms was rounded up to gave older equipment time to digest the data.
 If I recall the Midi Association specification is 14ms minimum for sysx data, I am not sure for cc# but a gap is required for the receiving equipment to distinguish there is a message end, that it is 3 bytes in length and not 4 bytes as some cc# are.
As SixEight has posted, a 10ms delay might be better for this case.

FYI: The GR-55 USB and 5 pin midi ports work independently and concurrently, with the USB connected to a computer, some midi software can create a loopback, causing the GR-55 to respond very slowly and sometimes appear to lockup.
It is caused when the GR-55 sends Program change out when it receives a program change, resulting in a P.C. loopback. Disabling the GR-55 P.C Out helps in that case.
Free "GR-55 FloorBoard" editor software from http://sourceforge.net/projects/grfloorboard/

Offline philjynx

Thanks for the extra info Gumtown. My setup doesn't use the usb midi, so I've escaped that pitfall.

I've adopted your code SixEight and 10ms causes no problems. At the moment my pedal only sends programchange and controlchange to the GR55 so I've written two wrapper functions as follows:

void MidiTimedControlChange(byte note, byte velocity, byte Channel) {
  GR55_check_sysex_delay();
  MIDI.sendControlChange(note, velocity, Channel);
}

void MidiTimedProgramChange(byte note, byte Channel) {
  GR55_check_sysex_delay();
  MIDI.sendProgramChange(note, Channel);
}


Works a treat!

Thanks all.
I am playing all the right notes. But not necessarily in the right order.

Offline sixeight

Thanks, that's a neat solution - only delay if there was a recent send.
One question though, just a naming convention thing, you've called it GR55sysexDelay, but I'm assuming that the need for a message delay is not restricted to sysex messages, but to all midi message types?

I use delays for the other devices as well on the VController. But I want to be able to use different delay times for all devices. So I kept it seperate.

One day I should program it all in seperate classes.

Do post some pictures of your controller when you are ready...
« Last Edit: September 19, 2016, 11:52:24 PM by sixeight »

Offline philjynx

Re: GR-55 -External expression pedal connected to GR55 jumpy if operated quickly
« Reply #10 on: September 20, 2016, 04:48:34 AM »
I've adapted the bounce class to suit my purposes - built in short, long and super long press properties and twinpress detection. I haven't figured out how to do the same sort of thing with the MIDI code. Well, I haven't tried is the honest truth!

I'll try and sort out some pics soon. The 'plank' is almost literally a plank, it's made of wood. 16 buttons made out of polyester resin & carbon dust. 11 of them have LEDs in them. I used a sheet of glass reinforced plastic to make the spring assembly cut like a fish bone or a comb. The buttons are glued onto the tines. Nice because it not only provides the springs but also ensures the buttons are always located correctly in their slots, no contact round the edges. The actual switches are medium quality mometary micro switches so I have to have quite a long bounce time (15 milliseconds). I did have switches that look superficially like the ones that used to be on the fuzz face. They were truly useless. On opening one up I found that it was just a loose square metal plate which would be brought into contact with the two terminals within the case. No snap contact at all just a chunk of metal rattling into place across two contacts! I've had to replace a few of the micro switches as I found that they would make and break contact even though the actual click wasn't taking place if you altered the pressure on the button. My guess is that I over heated them when I soldered on the wires and perhaps warped something inside them.

Do you think the 25 pin and 9 pin D connectors and the breaking into the 13 pin ribbon and breaking into the four foot switch leads to duplicate them on the guitar might void the warranty?  ;D
« Last Edit: September 24, 2016, 01:42:39 PM by philjynx »
I am playing all the right notes. But not necessarily in the right order.