In a section of my program, I read the first 4410 frames of a .wav file. Which I have checked in Audacity and those 4410 frames contain nothing but a blank audio space. Image of the audio in Audacity
The bit of code in question takes the other blank audio .wav file of 4410 frames which you can see in the image called "Space", and compares it to the first 4410 frames of the audio file to check if they're equal, which they should be but the program keeps telling me otherwise.
Here is the code:
MorseAudio = FC.getSelectedFile();
try{
AudioInputStream SpaceClip = AudioSystem.getAudioInputStream(Space);
AudioInputStream Clip = AudioSystem.getAudioInputStream(MorseAudio);
int BytesPerFrame = Clip.getFormat().getFrameSize();
int SectionSize = 4410 * BytesPerFrame;
byte[] SpaceSection = new byte[SectionSize];
SpaceClip.read(SpaceSection);
byte[] SectionRead = new byte[SectionSize];
Clip.read(SectionRead);
if(SectionRead.equals(SpaceSection)){
System.out.println("OKAY");
}else{
System.out.println("NOT OKAY");
}
}catch (Exception e){System.err.println(e);}
What am I doing wrong?