Jump to content

Filtering MIDI realtime messages


goule

Recommended Posts

Hi guys,

My controller is in MIDI merge mode, so that I can receive and transmit notes from my master keyboard (P60) to the outside world together with my controller MIDI messages.

I want to get rid of the realtime MIDI messages that comes out of my P60 and simply ignore them. Those are 'timing clock' (0xf8) and 'active sensing' (0xfe).

I've tried this :

void MPROC_NotifyReceivedByte(unsigned char byte) __wparam 
{
	// This function is called by MIOS when a MIDI byte has been received

	if ((0xf8 == byte) || (0xfe == byte)) 
		MIOS_MPROC_MergerDisable();
	else 
		MIOS_MPROC_MergerEnable();
}

The filter works but when I play with the controllers, it seems like it completely messes up the note on / note off messages, and if you keep on playing on the keyboard after a while everything gets back to normal (until you touch the controller again).

I suppose this is due to the fact that I should be sure that the message is only 1 byte long before cancelling it ... does anyone know how to do this ?  :P

Link to comment
Share on other sites

Hi goule :-)

I'm not sure if it's a good idea to dis- & enable the merger functionality here?

Wouldn't it be better to en- or disable it just once in a setup routine and to simply ignore the bytes here you're not interested in?

Because every time, there's a byte received that's not 0xf8 or 0xfe, the merger is set to enabled... that sounds odd to me :-/

cheers,

Michael

Link to comment
Share on other sites

Hi folks ! Thanks fro that fast answers !  ;)

Wouldn't it be better (...) to simply ignore the bytes here you're not interested in?

That's what I need to find : how do you ignore bytes (mean : how not to merge them to the output) without using the MIOS_MPROC_MergerDisable() function ?

Link to comment
Share on other sites

either you use the merger as a pre-built functionality (that means: forward all or nothing) - or you have to implement it yourself. That means, you got to do the forwarding on your own. This way you can ignore certain messages.

It's another question, why your application should forward certain data while not forwarding certain other data. In general, I'd say this sounds a bit inconsequential (at least looking at it from a user's side of the view) :-)

Link to comment
Share on other sites

Works like a charm, thank you guys !

void Init(void) __wparam
{
	(...)
	MIOS_MIDI_MergerSet(MIOS_MIDI_MERGER_DISABLED);
	(...)
}

// This function is called by MIOS when a complete MIDI event has been received
void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam 
{
	MIOS_MIDI_TxBufferPut(evnt0);
	MIOS_MIDI_TxBufferPut(evnt1);
	MIOS_MIDI_TxBufferPut(evnt2);
}

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...
×
×
  • Create New...