0

I downloaded a zip file that has drum sounds from http://99sounds.org/drum-samples/

I extracted them to a folder, I scanned for my desired sound, copied it into my project's 'src' file.

my code goes like this:

try{
                    music=new FileInputStream(new File("C:\\Users\\AMMUYUTAN\\Documents\\Java Specialization Course\\CS182P\\AudioSync\\src\\sound\\crash-acoustic.wav"));
                    AudioStream audios=new AudioStream(music);
                    AudioPlayer.player.start(audios);
                    }
                    catch(Exception ex){
                        JOptionPane.showMessageDialog(null,ex.getLocalizedMessage());
                    }
            }

I'm having no exceptions, it's just that it wouldn't play while the other sounds I downloaded played. The only difference from those wav files is that this one is from a zip file while the others(working ones) are direct download. I tried other sounds from the same zip file and all the same they do not play.

How to make a wav file from a zip file play?

Andre
  • 101
  • 9
  • You did extract it, right? Does it play on a 'regular' player, like VLC? – TDG Mar 11 '16 at 17:01
  • The fact that it was zipped at one point doesn't matter. As TDG suggested... Make sure the file is intact and not corrupt before attempting to make Java play it. In any case... WAVs require CODECs like any other media file. You cannot tell just by the extension what CODEC it uses. Try converting it to an MP3 before use. – durbnpoisn Mar 11 '16 at 17:02
  • Yup I extracted it. Yes it plays, I scanned which sound I was looking for then transferred it into my 'src' file. That was the reason I was able to specifically pick the 'crash-acoustic.wav' – Andre Mar 11 '16 at 17:03

1 Answers1

1

It works now! I converted the wav file to mp3 then back to wav and it played now. Thanks @TDG @durbnpoism for your help. Much appreciated! :)

Andre
  • 101
  • 9