Hi Guys,i have tried the Head First Java 2nd edition's programm called MiniMiniMusic and i do not hear anything.my computer's sound is ok and i have run the MusicTest1 without raising the exception "MidiUnavailableException",so what i am doing wrong? Thanks in advance
I tried the code myself. I got it to play...something. It wasn't a piano key like the book advertised but it was there and it was very subtle. Almost like static. Also, the program never exits. What is MusciTest1? I can't find it in the book.
Originally posted by Nickolas Case: ...the program never exits...
This can be fixed by adding the following 3 lines immediately after calling sequencer.start()...
This will cause a 2-second pause (which should be long enough for the sequencer to play the note), after which it will close the Sequencer and exit the program. There might be a better way, but this should work.
As for the sound, does your system have some sort of MIDI control panel? You might want to play around with those settings.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Apr 26, 2008
I was just making the point that I copied the code verbatim from the book and was able to get a sound. The program not exiting was an observation I found odd seeing how this is a code example from a teaching book. It should include these things.
I've found that the Head First books often use code examples to make specific points, and that the code examples aren't necessarily complete.
Some of my favorite code examples have been the ones where they say off-handedly "and oh, by the way, this has a bug in it"... I love finding (and fixing) that bug! If they had made it fault-free I wouldn't learn as much, I think.
Another favorite is when they give an exercise, I solve whatever it is and make exactly the mistake that they were setting me up to make. And then in the next section, they explain why I have to pay attention to ABC or why XYZ didn't happen even though I expected it too.
I'm tempted to say that if it is an incomplete example, then there is probably a good reason for it to be that way. And if not, then it is probably listed in the errata
Did you get it straightened out, Jones?
Joined: Sep 15, 2007
I couldnt find the valid reason ,so i skiped it went forward. Thanks guys for all the replies sent.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com