Java Sound plays WAV's more quietly than other apps

  • Thread starter Jeffry Johnston
  • Start date
J

Jeffry Johnston

Hi,

I am developing a simple recording and mixing app for a musician
roommate using Java 2 1.4.1_01, Windows 98 SE, and the Java Sound API
(javax.sound.sampled.*). When I started on the project I decided to
just get a basic WAV player to work and build from there. That is
where I ran into an immediate problem. I have a simple working Java
WAV player, but it plays the WAV files at a lower volume level than
other Windows applications. I made sure that my volume controls were
all set to maximum volume. To make sure I was not hearing things, I
performed a few tests:

1) I ripped a CD track as an uncompressed PCM Stereo 16-bit WAV and
compared it to the CD. It had the same volume (WinAmp) as the CD
(cdplayer), as expected.
2) I played the WAV using graphedit (no volume control to get in the
way), to different Windows audio renderers (sound card, DirectSound,
WaveOut), the loudness was identical in each case. However, Java's
output continued to be noticeably quieter than each of these.
3) 8-bit WAV's were also quieter.

I checked into FloatControl.Type.MASTER_GAIN, and set the gain to
maximum using setValue. This made the playback sound even louder than
the other players, so I thought I had made progress. Looking at the
waveform in a WAV editor (I wanted to figure out a lower gain value)
revealed clipping against an artificial volume boundary. This volume
boundary was much lower than the full amplitude possible with 16-bit
sound. In other words, it amplified the signal where it could, so it
sounded louder, but the other parts clipped off. Not a pretty
picture.

At this point I am unsure how to resolve this volume problem. I would
appreciate any any suggestions. I wish I had access to another OS to
test the volume there (maybe it's just a problem with the Windows
implementation of Java Sound?), but unfortunately my particular Turtle
Beach Montego sound card does not yet have working drivers under Linux
(the chip is supported, but not the card, maybe someday :).

The source code to the (tiny) player is on my webpage at the following
URL:
http://lilly.csoft.net/~jeffryj/wavplay.java

Thanks in advance for any help,
Jeffry Johnston
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top