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 :: java ee check if session exists or is new 
Java :: circle line intersection java 
Java :: swing event enter key 
Java :: java generic array 
Java :: append button java 
Java :: convert string to short java 
Java :: android studio get string from strings.xml 
Java :: iterator constructor java 
Java :: get file extension java 
Java :: first and last digit sum java 
Java :: how to declare list of object in java as constant 
Java :: papermc api maven 
Java :: java check data type 
Java :: How to create an adjacency list representation of a graph, in Java? 
Java :: android glide 
Java :: how to print two variables in same line in java 
Java :: java.lang.ExceptionInInitializerError: null 
Java :: android hide status bar and action bar daynamically 
Java :: set char value to null java 
Java :: float random class java 
Java :: get text from edittext android 
Java :: free news api for android 
Java :: java suppress warnings rawtypes 
Java :: get hashmap into array 
Java :: print random from list java 
Java :: sum of 1D array(JAVA) 
Java :: java decimalformat 
Java :: java get variable from another class 
Java :: java export image 
Java :: android time 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =