[Logo]
Forums Register Login
No MIDI sound on Ubuntu - Java Head First
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.
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.
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
 

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.
 

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

Fedora 27 and Ubuntu 17.10, both with JDK9.0.1.
 

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?
 

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.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards


This thread has been viewed 217 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jun 19, 2018 08:41:28.