... from a Java newbie, fluent in other languages.
I am trying to create a simple program that will open a midi out port on my computer and send a note to it. My computer is running Windows and i run the following code in order to find out the available midi ports on my machine:
The code reveals the following information:
... so , all i want to do is select any of these ports and send a C to it for a given time duration.
I think the you need to create several objects, first a Sequencer, then a Track, then a MidiEvent, and finally a MidiMessage with the appropriate data. It looks like you need to know the MIDI file format for this.
An example -which doesn't actually look all that complicated- can be found here.
Thank you for replying. I am aware of the technique that you described (and the related example), yet it is not what i want, because it sends a note to a "synthesizer", namely the default windows synth of my on-board card.
What i need is a way to send a midi message (a midi event, actually) to a pre-defined "receiver", in order to drive (via midi) an external synth.
Take this code for example:
... taken from the book mentioned in the comment and it's related web site. It gets a list of installed midi outputs and (supposedly) will send a midi event, yet it does not seem to work in the sense that the author does not provide adequate info on how to construct such a midi event, or the way that a specific "receiver" is selected.
I don't know nothing about this, but was wondering if this can hep you:
The Java Sound API specification provides low-level support for audio operations such as audio playback and capture (recording), mixing, MIDI sequencing, and MIDI synthesis in an extensible, flexible framework.