Re: Java, DLSSynth, DefaultOutput, Midi event playing.
Re: Java, DLSSynth, DefaultOutput, Midi event playing.
- Subject: Re: Java, DLSSynth, DefaultOutput, Midi event playing.
- From: Bill Stewart <email@hidden>
- Date: Wed, 04 Sep 2002 19:20:04 -0700
on 9/2/02 5:38 PM, Kurt Revis wrote:
>
On Sunday, September 1, 2002, at 11:32 PM, email@hidden wrote:
>
>
> Hi I think the following code should make some sort of noise when run.
>
> Any suggestions on why it doesn't?
>
>
A few things...
>
>
> // Connect the devices up
>
> graph.connectNodeInput(synthNode, 1, outputNode, 0);
>
>
I needed to change the 1 to 0 to get this to work. Which makes sense:
>
the 0th output of the synth goes into the 0th input of the output unit.
>
>
> // send the event to the synth
>
> // use the MusicDeviceMIDIEvent() call.
>
> MusicDevice synthUnit = (MusicDevice)
>
> graph.getNodeInfo_AudioUnit(synthNode);
>
> ExtendedNoteParams noteParameters = new
>
> ExtendedNoteParams(new float[] {0f, 60f, 127f, 0f});
This should be:
new float[] {60f, 127f}
The DLS Synth's notes are triggered with MIDI based values (though you can
use a float for the note number - 60.5 will give you the quarter tone
between 60 and 61 (with Jaguar only though:)
>
> synthUnit.startNote(10, 0, 0, noteParameters);
>
> synthUnit.stopNote(10, 0, 0);
You're stop note has to tell it which note to stop (so you could pass in 60
in this example just fine)
By default (if you're not passing in fractional pitches) you can use the
same note number that you use to turn the note on, but ideally you'd pass in
the noteInstanceID you get back from start note.
More to come on this in the SDK to be released very soon now.
>
>
I couldn't make any sense out of the extended note parameter stuff in
>
Java--I can't find any docs which describe the 4 parameters you are
>
giving it. (I can guess about the 60 and 127, but I don't know what
>
the 0s are for.) Perhaps someone else can help with that. I just
>
changed it to do a simple MIDI note, like this:
>
>
synthUnit.sendMIDIEvent(0x90, 60, 127, 0); // note-on
>
synthUnit.sendMIDIEvent(0x80, 60, 0, 10000); // note-off
That will work as well
>
You definitely want the note-off (or stopNote) to take place after a
>
delay. Your code above will stop the note at the same time that it is
>
started, so you may not hear it at all.
Indeed
>
Finally, if you are running this as a self-contained tool, it will exit
>
before you hear much of the the note. So I added this code to sleep for
>
5 seconds so the note has time to sound:
>
>
try {
>
Thread.sleep(5000);
>
} catch (Exception exception) {
>
// ignore
>
}
>
>
With these changes, I hear a note just fine.
>
>
--
>
Kurt Revis
>
email@hidden
>
_______________________________________________
>
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.
--
mailto:email@hidden
tel: +1 408 974 4056
__________________________________________________________________________
"...Been havin' some trouble lately in the sausage business," C.M.O.T.
Dibbler replied.
"What, having trouble making both ends meat?"
__________________________________________________________________________
_______________________________________________
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.