Search code examples
javaaudioinputstreamvolume

Volume of BufferedInputStream?


I have seen that you could adjust the volume of Clip, but after googling "Set volume of FileInputStream/BufferedInputStream", there wasn't really answers.

Is it possible to set this FIS/BIS audio volume? I use those in my MP3 player and want to make a method, where you could adjust the volume.

Any suggestions? Thanks in advance!


Solution

  • Since setting the volume of a BufferedInputStream makes as much sense as adjusting the volume of your couch, it's more likely that you're looking for something like Mixer, which can be used to implement volume control.

    It's been quite a few years since I've touched it, but it would allow you to adjust the volume with something like

    Mixer mixer = // get Mixer somehow through a provider
    FloatControl fc = (FloatControl)mixer.getControl(javax.sound.sampled.FloatControl.Type.MASTER_GAIN);
    fc.setValue(1.0f);