audio file comparison (java)
I'd like to make a comparison between two audio files based on their sample size (number of bits per sample)
I'm wondering if this code statement is correct:
AudioInputStream clip1 = AudioSystem.getAudioInputStream(soundFile1);
AudioInputStream clip2 = AudioSystem.getAudioInputStream(soundFile2);
// check sample size
if (clip1.getSampleSizeInBits() != clip2.getSampleSizeInBits()) {
...do something
}
I get this error (repeated twice): cannot find symbol symbol : method getSampleSizeInBits()
What should I do?
Actually what I want to do is to check the difference , so if they have differen开发者_开发问答t sample size , the user should get a warning message.
Thanks for your help
Ulrike
getSampleSizeInBits
is a method of AudioFormat
, not AudioInputStream
. You can get the appropriate AudioFormat
from the getFormat
method of AudioInputStream
, so the code should read:
clip1.getFormat().getSampleSizeInBits()
精彩评论