
Question:
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 different sample size , the user should get a warning message.
Thanks for your help
Ulrike
Solution:1
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()
Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
EmoticonEmoticon