Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (563)
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 1999 times)
0 Members and 1 Guest are viewing this topic.
Offline JuddMan

Senior Member


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
c:\j2sdk1.4.0\jre\lib\audio\soundbank.gm

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:
http://java.sun.com/products/java-media/sound/soundbanks.html
Offline JuddMan

Senior Member


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!.

-JuddMan!

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 Member


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...

nope...
nope...
omg...
hmm not too bad...
nope...
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:
http://www.beatnik.com/products/editor.html.

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

radar3301 (11 views)
2014-09-21 23:33:17

BurntPizza (28 views)
2014-09-21 02:42:18

BurntPizza (19 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

BurntPizza (30 views)
2014-09-19 03:14:18

Dwinin (47 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!