Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (489)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  
  Java midi sound is weird  (Read 2739 times)
0 Members and 1 Guest are viewing this topic.
Offline Pyrodragoon

Junior Member




Art calculated with java...


« Posted 2009-10-22 21:40:12 »

Hi @all,

2 days ago java did something, that I don't understand at all.
I have a little program that plays music with javax.midi
and the   soundbank-deluxe.gm
which I loaded by:
1  
2  
3  
4  
5  
6  
7  
soundbank = MidiSystem.getSoundbank(new File(soundbankFile));
sequencer = MidiSystem.getSequencer();
trans = sequencer.getTransmitter();
synth = MidiSystem.getSynthesizer();
synth.loadAllInstruments(soundbank);
rcvr = synth.getReceiver();
...

On my computer it works quite well,
but 2 days ago a friend of mine called me and said,
that my tool has something like an echo.
It plays normal notes and with some milliseconds delay
something different, which sounds awful.
We have the exact same program, both the same
OS (XP) and the same java version (Build 1.6.0_15-b03).
Without loading the soundbank the problem doesn't occur
on her pc. I don't know what to do, this is completely strange.
As I said the problem seems to be down to loading a different soundbank,
but what difference could there be between my pc and hers?
Offline Jono
« Reply #1 - Posted 2009-10-22 23:18:10 »

If somehow two instruments are being associated with the same id (because the initial sound bank isn't unloading), you could try out
1  
2  
synth.unloadAllInstruments(synth.getDefaultSoundbank());
synth.loadAllInstruments(soundbank);


Or do some checks with synth.getLoadedInstruments() to see if something strange is going on.
Offline Pyrodragoon

Junior Member




Art calculated with java...


« Reply #2 - Posted 2009-10-27 15:38:50 »

I acted on your advice but
it didn't help.
Actually the synthesizer has 0 instruments loaded from the default soundbank.
It's empty...  Huh
Also as I said, it seems really weird to me because the program
is working on my pc.
And in the past it worked on my friends pc as well, so it
can't depend on the hardware, which hasn't changed.
It's also not the code.
I don't know what to do, I
can't even think of anything I could try out to examine this more.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline paulscode

Senior Member


Medals: 12


Staff Sergeant


« Reply #3 - Posted 2009-10-27 19:48:40 »

If you try playing without loading the soundbank on the problem machine, does anything play?  I've had situations in the past where the default synthesizer indicates that it doesn't have any instruments, when in fact it does.

We love death.  The US loves life.  That is the difference between us.  -Osama bin Laden, mass murderer
Offline Pyrodragoon

Junior Member




Art calculated with java...


« Reply #4 - Posted 2009-11-02 15:26:34 »

Yeah, you're right, here as well without loading the soundbank
the program plays the default soundbank although the getLoadedInstruments()
method returns an emty array...
I tried something else:

With
1  
2  
3  
4  
Info [] dat = MidiSystem.getMidiDeviceInfo();
for (Info q : dat) {
  System.out.println("ff"+q.toString());
}


the output is:
Quote
ffMPU-401

ffMicrosoft MIDI-Mapper

ffMicrosoft GS Wavetable SW Synth

ffMPU-401

ffReal Time Sequencer

ffJava Sound Synthesizer

When I compiled the code
with 1.5 (done by changing the used JRE in eclipse)
the "error" disappeared and on all machines the sound was correct.

Maybe that helps you to help me  Wink
Offline Jono
« Reply #5 - Posted 2009-11-02 19:44:25 »

Someone here seems to have had the same problem, with the default soundbank playing at the same time as the new one:
http://forums.sun.com/thread.jspa?threadID=5182082

Their "solved" reply doesn't give much info though. Something to do with the location of their new soundbank's .gm file.  Undecided
Offline Pyrodragoon

Junior Member




Art calculated with java...


« Reply #6 - Posted 2009-11-03 22:48:48 »

If I understand correctly the user there put
his soundbank into the JRE directory to replace the default one.
That solves the problem on a really low level,
because everybody has to do the same in their own
installation. One should not need to change the JRE package I think.
And that is also just a way around the actual problem.

Is this maybe a new bug in 1.6 ?
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.

TehJavaDev (18 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (70 views)
2014-08-11 02:49:23

BurntPizza (47 views)
2014-08-09 21:09:32

BurntPizza (38 views)
2014-08-08 02:01: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!