oNyx
|
 |
«
Posted
2004-10-02 05:46:44 » |
|
Ye, just like that. No exception... nothing... just silence :-/ Even Sun's "JavaSoundDemo" is silent... no wav, no aif, no midi, no rmf... silence  Win98se, sb128, directx9 (dx tests work flawlessly) [dunno if direct sound is used].
|
|
|
|
Bombadil
|
 |
«
Reply #1 - Posted
2004-10-02 08:06:24 » |
|
Well yes, something seems broken with Java 1.5 sound. :-( The official Javasound Demo does produce these results on a Win2000 box: 0. 1-welcome.wav : works 1. 22-new.aif : works 2. sfx-medley.rmf : silence3. spacemusic.au : works 4. trippygaia1.mid : silenceMy own little code outputting some wavs which worked with Java 1.4.x does produce some hiccup with Java 1.5.0: you hear something but it's wrong.
|
|
|
|
DrBizzar0
|
 |
«
Reply #2 - Posted
2004-10-02 08:17:56 » |
|
for me it seems like sound clips under 1 second in length for the most time produces silence and sometimes static noice. 
|
|
|
|
Games published by our own members! Check 'em out!
|
|
erikd
|
 |
«
Reply #3 - Posted
2004-10-02 22:16:16 » |
|
I had a problem too with 1.5 and javasound. The initialization behaved differently, causing initialization to fail. I filed a bug report but I have to check if they fixed that one. Dunno if it's the same problem though...
EDIT: Just checked, should be fixed in the RC version.
|
|
|
|
princec
|
 |
«
Reply #4 - Posted
2004-10-04 07:33:01 » |
|
No sounds in Puppy Invaders (applet we've got) either. Bugger. Cas 
|
|
|
|
Bombadil
|
 |
«
Reply #5 - Posted
2004-10-05 06:37:18 » |
|
Does this mean that many games won't sound correct (or be silent?) when being used with the new Java 1.5 ? If so: Erik, could you please post the URL to your bug report so that we can vote on this. Maybe we should even start a general topic to ask people to vote for a bug fix. A JVM which produces wrong or no sounds is very bad for games! --- Sun article from 30-Sep-2004... Tiger Roars: The Release of Java 2 Platform, Standard Edition (J2SE) 5.0, an Interview with Sun Fellow Graham Hamilton. (He's the lead architect for J2SE releases 1.3, 1.4, and now, 5.0.) I'm also happy to report that Tiger looks like our highest quality J2SE release ever. Quality had been job #1 throughout the release development and this has paid off. In his recent blog, Mark Reinhold, Chief Engineer for J2SE, talks about how well we are doing on our various quality metrics. (..) Theme #1 is quality. By quality, we mean stability, robustness, and compatibility. We want your earlier applications to just plain work with Tiger. We want to maintain previous behavior. We want this to be a release that can stay up for months or years at a time. Ahem. So nobody of those many quality testers of "job #1" ever run the Java sound demo with Java 1.5 ? Sigh, maybe they shouldn't hear music with headphones at work.
|
|
|
|
princec
|
 |
«
Reply #6 - Posted
2004-10-06 08:11:17 » |
|
"Tiger squeaks" may have been a better title. Cas 
|
|
|
|
erikd
|
 |
«
Reply #7 - Posted
2004-10-06 09:39:51 » |
|
Does this mean that many games won't sound correct (or be silent?) when being used with the new Java 1.5 ? If so: Erik, could you please post the URL to your bug report so that we can vote on this. Maybe we should even start a general topic to ask people to vote for a bug fix. A JVM which produces wrong or no sounds is very bad for games! The problem was that bahaviour of initialization was different than before, but in cases where initialization was not done correctly. Because that wrong way of initializing was a very common mistake, they decided to revert back to old behaviour. Should be fixed in 1.5.0 RC. Read about it here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5053380
|
|
|
|
oNyx
|
 |
«
Reply #8 - Posted
2004-10-06 10:12:22 » |
|
>Apparently, this mis-use of DataLine.Info's audio format is quite common.
Hm... yea... very funny. I only found examples which "mis-use" that.
So what's the proper way then? And why don't they mention it?
Should I try open() without params, because that wrong way was commonly used and got fixed?
Bah. It's so screwed.
|
|
|
|
Malohkan
|
 |
«
Reply #9 - Posted
2004-10-06 10:52:43 » |
|
why couldn't they, for backward compatibility purposes, make them both work?
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Bombadil
|
 |
«
Reply #10 - Posted
2004-10-06 10:54:52 » |
|
The problem was that bahaviour of initialization was different than before, but in cases where initialization was not done correctly.
Thanks, good to hear. So it's just the JavaSound demo which is partly broken and many sound play routines, including mine. So we're to blame? :) I checked my routine against the format parameter and it's there. I don't see what I am doing wrong to play a simple clip... I tried to follow the Sound programmer's guide in the Javadoc. Here's my version. Does anybody see what's the problem? 1 2 3 4 5 6 7 8 9 10 11 12 13
| BufferedInputStream is = new BufferedInputStream(new FileInputStream("Sam.wav"));
AudioInputStream audiostream = AudioSystem.getAudioInputStream(is); AudioFormat audioformat = audiostream.getFormat();
int bytelength = (int) (audioformat.getFrameSize() * audiostream.getFrameLength()); byte[] sampledata = new byte[bytelength]; audiostream.read(sampledata, 0, bytelength);
DataLine.Info datalineinfo = new DataLine.Info(Clip.class, audioformat, bytelength); Clip klip = (Clip) AudioSystem.getLine(datalineinfo); klip.open(audioformat, sampledata, 0, bytelength); klip.start(); |
|
|
|
|
wmjoers
Senior Newbie 
Nobody can be uncheered with a balloon.
|
 |
