How do I increase the volume of an outgoing wav audio stream using Java? I'm having issues with various Java TTS engines and the output volume of the synthesized speech. Is there an API call or a doo-hickey.jar I can use to pump up the volume?
+2
A:
You can adjust volume using a GainControl, try something like this after you have opened the line
FloatControl volume= (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
objects
2009-06-04 23:41:12
+1
A:
If you're using the Java Sound API, you can set the volume with the MASTER_GAIN control.
import javax.sound.sampled.*;
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(
new File("some_file.wav"));
Clip clip = AudioSystem.getClip();
clip.open(audioInputStream);
FloatControl gainControl =
(FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
gainControl.setValue(-10.0f); // Reduce volume by 10 decibels.
clip.start();
markusk
2009-06-05 00:23:16
Thanx! I'll try this. For what it's worth I'm looking at the problem on both ends. I have an iPhone client ingesting the audio stream and just by using a different API on the client I get different volume. So I don't think my problem is entirely server side.
Cliff
2009-06-05 13:48:33