private void btnOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenActionPerformed
        JFileChooser chooser = new JFileChooser();
        chooser.setAcceptAllFileFilterUsed(true);
        chooser.setDialogTitle("Select OGG file");
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setMultiSelectionEnabled(false);
        if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){
            btnStopActionPerformed(null);
            
            final File selected = chooser.getSelectedFile();
            AssetLoader loader = null;
            if(selected.getName().endsWith(".wav")){
                loader = new WAVLoader();
            }else{
                loader = new OGGLoader();
            }
             
            AudioKey key = new AudioKey(selected.getName(), true, true);
            try{
                musicData = (AudioData) loader.load(new AssetInfo(null, key) {
                    @Override
                    public InputStream openStream() {
                        try{
                            return new FileInputStream(selected);
                        }catch (FileNotFoundException ex){
                            ex.printStackTrace();
                        }
                        return null;
                    }
                });
            }catch (IOException ex){
                ex.printStackTrace();
            }

            musicSource = new AudioNode(musicData, key);
            // A positional AudioNode would prohibit stereo sound!
            musicSource.setPositional(false);
            musicLength = musicData.getDuration();
            updateTime();
        }
    }
This method is called from within the constructor to
initialize the form.
WARNING: Do NOT modify this code. The content of this method is
always regenerated by the Form Editor.
jme3-examples/src/main/java/jme3test/audio/TestMusicPlayer.java