Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (616)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Midi playback is fine using the JDK but not in JRE  (Read 2244 times)
0 Members and 1 Guest are viewing this topic.
Offline JuddMan

Senior Devvie

Medals: 1

Your Ad Here

« Posted 2003-05-21 14:48:55 »

Midi files being played work fine in my game and my midi player as long as im running them from the java sdk's java program (i've tried 1.4.0 - 1.4.2) but when i run them from the jre version (such as double clicking a jar file) it's as if it can't keep time.

Eg. "C:\Program Files\Java\j2re1.4.0\bin\java.exe" -jar JMidi.jar

is choppy, but
c:\j2sdk1.4.0\bin\java.exe -jar JMidi.jar

works just fine.

anyone have any idea why this happens or how to prevent the poor timing when people want to run java programs that use midi in the JRE?

win xp dell 1ghz laptop.
same on amd k6/2 450 winxp.
Offline aikarele

Senior Newbie

« Reply #1 - Posted 2003-06-01 06:06:15 »

Midi playback in Java uses software synthesis, which requires a soundbank. The soundbank is included in Java SDK, and in your case it is located in

However, to cut down the size of Windows version of JRE, Sun decided not to include the soundbank in Windows JRE (although it is included in Linux and Solaris version). Without a soundbank, JRE cannot perform software synthesis and JRE performs hardware synthesis using your sound card. In hardware synthesis, the sounds are different when using different sound cards and the timing can be poor.

So the only solution to your problem is that the people who only have the JRE version have to install a soundbank. Soundbanks can be downloaded from here:
Offline JuddMan

Senior Devvie

Medals: 1

Your Ad Here

« Reply #2 - Posted 2003-06-05 20:14:10 »

AHHHHHHHH so that explains it!

well, this is good. i didnt even notice that the midi sounded diferent on the jre runtime, just noticed the horrible timing.

the minimum soundbank, only 300 kb sounds like the sound you get out of JDK, although i do admit the medium one sounds much better. i'm downloading the 4 mb one but for a simple tetris game it's not going anywhere. will be interesting to see the results... i wish i was good at making my own samples for a custom sound bank. that'd make it stand out.

anyway thanks for posting that link!.


btw the soundbanks work easily enough by just residing in the directory your Jar file is in. (i would have my program move it to the correct directory if i knew how to locate the JRE installation that's currently in use.)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline JuddMan

Senior Devvie

Medals: 1

Your Ad Here

« Reply #3 - Posted 2003-06-05 20:30:40 »

very dissappointed... the biggest sound bank actually sounds worse than both the others, but i suppose it depends on your midi files as well. i think they may have been testing with only a few of them...

i'll listen to a couple more...

hmm not too bad...
what it sounds like... is a high quality recording through a low quality microphone... or... WMA...

the medium one is good and the small one is a good size to include with a game.
Offline aikarele

Senior Newbie

« Reply #4 - Posted 2003-06-06 18:12:48 »

Java uses Beatnik Audio Engine to render MIDI notes. If you want to use other instruments than the ones included in the general midi soundbank, or you want to have a smaller soundbank, you can create a soundbank yourself. This can be done using Beatnik Editor:

You can load your own soundbanks using
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Coldstream24 (16 views)
2015-09-03 00:41:28

Andrew_3ds (26 views)
2015-09-01 19:08:10

afikri (17 views)
2015-08-31 09:30:22

afikri (25 views)
2015-08-31 09:30:07

afikri (13 views)
2015-08-31 09:27:24

afikri (16 views)
2015-08-31 09:26:40

Roquen (30 views)
2015-08-29 11:30:54

GamerC4 (36 views)
2015-08-22 20:38:50

GamerC4 (33 views)
2015-08-22 20:37:18

GamerC4 (40 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!