Ubuntu – How to add a mp3 handler to sox

bashmp3soxUbuntu

I want to play music in the terminal with sox.

# install sox/lame
sudo apt-get install sox
sudo apt-get install lame

# play music
play music.mp3
# play FAIL formats: no handler for file extension `mp3'

# mp3 -> wav
lame --decode music.mp3 music.wav

# play music
play music.wav

~ $ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04 LTS"

~ $ sox --version
sox: SoX v14.3.2

The size of music.wav is +10 times larger than music.mp3.
I don't want to convert all *.mp3 to *.wav.
Is it possible to add mp3-handler to sox?

Best Answer

Pipe?

lame --decode music.mp3 - | play -

Won't leave any trace.

Related Question