Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# / nAudio - Sending a MIDI message to controller

Tags:

c#

midi

naudio

I'm building my own custom midi mapping app, and so far so good. I've been using nAudio to recieve midi messages, and it's working like a charm.

But when wanting to send something back, I run into some trouble. To enable a light on my controller I gotta send a Note On message: 90 kk 01 for example, where kk equals the corresponding key. (see picture below)

enter image description here

However, it is not working. I'm not getting any error messages at all, but nothing is lighting up neither.

Example of what I'm sending:

midiOut = new MidiOut(MIDIInDevice);
 midiOut.Send(MidiMessage.StartNote(56, 1, 0).RawData);

56 is the Note, 1 the volume, and 0 the channel.

Any idea what i'm doing wrong?

like image 809
ThomQ Avatar asked Dec 30 '25 06:12

ThomQ


1 Answers

Choose right channel and try to send NoteOn event.

var noteOnEvent = new NoteOnEvent(0L, channel, note, 127, 200);
midi.Send(noteOnEvent.GetAsShortMessage());
midi.Send(noteOnEvent.OffEvent.GetAsShortMessage());
like image 113
17 revs, 13 users 59% Avatar answered Jan 01 '26 19:01

17 revs, 13 users 59%