• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
generating/synthesizing MIDI on the fly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

generating/synthesizing MIDI on the fly


  • Subject: generating/synthesizing MIDI on the fly
  • From: Robert Poor <email@hidden>
  • Date: Fri, 3 Jan 2003 10:34:31 -0500

[Pardon if this is a repeat post - my first attempt didn't show up. - r]

Dear List:

I am trying to algorithmically generate MIDI notes and send them in pseudo-real time to the built-in MIDI synth for rendering. (Notes are generated on the fly, which precludes using the MusicPlayer class.) My basic strategy is to hand a MIDIPacketList containing a few notes in advance to the driver via:

fOutputPort.send(fEndpoint, packetList);

I've got most of it working: I schedule MIDIData a few hundred milliseconds ahead of the start times for the notes, and I can see the system trying to play the notes at the right time. But rather than playing the notes, I'm getting the error:

java.lang.NullPointerException
at com.apple.audio.midi.MIDIDispatcher.readProc(MIDIDispatcher.java:93)

I'm sure I'm simply forgetting some critical step in the setup (for example, where do I tell the system that I want fEndpoint to connect to the internal MIDI synth?!?). In sketch form, here's what I'm doing:
=====
// setup...
fMIDIClient = new MIDIClient(new CAFString("test"), this);
fOutputPort = fMIDIClient.outputPortCreate(new CAFString("oport"));
fEndpoint = fMIDIClient.destinationCreate(new CAFString("dest"), this);

// in a separate thread, loop doing this...
MIDIPacketList packetList = new MIDIPacketList();
MIDIData n = MIDIData.newMIDINoteMessage(1, fPitch+60, 0x60, 0.2f);
packetList.add(fNoteTime, n);
fOutputPort.send(fEndpoint, packetList);
=====
Full sources available upon request. Happy new year, and best regards,

- Rob Poor

--
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: track sound levels in V1 stereo mixer with MusicSequence
  • Next by Date: ANN: More Feedback Machine AudioUnit
  • Previous by thread: track sound levels in V1 stereo mixer with MusicSequence
  • Next by thread: ANN: More Feedback Machine AudioUnit
  • Index(es):
    • Date
    • Thread