How can I draw sound data from my wav file?

后端 未结 3 1594
感动是毒
感动是毒 2020-12-04 17:10

First off this is for homework or... project.

I\'m having trouble understanding the idea behind how to draw the sound data waves on to a graph in Java for a project.

3条回答
  •  暖寄归人
    2020-12-04 17:46

    For standard WAV files, it's actually pretty easy. Once you get past the headers, you just interpret every 16 bits as a two's complement integer. I'd recommend using a DataInputStream, since then it is as easy as calling readShort().

    These are the amplitude values at each sample point. You may want to do some averages or something, because most of the time there will be way more samples than horizontal pixels. Trying to plot all the samples on some sort of line graph may not be the best way.

提交回复
热议问题