Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (289)
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 2325 times)
0 Members and 1 Guest are viewing this topic.
Offline Pyrodragoon

Junior Member




Art calculated with java...


« Posted 2009-10-22 23: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

Senior Member


Medals: 1
Projects: 1



« Reply #1 - Posted 2009-10-23 01: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 16: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: 9


Staff Sergeant


« Reply #3 - Posted 2009-10-27 20: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 16: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

Senior Member


Medals: 1
Projects: 1



« Reply #5 - Posted 2009-11-02 20: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 23: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.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (60 views)
2013-05-17 21:29:12

alaslipknot (69 views)
2013-05-16 21:24:48

gouessej (99 views)
2013-05-16 00:53:38

gouessej (98 views)
2013-05-16 00:17:58

theagentd (107 views)
2013-05-15 15:01:13

theagentd (98 views)
2013-05-15 15:00:54

StreetDoggy (144 views)
2013-05-14 15:56:26

kutucuk (167 views)
2013-05-12 17:10:36

kutucuk (166 views)
2013-05-12 15:36:09

UnluckyDevil (175 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.117 seconds with 20 queries.