How to convert .pcm file to .wav or .mp3?

后端 未结 4 715
终归单人心
终归单人心 2020-12-14 09:29

I am currently developing an Android Application that has audio recording and playing. I am new to dealing with audio and I\'m having some trouble with encoding and formats.

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 10:08

    I tried the above code for audio recording writeAudioDataToFile(). It perfectly records and convert the audio into .wav format. But when I played the recorded audio, it was too fast. 5sec audio completed in 2.5 sec. Then I observed it was because of this short2byte() function.

    For those how are having same problem should not use short2byte() and directly write sData in line os.write(sData, 0, Constants.BufferElements2Rec * Constants.BytesPerElement); where sData should be byte[].

提交回复
热议问题