«
Reply #11 - Posted
2004-10-07 04:20:00 » |
|
I'm using java.applet.AudioClip (wich is very old but has been working until now).
Some of my wav's has gone silent...most of them are less than 1 sec but some works and some don't.
Has anyone filed a bug report regarding the sound problems?
|
|
|
|
erikd
|
 |
«
Reply #12 - Posted
2004-10-07 05:53:28 » |
|
Does anybody see what's the problem? Looks fine to me. If this worked in 1.4, maybe you can use it to create a small test case and file a bug report (if it's not there already)? In any way, even if there was something wrong, bahaviour shouldn't change with a new version I think.
|
|
|
|
Bombadil
|
 |
«
Reply #13 - Posted
2004-10-07 07:08:38 » |
|
Looks fine to me. If this worked in 1.4, maybe you can use it to create a small test case and file a bug report (if it's not there already)?
It worked fine for all Java 1.4 versions. Plus I can't see the "missing format parameter" which your originally quoted bug mentioned. So I think this sample should work. Which it doesn't. I think I'm going to issue a bug report soon. Wmjoers: Yes, "Applet.AudioClip" ist very easy to use, but isn't one problem of it that you can't play the same Clip (which maps to a wav file for example) several times at once?
|
|
|
|
wmjoers
Senior Newbie 
Nobody can be uncheered with a balloon.
|
 |
«
Reply #14 - Posted
2004-10-07 10:14:19 » |
|
Well anyway.. i've used AudioClip in a game(not an applet) and it allways worked perfect (even in the 1.5 beta) but suddenly in 5.0 (1.5) some of the wav files are silent. It seems to me that some fundamental things has been broken in Java Sound. 
|
|
|
|
dranonymous
Junior Devvie  
Hoping to become a Java Titan someday!
|
 |
«
Reply #15 - Posted
2004-10-07 12:31:42 » |
|
As a small note about AudioClips and WAVs. I've had nothing but problems with them.. Some work, some don't. My solution, which seems to always work, is to only use AIFF format. You'll have to convert your existing sounds, but you can get Audacity from sourceForge and you'll be on your way.
Dr. A>
|
|
|
|
Hansdampf
|
 |
«
Reply #16 - Posted
2004-10-07 17:40:41 » |
|
Some of my wav's has gone silent...most of them are less than 1 sec but some works and some don't.
same here, short sounds don't work (occasionally? they do), longer ones work (some do not). Does'nt seem to have to do anything with the audio format because I'm generating them (not loading from a file)
|
|
|
|
Bombadil
|
 |
«
Reply #17 - Posted
2004-10-08 04:49:45 » |
|
Looks like there's some real bug in there... Would some of you knowing more about Javasound, like to file a bug report to SUN's database?
|
|
|
|
oNyx
|
 |
«
Reply #18 - Posted
2004-10-08 07:12:34 » |
|
Kickin midi events manually in surprisingly works.
Playing rmf also (sometimes) works if you play, pause, wait, unpause... alright (midi should "work" like that too)... but of course - just for the fun of it - the last seconds are cut off. Yea, very funny indeed :-/
|
|
|
|
wmjoers
Senior Newbie 
Nobody can be uncheered with a balloon.
|
 |
«
Reply #19 - Posted
2004-10-11 10:53:31 » |
|
|
|
|
|
Bombadil
|
 |
«
Reply #20 - Posted
2004-10-12 14:33:09 » |
|
Ah, there it is: Thus this is java sound's problem, not applet's one. xxxxx@xxxxx 2004-09-17
This might be either java sound or io problem, reassigning to javasound for further investigation. xxxxx@xxxxx 2004-09-17
So I guess we should all vote on this bug? It's just four votes so far. :-(
|
|
|
|
oNyx
|
 |
«
Reply #21 - Posted
2004-10-12 15:25:11 » |
|
Ah, there it is:
So I guess we should all vote on this bug? It's just four votes so far. :-(
Ye, well I'm wondering if it's the right one to vote for. The whole sound stuff is b0rked in my case (except manually triggered midi events).
|
|
|
|
Bombadil
|
 |
«
Reply #22 - Posted
2004-10-12 15:37:08 » |
|
Ye, well I'm wondering if it's the right one to vote for. The whole sound stuff is b0rked in my case (except manually triggered midi events). Ok. Then somebody please file a "borq sound" bug and annotate it here so we all can vote for it.
|
|
|
|
Yuri Vl. Gushchin
Senior Devvie   
Speak Java!
|
 |
«
Reply #23 - Posted
2004-11-07 10:46:47 » |
|
Bombadil, I was checking the problem with JavaSound driver of Xith3D and found that the problems happen only with direct audio drivers. I tried to fall back to Software Mixer, and everything is working fine again. If this workaround is OK for you, you can use the following code to get software mixer: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public Mixer getMixer() { Mixer.Info[] mixers = AudioSystem.getMixerInfo(); for (int i = 0; i < mixers.length; i++) { if ("Java Sound Audio Engine".equals(mixers[i].getName())) { return AudioSystem.getMixer(mixers[i]); } } return null; }
... Mixer mix = getMixer(); if (mix != null) clip = (Clip) mix.getLine(...); else clip = (Clip) AudioSystem.getLine(...); clip.open(sb.af,sb.data,0,sb.size); } |
Yuri
|
Yuri Vl. Gushchin JProof Group
|
|
|
Bombadil
|
 |
