I use this API to read a wav file in Java: Read and write Wav files in Java
I read a wav file with Java and want to put all the values ββin 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 on the debugger, it says:
74700
However, in the code I'm using:
wavFile.display();
its conclusion:
.... ... Frames: 74613 ....
My allbuffer is larger than the frames displayed by this API. How does this happen?
PS: My previous questions:
Reading a wav file in Java
How to split wav file for 1 second with Java?
PS2: I fixed the errors, but when I run the program, I sometimes get this error: what could 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)
Link removal exception: java.lang.InterruptedException
source share