KyoSherlock / MidiDriver

android MIDI synthesizer (soundfont2)
Apache License 2.0
49 stars 35 forks source link

How to play .mid file? #4

Open ghopretz opened 6 years ago

ghopretz commented 6 years ago

How to play .mid file with this library?

francollamas commented 5 years ago

Hi! I was trying to undestand it...

You need to add the MidiDevice to MidiSystem.... Next.. load a Secuence and put it into a Secuencer.....

Using the synth of the example module:

MidiSystem.addMidiDevice(synth); 

InputStream is = context.getAssets().open("midi file dir here!");
StandardMidiFileReader fileReader = new StandardMidiFileReader();
Sequence s = fileReader.getSequence(is);
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
sequencer.setSequence(s);
sequencer.start();
zhiqinliao commented 2 years ago

o, this way can't working