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.
Java Sound supports a set of audio file formats, for example AU, AIF, and WAV.
AudioSystem. write(audioInputStream, AudioFileFormat. Type. WAVE, wavFile);
Windows and Mac are both capable of opening WAV files. For Windows, if you double-click a WAV file, it will open using Windows Media Player. For Mac, if you double-click a WAV, it will open using iTunes or Quicktime.
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.
Equivalent to matlab's wavread function:
http://web.archive.org/web/20120531113946/http://www.builogic.com/java/javasound-read-write.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With