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

Midifile with more than 16 Instruments at the same time

Mar 17, 2011 at 8:47 PM

Hi,

I use NAudio to play Midievents on my PC like that:

MidiOut midiOut = new MidiOut(0);

midiOut.Send(MidiMessage.ChangePatch(Instrument, Channel).RawData);

midiOut.Send(MidiMessage.StartNote(Note, Velocity, Channel).RawData);

But for example I have a Midifile that plays over 16 Intruments at the same time,

but i can't play it on my PC with more than 16 Instruments at the same time, because MidiOut only accept 16 Channels.


I don't know how to solve this problem, although the Windows Mediaplayer can play it, so please help!

Coordinator
Mar 21, 2011 at 5:12 PM

MIDI only has 16 channels. How do you know that your MIDI file plays over 16 instruments at once?

Mar 21, 2011 at 9:15 PM
Edited Mar 22, 2011 at 2:43 PM

I created an own MIDI file and watch it in "Synthesia" or "TS-MIDI Editor",

You can set only 16 channels in a track but if you have more tracks, you can set an additional 16 channels, each with different instruments that are played at the same time.

Coordinator
Mar 30, 2011 at 9:44 AM

ok, yes you could have multiple tracks in a midi file, but to play it back you would need multiple synthesizers (i.e. more than one midi output port). Windows Media player probably makes a couple of instances of the Windows integrated MIDI synth

Mark

Mar 30, 2011 at 3:07 PM

oh ok but is there also a option with Naudio to do it like WMP ?

Coordinator
Mar 31, 2011 at 8:11 AM

I suppose you could create two instances of MidiOut and see if that works

Apr 1, 2011 at 1:12 PM
Edited Apr 1, 2011 at 1:12 PM

So I tried it this way:

            MidiOut midiOut_1_pc = new MidiOut(0);
            MidiOut midiOut_2_pc = new MidiOut(0);

But it doesn't work: "AlreadyAllocated calling midiOutOpen".

This works:

            MidiOut midiOut_1_pc = new MidiOut(0);
            MidiOut midiOut_2_keyboard = new MidiOut(1);

But then the second MidiOut isn't my PC.

Coordinator
Apr 3, 2011 at 2:00 PM

that's a shame. I'm afraid I don't know what approach Windows Media Player takes

Mark

Apr 3, 2011 at 4:09 PM

Okay, thanks anyway

Feb 19, 2013 at 4:18 PM
Have a look at the http://www.nerds.de/en/loopbe30.html or the (free 1 virtual midi device) this opens up to 30 virtual midi devices at the same time. You could split channels 16-31 to a virtual midi device and play it on it's 0-15 channels. Don't know if it would work; worth a try.