wood burning stoves 2.0*
The moose likes Java in General and the fly likes MIDI help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "MIDI help" Watch "MIDI help" New topic
Author

MIDI help

Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9
Hey guys, I have a question about sending and receiving MIDI messages...
How?
I have tried many different variations of code but get nothing...
I would be greatful if someone could point me in the right direction.

Cheers,
winn_man
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

Sending from where and sending to where?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9
Send midi out of a port, and receive through a port, the midi device is just a simple midi analyser.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What doesn't work?
Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9
I keep getting MidiUnavailableException.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Kinda hard to help.
Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9

Lines 65 and 67 produce the errors
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Stack trace might be helpful.
Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9
How do I get one of those, I've only really been programming in java for about a week!!! I'm using netbeans.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's the thing that gives you the exception you posted above, but with the rest of the information.

(Also note that the exception documentation may provide you with a clue as to what's going wrong.)
Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9
debug:
Exception in thread "Thread-3" java.lang.RuntimeException: Uncompilable source code - unreported exception javax.sound.midi.InvalidMidiDataException; must be caught or declared to be thrown
at MidiIOEvent.run(MidiIOEvent.java:72)
at java.lang.Thread.run(Thread.java:619)
BUILD SUCCESSFUL (total time: 9 seconds)

Is what I get from the output window, with the task window show:

unreported exception javax.sound.midi.InvalidMidiDataException; must be caught or declared to be thrown | MidiIOEvent.java | line 72 |
unreported exception javax.sound.midi.InvalidMidiUnavailableException; must be caught or declared to be thrown | MidiIOEvent.java | line 74 |


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's a compilation error: fix your Java first, then deal with the MIDI. Check out Java exception handling in whatever resource you're using to learn Java, or search the web.
Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9
The program works fine with out the midi code in, I've played around displaying the values from the textfields on the console output.

But thanks for the help... Will have to try and find a source that shows how to send midi.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're not understanding what I said: this has nothing to do with MIDI yet; your code isn't compiling because of Java errors. The message explains what's missing--you're neither catching, nor throwing, a checked exception.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

You are running this from an IDE, right? David is right; always make sure that all (and I really mean all) compiler errors are gone before you run your application.
Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9
Yeah, running it from the IDE... I honestly don't know how to fix this, I have been searching for a while and drawn up nothing... But I will keep searching till I can get an answer.
Tom Winn
Greenhorn

Joined: Dec 20, 2009
Posts: 9
Think i might have found the answer, try and catch!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MIDI help
 
Similar Threads
JavaFX and sound
midi sounds creation tool?
Is it possible to play a midi file
How to measure the Frequency/Pitch/Note of a Midi File?
MidiSystem.getSequencer (locks up)