如何在上传时将音频转换为“.WAV”格式

I am developing one application where the users can upload audio files to the server by

using any android version in the mobile. By using in built android voice recorder they can

create only .amr format of the audio. But I need audio in the .wav format for some

telephonic use at the server side .

Is there any way in android to create .wav format in built android voice recorder

or at the server end is it possible convert any audio file format to .wav using PHP.

Any help would be thanksfull.

The best approach would be using FFMPEG as an php extension or you could run ffmpeg directly for converting. The simple way to do using php is:

<?php exec(ffmpeg -i audio.amr testwav.wav) ?>

But you may encounter some difficulties. So you should add some parameters. You could use "-ar" to set audio sampling rate (in Hz), "-ab" to set audio bit rate (in bits/s) and etc. Below is the sample:

<?php exec("ffmpeg -i audio.amr -ar 22050 -ab 32 -map_meta_data audio.wav:audio.amr audio.wav"); ?>

I would suggest converting on the server-side to save the bandwidth in transit from an uncompressed file.

You can use FFMPEG to do the conversion for you.

i think PHP is the best option, you can use FFMPEG, and take a look at these pages:

  1. http://wiki.dreamhost.com/FFmpeg
  2. http://wiki.dreamhost.com/Php-ffmpeg

You can also use FFMPEG on an Android device. It may be a tricky setup (some NDK configurations required), but this has been simplified greatly by JavaCV (available here).

I strongly advise you to use 3rd party online format conversion API to do the job, but if you have a server not limited on resources you can go to FFMPEG as suggested by Brad.
You could use online API like online-convert or find one matches you the best.