Dear all,
I am endeavouring to develop an interactive music-making application on the Nokia 6230 phone. The idea is that 2+ phones, connected via Bluetooth, may pass notes to one another, and thus create musical compositions.

My problem is that in order to play the notes, I have to stop and recreate a player for each note. This results in a ticking sound when deployed to the phones. If I do not stop and recreate a new player for each note, the application ceases to play notes' sound after a short period of operation.

I have made an exhaustive search of Internet resources – I think – for code samples/tutorials/ideas, and have come up short. Available information seems to relate to creating a song, loading it and playing it through – rather than interactively creating one on the fly – or playing a composition located at a URL.

Note, the interface is wheel shaped, with an arm that sweeps in a circle, playing each note that it encounters.

Please find below, relevant methods from the MIDlet: playCurrentNotes() and setupMidi(). As well as the run() method from an engine class which moves the arm and calls playCurrentNotes(). I would be grateful for any ideas.

Best,
Megan

public void playCurrentNotes() {
if(instruments != null) {
for(int i = 0; i < TOTAL_INSTRUMENTS; i++) {
if(instruments[i] != null) {
if(instruments[i].getNote(playPosition) != null) {
int value=
instruments[i].getNote(playPosition).getVolume();
if(value > 0) {
try {
if (player != null){
player.stop();
player.close();
}
setupMidi();
midiControl.shortMidiEvent
(MIDIControl.NOTE_ON, playPosition, 50);
} catch (MediaException e) {
//method for debugging in phone
printString("Exception playCurrentNotes: " + e);
}
}
}
}
}
}
}

private void setupMidi() {
try{
player = Manager.createPlayer(Manager.MIDI_DEVICE_LOCATOR);
player.realize();
player.prefetch();
player.addPlayerListener(this);
midiControl=(MIDIControl)
player.getControl("javax.microedition.media.control.MIDIControl");
player.start();
} catch (MediaException e) {
printString("Exception setupMidi a: " + e);
}
catch (IOException e) {
printString("Exception setupMidi b: " + e);
}
}

public void run() {
while(!done) {
canvas.repaint();
daisy.tick();
daisy.playCurrentNotes();
try {
Thread.sleep(SLEEP);
} catch (InterruptedException e) {
daisy.printString("Exception (de1): " + e);
}
}
}