Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import javax.sound.sampled.AudioSystem;
- import javax.sound.sampled.Clip;
- public class Main {
- public static void main(String[] args) {
- try {
- Clip sonido = AudioSystem.getClip();
- File a = new File("c:\\sonidos\\sonido1.wav");
- sonido.open(AudioSystem.getAudioInputStream(a);
- sonido.start();
- System.out.println("Reproduciendo 10s. de sonido...");
- Thread.sleep(1000); // 1000 milisegundos (10 segundos)
- sonido.close();
- }
- catch (Exception tipoerror) {
- System.out.println("" + tipoerror);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment