• Post Reply Bookmark Topic Watch Topic
  • New Topic

No MIDI sound on Ubuntu - Java Head First  RSS feed

 
Jan Kowalskii
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.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • 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.
 
Knute Snortum
Sheriff
Posts: 4274
127
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
Marshal
Posts: 56529
172
  • 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: 4274
127
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!