MIDI-OX User Forum (http://www.midiox.com/cgi-bin/yabb/YaBB.pl)
MIDI-OX >> Mapping Questions >> convert allnoteoff to noteoff,problem
(Message started by: bbsqbbsq on Aug 15th, 2006, 10:33pm)

Title: convert allnoteoff to noteoff,problem
Post by bbsqbbsq on Aug 15th, 2006, 10:33pm
sorry for my english first.
i have an Electronic Organ,when i stroke one key.computer receive 4 message.
-----------
C0 00 00    Program Change   0          Unused        Channel 1  
B0 7B 00    Control Change   All Note Off0             Channel 1  
90 43 48    Note On          G3 (sol3)   Velocity: 72  Channel 1  
B1 7B 00    Control Change   All Note Off0             Channel 1
----------
therefor,i can't stroke 2 and more key simultaneously.when i stroke the second key ,computer receive a "all note off" message befor "note on",this cause the first stroked key note  off.
i use the miniox to transform the control message 123(all note off) to (note off).then i can stroke many keys simultaneously,but they do not note off.i think the noteoff doesn't get the same channel or value with note on.
how can i make the (note off) get the same value with(note on).
help me ,plz....

Title: Re: convert allnoteoff to noteoff,problem
Post by bbsqbbsq on Aug 16th, 2006, 6:52am
the problem had been solved.
just change some codes sticked on the article below
http://www.midiox.com/cgi-bin/yabb/YaBB.pl?board=Mapping;action=display;num=1133749566

-------------------------------------------
// ModVelo.js - JavaScript example
// Copyright (c) 2005 by Jamie O'Connell
//
// This script is an example of doing JScript with MIDI-OX
// It converts any arriving Note On velocity to most recent Modulation Wheel value

var mox;
var modVal = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); // initialize 16 element array

// Create object
mox = WScript.CreateObject("Midiox.MoxScript.1", "On_");  

mox.DivertMidiInput = 1;
mox.FireMidiInput = 1;
 
WScript.Echo( "Press OK to end MIDI translate Loop" );
 
mox.FireMidiInput = 0;
mox.DivertMidiInput = 0;

// Clean up
mox    = null;
modVal = null;

// Exit Point
//------------------------------------------

function On_MidiInput( ts, port, stat, dat1, dat2)
{
  // We convert all Note On messages
  var status;
  var chan;
  var velo;

  status = stat & 0xF0;
  chan   = stat & 0x0F;

  if (status == 0x090 && dat2 > 0x00) // A Note On has arrived
  {
     // A new Note ON value for this channel has arrived: remember it, and eat the controller
     modVal[ chan ] = dat1;
  }

  if (status == 0x080 && dat2 > 0x00) // A Note off has a velocity > 0
  {
     if (modVal[ chan ] > 0) // Only map for non 0 modulation
     {  
        velo = modVal[ chan ];
     }
     else
     {
        velo = dat1;
     }
     
     mox.OutputMidiMsg( -1, stat, velo, dat2 );
  }
  else // other message = just output
  {
     mox.OutputMidiMsg( -1, stat, dat1, dat2 );
  }
}      

Title: Re: convert allnoteoff to noteoff,problem
Post by Peter L Jones on Aug 16th, 2006, 4:36pm
Ah, good, you found a solution!

Title: Re: convert allnoteoff to noteoff,problem
Post by XtrmFajita on Dec 27th, 2006, 9:49pm
My friend's keyboard has the exact same MIDI implementation as pasted above. Whenever a single key is pressed and released, he gets the same 4 messages as bbsqbbsq.

We've tried using the script that bbsqbbsq pasted but it doesn't seem to have much effect for us.

From what I understand we need a script to watch for NoteOn, and store the "Note value" so that when the corresponding AllNotesOff comes through, the script can use the same "Note value" as NoteOn but with velocity set to 0 (effectively changing the MIDI implementation to a standard one).

As far as I can tell, the keyboard uses the Channel number to link NoteOn events with the corresponding AllNotesOff event.

Where do I start? Surely someone has already done this?

Title: Re: convert allnoteoff to noteoff,problem
Post by Peter L Jones on Dec 28th, 2006, 1:10pm
Did you see this part of the referenced thread?

on 12/05/05 at 14:06:30, Jamie OConnell wrote:
...I connected my MIDI controller as Input to MIDI-OX.  I connected  MIDI Yoke 1 as Input to MIDI-OX.  I connected an external MIDI Module (MU100R) as Output from MIDI-OX.  I routed both Inputs to the Output.  Then I shut down MIDI-OX.  

I launched MIDI-OX via the script (double-click)....


Title: Re: convert allnoteoff to noteoff,problem
Post by XtrmFajita on Dec 28th, 2006, 7:27pm
Thanks for your prompt reply Peter, but fortunately we already got it working last night.

I tracked it down to a greaterthan sign that should have been an == in the edited script that was pasted above by bbsqbbsq ;)

The line

Code:
  if (status == 0x080 && dat2 > 0x00) // A Note off has a velocity > 0


should read

Code:
   if (status == 0x080 && dat2 == 0x00) // A Note off has a velocity > 0


This small change, combined with a filter set up to convert all Ctrl messages to NoteOff messages was all we needed.

For the routing setup we just used the Edirol MIDI interface as MidiOx input and connected the MidiOx Event Port to MidiYokeNT1 and set Reason to listen for MIDI on MidiYokeNT1. Seemed to work fine. Is this correct though Peter?

I hope that all makes sense, if anyone has any questions feel free to post them here and I'll try to be more clear.

Title: Re: convert allnoteoff to noteoff,problem
Post by Peter L Jones on Dec 29th, 2006, 3:23pm

Quote:
For the routing setup we just used the Edirol MIDI interface as MidiOx input and connected the MidiOx Event Port to MidiYokeNT1 and set Reason to listen for MIDI on MidiYokeNT1. Seemed to work fine. Is this correct though Peter?

"If it works, it works!" is a good approach ;).  But yes, it sounds sensible.

Thanks for posting about the fix-up.



MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.