Conversion of Audio Format

前端 未结 2 812
不思量自难忘°
不思量自难忘° 2020-12-06 07:24

I am having trouble in converting the audio format of a WAV file.

I am recording sound from my microphone and the sound is recorded in the following format: PCM_SIGN

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 08:25

    Did you take a look at the documentation?

    Throws: IllegalArgumentException - if the conversion is not supported #see #getTargetEncodings(AudioFormat)

    Not every system will have sufficient codecs installed to transform to the specific format you've asked for. You've assumed yours does, but it's throwing the exception because it can't transform to that format.

    You can use getTargetEncodings to check the suitability of a given format programatically, without relying on an exception, and then can take appropriate action if you desired output format isn't available (e.g. fall back to another one, present the user with feedback that this is impossible, etc.).

提交回复
热议问题