billthefarmer / mididriver

Android midi driver using Sonivox EAS library
176 stars 52 forks source link

how to play a chord? #41

Closed fernandoavf7 closed 3 years ago

fernandoavf7 commented 3 years ago

Which would be the correct way to stream a chord? for example if I want to play a C major: C-E-G?

I tried in this way

event = new byte[3];
        event[0] = (byte) (0x90 | 0x00);
        event[1] = (byte) 60;
        event[2] = (byte) 0x7F;

event2 = new byte[3];
        event[0] = (byte) (0x90 | 0x01);
        event[1] = (byte) 65;
        event[2] = (byte) 0x7F;

event3 = new byte[3];
        event[0] = (byte) (0x90 | 0x02);
        event[1] = (byte) 68;
        event[2] = (byte) 0x7F

        midiDriver.write(event);
        midiDriver.write(event2);
        midiDriver.write(event3);

but is right?... and where can I learn more about the library? documentation or a extend guide.

Thanks in advance

billthefarmer commented 3 years ago

This driver is just a wrapper around the Sonivox synthesizer included in every android device. You need to look up standard generic midi programming. However what I can say is that you must send a matching note off message for every note on and you don't need to use a different channel for each note unless you want to use a different instrument. See the code in the demo app here.

fernandoavf7 commented 3 years ago

Thank so much dear, with the example now it sounds better.