I want to be able to send multiple MIDI messages independently. But the problem is that I have to wait until the previous note has ended. Do I have to create a thread for all my voices? Let's say I want to be able to play 10 notes at the same time. Then I would have to create 10 threads?
I sent my MIDI messages through javax.sound.midi
public void playNote(int pitch, int length, int velocity) {
try {
msg.setMessage(ShortMessage.NOTE_ON, 0, pitch, velocity);
rcvr.send(msg, timeStamp);
Thread.sleep(length);
msg.setMessage(ShortMessage.NOTE_OFF, 0, pitch, 0);
rcvr.send(msg, timeStamp);
} catch (Exception e) {
e.printStackTrace();
}
}