«
Reply #24 - Posted
2004-11-08 04:35:34 » |
|
I was checking the problem with JavaSound driver of Xith3D and found that the problems happen only with direct audio drivers. I tried to fall back to Software Mixer, and everything is working fine again. If this workaround is OK for you, you can use the following code to get software mixer Thanks Yuri, this works perfect. Welcome back on the forum. :-) So, does Xith now also use this workaround, ie Java software mixer for sound? Does the software mixer mean a big performance decrease in contrast to other mixers, or is it marginal?
|
|
|
|
|
Yuri Vl. Gushchin
Senior Devvie   
Speak Java!
|
 |
«
Reply #26 - Posted
2004-11-08 06:22:09 » |
|
Hi, So, does Xith now also use this workaround, ie Java software mixer for sound? Yes. Does the software mixer mean a big performance decrease in contrast to other mixers, or is it marginal? Not really. It was default implementation in Java 1.4.2. Yuri
|
Yuri Vl. Gushchin JProof Group
|
|
|
oNyx
|
 |
«
Reply #27 - Posted
2004-11-08 06:37:50 » |
|
Alright. I just voted for 5070730 after some research.
|
|
|
|
Matzon
|
 |
«
Reply #28 - Posted
2004-11-10 06:14:06 » |
|
just got hit by same bug - reverting to software mixer works - go figure.
|
|
|
|
Matzon
|
 |
«
Reply #29 - Posted
2004-11-10 06:22:53 » |
|
but when I shutdown the sound engine, I get some strange sounds - like something run backwards.
I shutdown the sound engine by enumerating all clips and calling close on them. If I don't do that, it shutdowns quicker and I don't get any distorted sound effects.
|
|
|
|
|