83

I have an Mp3 file i need to convert to .wav to be able to import it into a voice changer program.

How do I do this using the command line?

TellMeWhy
  • 17,124
  • 39
  • 95
  • 141

1 Answers1

113

Using ffmpeg - installed by default

ffmpeg -i input.mp3 output.wav 

Alternative - mpg123

sudo apt-get install mpg123

Then to convert mp3 to wav (using -w option)

mpg123 -w output.wav input.mp3
TellMeWhy
  • 17,124
  • 39
  • 95
  • 141
  • Hi ,if possible could you expand it to run on all files in a folder? – kRazzy R Feb 20 '18 at 21:21
  • 12
    @kRazzyR: for f in ls; do ffmpeg -i $f $(basename $f).wav; done – datakid Mar 31 '18 at 02:06
  • 1
    @datakid Looks like syntax highlighter ate several symbols in your code. I've added your working solution into answer as UPD. – NG_ May 02 '19 at 11:39
  • 7
    @datakid You should [not parse `ls` output](https://unix.stackexchange.com/q/128985/20626). Instead use `for f in *.mp3; do ffmpeg -i "$f" "$(basename $f).wav"; done`. This also includes proper quoting and limits calling ffmpeg for mp3 files only. – scai Feb 17 '20 at 20:32
  • How to get 32 bit floating point wav with mpg123? – F. Vosnim Jun 26 '20 at 12:54
  • You can get 32 bit float wav output by adding the flag: "--encoding f32" or "-e f32" – Ethan Apr 13 '22 at 18:58