Jump to content

How to Offset and Scale an Analog Input


Duggle
 Share

Recommended Posts

Use the "midi socket" looking icon to bring up a dialog to route the midi. 

It is straight forward to create a "midi through" connection from one port to another. (Look at help or other resources if this is not clear- it is easy)

So you have KB connected to a midi in, and a yoke port as out.

Now bring up a monitor window to see the data flowing from in to out.

Start your host program and set it's midi-in to the yoke port.

Try the modwheel from the keyboard that works o.k then try KB all the time looking at the midi in, or out monitor (the midi in and out monitor should show exactly the same).

I'm guessing that there are extra midi events going to the host or maybe the same controller events going at a much faster rate that is screwing up your host.

BTW; what is your host program?

Link to comment
Share on other sites

Carefully state the experiments you perform with all relevant conditions. Then for each case, describe the results.

 

You need to quantify your results, words like "nervous" and even "very sensitive" are vague and not helpful. Also your posts and communications are way too "terse"!

 

(I know english is not your first language, it does not matter if you communicate faulty english, you need to explain yourself more fully (e.g use more words, carefully explain yourself), otherwise you will simply appear lazy, and this does not inspire others to help you.)

 

Do an experiment by moving the modwheel from max to min over 1 second, then count the events generated (look at the timestamps in MIOS Studio beside each event) then compare (i.e repeat the experiment with the "good" master keyboard. Determine (ie measure) what the differences are.       

Do the same experiment with midi-ox monitoring the values being sent from both keyboards to vArranger. There will be a difference. Tell us precisely what you discover.

 

Once you have replicated the "faulty" result  (i.e. vArranger loses sync) and understand why this is happening (e.g event rate too high; midi buffer overflow) and can replicate the problem from a device or source other than MIDIbox  KB. Then you can head over to vArranger Forum and report what you have discovered with some authority. Because you've quantified the conditions, the vArranger authors will be able to replicate the problem and fix the software.

Link to comment
Share on other sites

If the timestamps are in miliseconds, then you performed the sweeps, about over the the same time period  (300 to 400ms), right?

Then the MIDIbox KB is outputing much higher resolution (normally this is considered a good thing!).

Can you see that the KB is outputing events at a rate of nearly 10X that of the Korg. I don't see a problem with KB as such.

 

Have you tried other hosts? (there are plenty of free one's out there)

I suspect vArranger could do with some improvement. You should post to their forum, or otherwise contact the developers.

 

If you find that you discover similar (or rather equivalent)  problems on other hosts, then maybe put in a feature request with TK for some kind of  "data thinning" option. It's likely he wont do it for KB but he might for the Keyboard option of MIDIbox NG which uses the same hardware plus an sdcard.

Link to comment
Share on other sites

Hi Doggle!

Today I tried a pitch bender Doepher. even with this my Varranger works well.
I realized that my varranger can not handle so many midi events in such a short time. I will talk with the manufacturer of varranger of this problem so let's see what will tell.
I have not had the opportunity to try a different hosts. Today I will try with one-man band.
Thanks Doggle.Doggle Thanks for your availability.

Link to comment
Share on other sites

Hi Folly,

I can see where the MidiBox unit is trying to be very efficient and output as many events as it can for a finer granularity between CC events.  But when this is done every 1-2ms, it can overwhelm the standard Midi interface.  On a Theatre organ that has been retrofitted with Midi, the swell pedal is used to control the volume of the organ and this behavior shown in the  "Midibox kb ... txt" file would certainly be an issue.  I have heard of people having issues with delays of half a second while playing keys on the keyboard while trying to express a few playing notes by pumping the swell pedal.  The best way to fix this problem is to add software that only outputs the changes every 15ms.  Skipping CC values isn't always a bad thing. 

Link to comment
Share on other sites

You might try changing the code yourself.  Here is something that might work for your case.  I haven't tested it out on the real hardware.  It might not be up to standards per TK but you never know.

 

u32    appLastAinValue[66] = {      /* -1 indicates value is sent */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  
-1, -1 };
 
void APP_AIN_NotifyChange(u32 pin, u32 pin_value)
{
  // -> keyboard
  if(pin >= 66)
    KEYBOARD_AIN_NotifyChange(pin, pin_value);
  else
     appLastAinValue[pin] = pin_value;     // store value to be outputed later.

#if 0
  MIOS32_MIDI_SendCC(DEFAULT, Chn1, 0x10 + pin, pin_value >> 5);
#endif
}

//////////////////////////////////////////////////////////////////////////////
// This task is called periodically each mS to check for keyboard MIDI events
/////////////////////////////////////////////////////////////////////////////
static void TASK_Period_1mS(void *pvParameters)
{
  portTickType xLastExecutionTime;
  u8	i;
  u32	AinTimer = 0;

  // Initialise the xLastExecutionTime variable on task entry
  xLastExecutionTime = xTaskGetTickCount();

  while( 1 ) {
    vTaskDelayUntil(&xLastExecutionTime, 1 / portTICK_RATE_MS);

    // skip delay gap if we had to wait for more than 5 ticks to avoid
    // unnecessary repeats until xLastExecutionTime reached xTaskGetTickCount() again
    portTickType xCurrentTickCount = xTaskGetTickCount();
    if( xLastExecutionTime < (xCurrentTickCount-5) )
      xLastExecutionTime = xCurrentTickCount;

    // -> keyboard handler
    KEYBOARD_Periodic_1mS();
	
    if(AinTimer++ > 16)        // check if its been at least 16ms since last change.
    {
        for(i=0; i<66; i++)
        {
            if(appLastAinValue[i] == -1)    // if value has been sent
                continue;
        
            KEYBOARD_AIN_NotifyChange(i, appLastAinValue[i]);    // output last saved value
            appLastAinValue[i] = -1;        // Set -1 indicating value sent.
            AinTimer = 0;                    // reset timer so we won't do it again for 16ms.
        }
    }

    // MIDI In/Out monitor
    // TODO: call from low-prio task
    MIDI_PORT_Period1mS();
  }
}

Edit:Folly tried this and it didn't work because I had used u8 rather than u32 to save the values.  I changed the above software shown above to reflect the change and he indicated it solved his problem.

Edited by kpete
Link to comment
Share on other sites

 

I have not written to varranger because I tried it with another host (LIVESTYLER).

even with this we have the problem. 

Please TK to do some modification of software MIIDIBOX KB?

Folly, you at least have to take the time to write to the vArranger user forum (if no one reports it, how can it be fixed?) 

Such poor handling of MIDI streams by hosts is not universal (nor standard)! 

 

Based on previous posts TK is v.unlikely to add features to KB.

The ongoing development is taking place with MIDIbox NG which supports keyboards and much more. 

 

I think what you want would be referred to as " an option of data thinning on controller MIDI output"

Or try kpete's modification above, of course.

Link to comment
Share on other sites

 

Based on previous posts TK is v.unlikely to add features to KB.

The ongoing development is taking place with MIDIbox NG which supports keyboards and much more. 

 

I think what you want would be referred to as " an option of data thinning on controller MIDI output"

Or try kpete's modification above, of course

 

 Hello Duggle! I did not write in forums vArranger because as I wrote above I tried u other hosts (livestyler). the problem is the same as vArranger. What do I do? I write to all of them? do you think you bring them to change their software for me?

 

 
Edited by folly
Link to comment
Share on other sites

Ok, since some other minor changes were requested anyhow, please try V1.011

 

The bandwidth can be configured with the ain_bandwidth_ms parameter, e.g.:

 

 

set kb 1 ain_bandwidth_ms 20

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Thank you Thorsten,

I am sure folly will be happy.  I sent in a change to him, and after the 2nd .hex file he is happy.  I will make sure that he uses your official change rather than my temporary patch.

Pete

Link to comment
Share on other sites

Thanks for helping Folly anyhow! :smile:

 

The "official change" works with timestamps instead of a counter to reduce the bandwidth.

This has the advantage, that the first value change will be sent immediately, and subsequent changes with the given delay.

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...