Reading wav file in Java

kamaci picture kamaci · Mar 6, 2011 · Viewed 44.2k times · Source

I want to read wav files in Java and I am going to classify them with K-means.

How can I read wav files in Java and assign them into an array or something like that(you can suggest ideas for it) to classify them?

EDIT: I want to use APIs for reading wav files and for K-means.

Answer

shams picture shams · Mar 6, 2011

The official Java Sound Programmer Guide walks through reading and writing audio files.

This article by A Greensted: Reading and Writing Wav Files in java should be helpful. The WavFile class is very useful and it can be tweaked to return the entire data array instead of buffered fragments.