1

I have been running mpg321 on a headless linux server, and its working well, however the devices audio out uses alsa which is not mpg321 default audio devicetype. So when ever I want to play a mp3 I have to do something like:

mpg321 -o alsa /some/path/file.mp3

Is it possible to change mpg321 default devicetype to alsa so I do not have to keep using the -o option?

i.e would just be able to type

mpg321 /some/path/file.mp3
  • Not sure whether this is possible or not, but instead why not use a script that calls mpg321 with the -o alsa option and the file you pass to it? – Karan Feb 8 '13 at 4:52
  • 1
    @Karan because I have some software that uses mpg321 to run mp3 files, but I didnt not write the software and it would be much easier if I can change mpg321 default – Zac Powell Feb 8 '13 at 20:52
1

The man page says:

mpg321 also allows configuring a default output device at compile-time, but run-time switching is always allowed

So if you want to change the default output device you have to do it at compile time. This is not so difficult. If you run a debian based distribution you can check that your /etc/apt/sources.list contains a line such

deb-src http://ftp.us.debian.org/debian/ jessie main

Create a src directory, go inside and do

apt-get source mpg123

Install needed development libraries such as libasound2-dev

sudo apt-get install libasound2-dev

Run the configure script and set the default output device

./configure --with-default-audio=alsa

You should see in the output log

Default output module ... alsa

The run make

make

and install the program

sudo make install

If you prefer you can also rebuild a debian package with the modified version of mpg321 in order to install it through apt-get install. To do so follow the instructions from the official debian wiki Building Tutorial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.