File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes java sound using midi Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java sound using midi" Watch "java sound using midi" New topic
Author

java sound using midi

Eric Daly
Ranch Hand

Joined: Jul 11, 2006
Posts: 143
I am trying to use the code from the head first java 2nd edition book, page 342, and i am using eclipse ide with jre 1.6.0
it's giving me syntax errors when I declare
Sequencer player = MidiSystem.getSequencer();
and it tells me "The import javax.sound.midi is never used"
how can I get this to work? this is very frustrating and I cannot find anything about this through google or searching the forums. I have been looking at both for a half hour now... Thanks for the help


Studying for SCJP 6
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
It's complaining about an import statement. I'm sure that's just a warning. Maybe you have:

import javax.sound.midi;

when you meant

import javax.sound.midi.*;


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Eric Daly
Ranch Hand

Joined: Jul 11, 2006
Posts: 143
actually, I have typed in "import javax.sound.midi.*;"
now for some reason I don't have that warning (yes, it was just a warning) BUT I still have the error for syntax on the line that asks for a new sequencer.
i typed
Sequencer player = new MidiSystem.getSequencer();
and the error says "MidiSystem.getSequencer cannot be resolved to a type"
what should I do next?

EDIT: I figured out what I did wrong. I typed in "new" before MidiSystem.getSequencer(); which I didn't need because the method I'm calling is giving me a new object anyway, so it calls new, not me. thanks for the help.
[ January 16, 2007: Message edited by: Eric Daly ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java sound using midi
 
Similar Threads
Need help on generics
play full screen vedio using Jmf and CDC java
Setting System DSN using Java
package javax.servlet.http does not exist
How to star weblogic builder in Weblogic 10?