It's not a secret anymore!*
The moose likes Beginning Java and the fly likes Simple Midi Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple Midi Problem" Watch "Simple Midi Problem" New topic
Author

Simple Midi Problem

P Katergiathis
Greenhorn

Joined: Feb 17, 2007
Posts: 3
... 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.

Any help is welcome.

Best Regards
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
Welcome to JavaRanch.

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.


Ping & DNS - my free Android networking tools app
P Katergiathis
Greenhorn

Joined: Feb 17, 2007
Posts: 3
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.

Any more thoughts?

Panos
[ February 18, 2007: Message edited by: Panos Katergiathis ]
Johny Doey
Greenhorn

Joined: Feb 17, 2007
Posts: 7
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.

taken from: http://java.sun.com/products/java-media/sound/
Does that sound like it's ossible to do what you want? Either way I found this FAQ:
http://www.jsresources.org/faq_midi.html
 
Consider Paul's rocket mass heater.
 
subject: Simple Midi Problem