get Audio Clip from URL - Java javax.sound.sampled

Java examples for javax.sound.sampled:Audio

Description

get Audio Clip from URL

Demo Code


//package com.java2s;
import java.applet.*;
import java.net.*;

public class Main {

    public static final AudioClip getAudioClip(String filename) {
        if (filename != null) {
            try {
                return Applet.newAudioClip(new URL(
                        "http://harp.njit.edu/~my67/cs602/chapter10/"
                                + filename));
            } catch (MalformedURLException e) {
                System.err.println(e.getMessage());
            }//w  w  w.ja  v  a  2s  . c o m
        }
        return null;
    }
}

Related Tutorials