You can't use J2ME to play MIDI on series 40 phones. And you can't use it to play polyphonic sound either.
With J2ME series 40 phones only support the ringtone format (Sound.FORMAT_TONE).
You can use the Nokia Developer's Suite to transform MIDI into the appropiate format, and then import the result into your application.
To initialize the sound:
Code:
import com.nokia.mid.sound.Sound;
//...
InputStream soundStream = this.getClass().getResourceAsStream("/intro.txt");
byte[] soundData = new byte[FILE_SIZE];
soundStream.read(soundData,0,soundData.length);
Sound mySound = new Sound(soundData,Sound.FORMAT_TONE);
mySound.init(soundData,Sound.FORMAT_TONE);
Then playing it is just a matter of calling the play() method:
Code:
mySound.play(numberOfLoops)