Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to play audio files java

File audioFile = new File("ur file's path").getAbsoluteFile();
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(audioFile);
Clip clip = AudioSystem.getClip();
clip.open(audioInputStream);
//Plays audio once
clip.start();
//Plays the audio in a loop
clip.loop(Clip.LOOP_CONTINUOUSLY);
//Stop the audio
clip.stop();
//optional
clip.close();
Comment

PREVIOUS NEXT
Code Example
Java :: android studio float to int 
Java :: all combinations of well-formed parentheses 
Java :: java swing enter key press event 
Java :: android studio start activity 
Java :: java jframe button 
Java :: list java initialize 
Java :: minecraft java arguments 
Java :: gravity in java 
Java :: java sort 2d array 
Java :: list in java 
Java :: print map in java 
Java :: how to find a specific word in a text file in java 
Java :: java for loop 
Java :: Java Using forName() method 
Java :: android studio close app 
Java :: parallel sorting in java 8 
Java :: convert optional object to object java 
Java :: how to count lines from txt java 
Java :: jave arrayList to Array 
Java :: how to make hello world in java 
Java :: java read first line of file 
Java :: capitalize string java 
Java :: turning a sentence to an array java 
Java :: read file java line 
Java :: import random java 
Java :: java localtime format 
Java :: java_home should point to a jdk not a jre 
Java :: how to create an array in java 
Java :: Spring boot fix cors problem 
Java :: android java get current time 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =