How to convert mp3 to wav in Ubuntu

Install sox tool with mp3 support:

apt-get install sox
apt-get install libsox-fmt-mp3
sox file.mp3 file.wav

Basically that is all, but if you need to check resulting wav file parameters like channels, sample rate, precision, duration, bit rate, etc…, use soxi command:

soxi file.wav

With my wav file, it shows the following:

Input File     : ’emergency.wav’
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:28.94 = 1276416 samples = 2170.78 CDDA sectors
File Size      : 5.11M
Bit Rate       : 1.41M
Sample Encoding: 16-bit Signed Integer PCM

to play wav file type

play file.wav

 File Size: 5.11M     Bit Rate: 1.41M
Encoding: Signed PCM
Channels: 2 @ 16-bit
Samplerate: 44100Hz
Replaygain: off
Duration: 00:00:28.94

In:12.5% 00:00:03.62 [00:00:25.32] Out:160k  [ -====|====- ] Hd:5.6 Clip:0

Links:

  1. SoX Documentation
  2. Audio manipulation with SoX
  3. SoX Examples (Probably not all examples are correct here, to change bit rate I did: sox sound16bit.wav -b 32 sound32bit.wav)
  4. Beautiful picture describing WAV header
  5. WAVE PCM soundfile format
  6. WAVE 24 and 32 bit should play on Ubuntu with GStreamer by default

3 Responses to How to convert mp3 to wav in Ubuntu

  1. dmitriano says:

    On CentOS, Nux Dextop requires EPEL repository, so I enabled all the repositories in /etc/yum.repos.d/epel.repo.

  2. dmitriano says:

    convert all the files in the current directory:
    for f in *; do sox $f ${f%.*}.wav; done;

  3. dmitriano says:

    Reducing sound volume:
    sox -v 0.9 in.wav out.wav

Leave a Reply

Your email address will not be published. Required fields are marked *