public synchronized BackgroundSound playBackground(InputStream is) {
        if (bs != null) {
            bs.stopBackgroundSound(false);
        }

        AudioInputStream ais = null;
        try {
            ais = AudioSystem.getAudioInputStream(is);
        } catch (UnsupportedAudioFileException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        if (ais == null) {
            return null;
        }

        AudioFormat format = ais.getFormat();
        DataLine.Info info = new DataLine.Info(
                SourceDataLine.class, format);

        SourceDataLine background = null;

        try {
            background = (SourceDataLine) AudioSystem.getLine(info);
        } catch (LineUnavailableException e) {
            e.printStackTrace();
        }

        try {
            background.open();
        } catch (LineUnavailableException e) {
            e.printStackTrace();
        }
        background.start();

        bs = new BackgroundSound(ais, background);
        return bs;
    }