File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple Midi Problem

 
P Katergiathis
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... 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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
P Katergiathis
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic