This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

No MIDI sound on Ubuntu - Java Head First  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I'm at chapter 11 of 'Java Head First' and there is this example MIDI program whose code I wrote down and compiled, it's supposed to give me a short sound when I run it, but there's no sound at all coming from my device (I can hear sounds of everything else outside my program just fine).

My OS: Ubuntu 16.04 LS
Java version: 1.5 (the one used with the book)

The code:



I'll be more than happy to provide you with other details.
 
Sheriff
Posts: 57886
178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch and sorry for the delay in replying. I had to find my copy of HFJ to verify that you had copied the code correctly, which you have. I am afraid I don't know why you are having problems; it made the right sound for me.
 
Sheriff
Posts: 4635
129
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can your system play a MIDI file, outside of Java?  For instance, can you play this?

https://drive.google.com/file/d/15jTEDSnaxMzckeC8HvPnqsAxTMCBsdh6/view?usp=sharing
 
Jan Kowalskii
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch and sorry for the delay in replying. I had to find my copy of HFJ to verify that you had copied the code correctly, which you have. I am afraid I don't know why you are having problems; it made the right sound for me.


Thank you! Good to know that the code is correct, so I guess it's the OS's fault. What OS have you run the code on though?

Knute Snortum wrote:Can your system play a MIDI file, outside of Java?  For instance, can you play this?

https://drive.google.com/file/d/15jTEDSnaxMzckeC8HvPnqsAxTMCBsdh6/view?usp=sharing


I couldn't play the file. I installed the program Timidity and associated MIDI files with it so the file is played by default by it, but that didn't aid in my problem with the command line app.
 
Campbell Ritchie
Sheriff
Posts: 57886
178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jan Kowalskii wrote:. . . What OS have you run the code on though? . . .

Fedora 27 and Ubuntu 17.10, both with JDK9.0.1.
 
Knute Snortum
Sheriff
Posts: 4635
129
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jan Kowalskii wrote:I couldn't play the file. I installed the program Timidity and associated MIDI files with it so the file is played by default by it, but that didn't aid in my problem with the command line app.


Okay, just to be clear, you could play the MIDI file from the command line after you installed Timidity but your HFJ program still didn't play a note?
 
Jan Kowalskii
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Knute Snortum wrote:

Jan Kowalskii wrote:I couldn't play the file. I installed the program Timidity and associated MIDI files with it so the file is played by default by it, but that didn't aid in my problem with the command line app.


Okay, just to be clear, you could play the MIDI file from the command line after you installed Timidity but your HFJ program still didn't play a note?



Exactly what happened. I can play your MIDI file via Terminal (or outside of it within app's GUI), but the HFJ code doesn't yield any results.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!