[Solved] Need a little with an audio player in java [closed]


First of all, if you want to play sounds that aren’t looped and are longer than a few seconds, you shouldn’t be using Clips.

You’re going to need to use SourceDataLines, which can read audio data in several different formats (consult AudioFileFormat.Type for specifics) via streams.

As for your questions:

  1. Mixers, Lines, and Ports are all used to modify sound data as it leaves or enters the java program. That can mean changing the pitch, pan, amplitude, and so forth.

  2. In order to add MP3 decoding to your program, you’re going to have to use an external library. An example would be the Java Media Framework (JMF).

  3. If you want to add volume control, you can use FloatControl.Type.VOLUME. SourceDataLines are compatible with them.

  4. To control to volume with a slider, simply get an integer value from the slider and pass it to FloatControl.Type.VOLUME. This may take a little finagling, as FloatControl.Types often have precise bounds and multipliers. As for a seek bar, you’ll probably find an answer in the JMF. No guarantees, though.

7

solved Need a little with an audio player in java [closed]