This project has moved. For the latest updates, please go here.

MIDI IN letters notes, insetad numbers?..... a big problem

Feb 5, 2012 at 9:56 PM
Edited Feb 6, 2012 at 6:06 PM


Hello Mark, i have a question and comment,  about a big problem i see on the library related to MIDI IN.

When reciv MIDI NOTES, naudio show the incming notes with letters  notes instead show 0 to 127 number.
This is a big problem.
Nos possible show, NOTE NUMBERS, instead note letters when use e.MidiEvent?

When you send midi note, NUMBERS 0 to 127 are used, when reciv notes should be the same.
Is possible please add that feature?

The best way should be something like:


e.MidiEvent.Channel   , inform the chanel where midi is incoming
e.MidiEvent.Number   , show number of MIDI note, or midi CC,

example, if mide note incoming is 126 should show:
NOTE126
is is midi CC 126, shoudl show, CC126


e.MidiEvent.Value    , value show the volume form 0 to 127 midi note or midi CC 

e.MidiEvent.Port, this indicate number of port weher midi come, not 100% needed but usefull.
 
Is to much request add this feature please?
the curent implemntation of MIDI in, make very complex work with MIDI NOTES!



Best regards.

Feb 6, 2012 at 5:07 PM
Edited Feb 7, 2012 at 1:17 AM

Mr Mark, i see exactly same problem with MIDI CC.

Example instead retrun value like this:

0 ControlChange Ch:10 Controller 1 Value 127

Righ now midievent report:       0 ControlChange Ch:10 Modulation Value 127

Modulation?   i know CC1 is  nodulation, but why not show  Controller 0   to Controller 127, in that way if i want show what kind of contol i ca do and if not and want just work with values i can do in simple way.

Really this not is usefull in this way, number value should be returned no words, for human informative propose show notes  and CC with names  is ok, but for work with incoming midi signal this is a nightmare ; (

Please Mark can fix this for MIDI notes and MIDI CC?

 

The best way is add this:

e.MidiEvent.Channel , inform the chanel where midi is incoming
e.MidiEvent.Number , show number of MIDI note, or midi CC,

example, if mide note incoming is 126 should show:
NOTE126
is is midi CC 126, should show, CC126

Anyway, show number only is more than ok, if somebdoyneed indetificate kind of note can use e.MidiEvent

e.MidiEvent.Value  , value show the volume form 0 to 127 midi note or midi CC

e.MidiEvent.Port, this indicate number of port weher midi come, not 100% needed but usefull.
Best regards.

Feb 7, 2012 at 9:11 PM
Edited Feb 7, 2012 at 9:12 PM

Cometing this lines in midicontroler.cs  fix the problem with midi CC and i can easy extgarct the data from result showed by e.MidiEvent

/// <summary>Modulation </summary>
//Modulation = 1,

/// <summary>Main volume </summary>
//MainVolume = 7,

///
<summary>Pan </summary>
//Pan = 10,

/// <summary>Expression </summary>
//Expression = 11,

/// <summary>Sustain </summary>
//Sustain = 64,

/// <summary>Reset all controllers </summary>
//ResetAllControllers = 121,

/// <summary>All notes off </summary>
//AllNotesOff = 123,


So in thsi simple way have result in a easy wey to andle, parse and extarct information needed when work with MIDI CC.

How can do the same with midi notes for make naudio show notes in numbers not in letter notes?


Best regards.

 

 

 

 

 

Coordinator
Feb 7, 2012 at 9:17 PM

just cast it to an int, that is all you need to do

Feb 7, 2012 at 11:23 PM
Edited Feb 8, 2012 at 12:33 AM

Mark plese showme how : )
Im 100% lossed in this.

When i says how......... i mean in exactly wahy how to with example code if possible, im not lazy, just not super good with coding im are relative new in the world of programation,

Thank you

Coordinator
Feb 8, 2012 at 6:10 AM

if e.MidiEvent is an instance of NoteEvent, cast it to a NoteEvent, and then you have access to the NoteNumber property which is an int

if e.MidiEvent is an instance of ControlChangeEvent, cast it to a ControlChangeEvent, and then you have access to the ControllerValue property which is an int

The NAudioDemo app is just using the MidiEvent ToString(), but there is no reason for you to use it if you don't like the format it displays data in.

Feb 8, 2012 at 12:27 PM

Mark i cnat udnerstadn how do, i follow teh example, yes. and do this:
 

void midiIn_MessageReceived(object sender, MidiInMessageEventArgs e)
{
MessageBox.Show(Convert.ToString(e.MidiEvent));
}

Can showme with a code example how can acces to only INT values:
MIDI CHANNEL
MIDI NOTE
VALUE

and also

MIDI CHANEL
MIDI CC
VALUE

 

Thankyou for your patience, and please apologize i not understand what you explain.

 

Coordinator
Feb 8, 2012 at 2:20 PM

Do something like this:

string message = e.MidiEvent.ToString();
if (e.MidiEvent is NoteEvent)
{
   NoteEvent n = (NoteEvent)e.MidiEvent;
   message = String.Format("{0} {1} Ch: {2} Note:{3} Vel:{4}", n.AbsoluteTime, n.CommandCode, n.Channel, n.NoteNumber, n.Velocity);
}
else if (e.MidiEvent is ControlChangeEvent)
{
   ControlChangeEvent c = (ControlChangeEvent)e.MidiEvent;
   message = String.Format("{0} {1} Ch: {2} Controller:{3} Value:{4}", c.AbsoluteTime, c.CommandCode, c.Channel, (int)c.Controller, c.ControllerValue);
}
MessageBox.Show(message); 

Feb 8, 2012 at 3:02 PM

Thank you so much, for help..........and specially for your patience!