mplayer — multiple sound cards: select audio device 
Mplayer is the ultimate media player. Bold statement, huh? Well mplayer is loaded with features, options, switches and other functionalities. If default settings satisfy your needs then that is great. However, if you have to use some of the non-default functionalities then mplayer's shell syntax can take a little getting used. This post contains examples of how to select an audio architecture that mplayer uses (e.g. ALSA, OSS, etc.) as well as how to select a specific audio device if you have multiple sound cards.
Typically, to play some mp3 audio files with mplayer the following command can be used.
mplayer *.mp3
However, what if you wanted to be a bit more specific, f.e. as to which audio architecture is to be used, e.g. OSS or ALSA. Well, the following commands achieve exactly this, respectively.
mplayer -ao oss *.mp3 mplayer -ao alsa *.mp3
Going further, if you had multiple audio devices you could specify which device to use. For example, to explicitly specify the default device either of the following commands can be used.
mplayer -ao oss:/dev/dsp *.mp3 mplayer -ao alsa:device=hw=0.0 *.mp3
Or, to specify a non-default (secondary) device either of the following commands can be used.
mplayer -ao oss:/dev/dsp1 *.mp3 mplayer -ao alsa:device=hw=1.0 *.mp3
The syntax in the above examples is quite obvious, however at first it can take some effort to get it right.
Enjoy!
Did you find the above information useful and interesting? If so, please support this site by using the blog directory links at the bottom of this page. Thanks for your support!
If you have any Linux related problems or questions then please feel free to post them on our Linux Forums: http://linux.dsplabs.com.au/forums.

December 2nd, 2008 at 10:14 pm
that was exactly what I was looking for, thank you very much!
April 25th, 2009 at 6:19 pm
great, since i have 2 sound cards in my "music" server it's a great solution
June 25th, 2009 at 2:35 pm
Thank you so much. Been looking for this for forever, searched thru the mplayer man page etc. but just couldn't find it (using secondary device). Major kudos.
July 9th, 2011 at 10:21 pm
Exactly what i needed, i have 3 cards; the third one is a usb connected to a subwoofer that i wanted to use, so i used hw=2.0 and worked like charm
August 23rd, 2011 at 11:21 am
Thanks. Worked for me
September 13th, 2011 at 9:03 am
you made my day!
November 7th, 2011 at 8:19 pm
[…] letzter Zeit immer häufiger den altgedienten mplayer verwende, musste ich mal nachschauen und bin hier fündig geworden. Der Befehl für den mplayer lautet: mplayer -ao oss:/dev/dsp […]
January 24th, 2012 at 6:24 pm
Great & simple article, I can use it on windows too
e.g. mplayer -ao dsound:device=2 *.mp3
To use the secondary device.