I use that API to read wav file at Java: Reading and Writing Wav Files in Java
I read a wav file with Java and want to put all the values into an arraylist. I wrote:
// Open the wav file specified as the first argument
WavFile wavFile = WavFile.openWavFile(fileToRemoveSilence);
List<Double> allBuffer = new ArrayList<Double>();
....
do {
// Read frames into buffer
framesRead = wavFile.readFrames(buffer, 50);
for (double aBuffer : buffer) {
allBuffer.add(aBuffer);
}
} while (framesRead != 0);
When I check the size of allBuffer at debugger it says:
74700
However at the code it whe I use:
wavFile.display();
the output of it:
....
... Frames: 74613
....
My allbuffer is bigger than frames as displayed by that API. How it comes?
PS: My previous questions about this:
How to divide a wav file into 1 second pieces with Java?
PS2: I fixed the bugs however when I run the program I get that error sometimes: What may be the problem?
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
at sun.java2d.Disposer.run(Disposer.java:127)
at java.lang.Thread.run(Thread.java:662)
Exception while removing reference: java.lang.InterruptedException