Smokes your problems, coughs fresh air.

Dumping a bunch of MP3s as WAV files

I just used the following command for converting a directory with a bunch of MP3s to WAV. Does someone know a command that is shorter? I find mine a bit convoluted to say the least.

mkdir wav
ls *mp3|while i;  mpg123 --stdout "$i" > wav/ $i|sed -r -e 's/^([0-9]+) .*$/\1/'`.wav;

The directory looks like this:

$ ls -1
01 - Meant to Be.mp3
02 - Reflections.mp3
03 - Semester Days.mp3
04 - Friend.mp3
05 - True Gemini.mp3
06 - Down the Road.mp3
07 - Tulip Trees.mp3
08 - Not Alone.mp3
09 - Woods of Chaos.mp3
10 - Twilight.mp3
[en] Readme - .txt
[es] Lee me - .txt
[fr] Lisez moi - .txt
[it] Readme - .txt
Rob Costlow - Solo Piano - Woods of Chaos.1.0.jpg

1 Comment

  1. halfgaar

    This is what I would do:

    for mp3_file in *.mp3; do mpg123 -w "`echo $mp3_file|sed -e 's/mp3/wav/'`" "$mp3_file"; done

    Although it’s hardly shorter…

© 2024 BigSmoke

Theme by Anders NorenUp ↑