javasound - Need a little with an audio player in java -
i'm making audio player in java,a small code snippet runs .wav files is:
audioinputstream ais = audiosystem.getaudioinputstream(new file("c:\\path\\c4.wav").getabsolutefile()); clip clip = audiosystem.getclip(); clip.open(ais); clip.start();
i want know things java sounds
first,what use of mixers,lines,ports in java sounds.
second,how include other formats such mp2,mp3...or there general method include format.
third,how add volume control.
fourth,i making player in net beans how use slider volume control , seek bar.
...and want make audio player using basic java sound api,i'm reading tutorial http://docs.oracle.com/javase/tutorial/sound/toc.html please don't give solutions having javafx or other media files included...
first of all, if want play sounds aren't looped , longer few seconds, shouldn't using clips.
you're going need use sourcedatalines, can read audio data in several different formats (consult audiofileformat.type specifics) via streams.
as questions:
mixers, lines, , ports used modify sound data leaves or enters java program. can mean changing pitch, pan, amplitude, , forth.
in order add mp3 decoding program, you're going have use external library. example java media framework (jmf).
if want add volume control, can use floatcontrol.type.volume. sourcedatalines compatible them.
to control volume slider, integer value slider , pass floatcontrol.type.volume. may take little finagling, floatcontrol.types have precise bounds , multipliers. seek bar, you'll find answer in jmf. no guarantees, though.
Comments
Post a Comment