How to get PCM data from a wav file?

前端 未结 1 1987
旧时难觅i
旧时难觅i 2020-12-06 03:34

I have a .wav file. I want to get the PCM data from that sound file, so that I can get the individual data chunks from the sound and process it.

But I

相关标签:
1条回答
  • 2020-12-06 04:01

    This can be done with the Java Sound API.

    • Use the AudioSystem to get an AudioInputStream from the file.
    • Query the stream for the AudioFormat.
    • Create a byte[] to suit the format. E.G. 8 bit mono is a byte[1]. 16 bit stereo is byte[4].
    • Read the stream in chunks of the byte[] and it will contain the sound, frame by frame.
    • Proceed with further processing..
    0 讨论(0)
提交回复
热议问题