ALSA
From Indie IT Wiki
https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture
Setting Default Sound Device
For example, setting the SP/DIF Digital Output as the default device...
aplay -l **** List of PLAYBACK Hardware Devices **** card 0: SB [HDA ATI SB], device 0: VT1708S Analog [VT1708S Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: SB [HDA ATI SB], device 1: VT1708S Digital [VT1708S Digital] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: SB [HDA ATI SB], device 2: VT1708S HP [VT1708S HP] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1] Subdevices: 1/1 Subdevice #0: subdevice #0
Now, create and edit the ~/.asoundrc file with the following lines...
defaults.pcm.card 0 defaults.pcm.device 1 defaults.ctl.card 0
Then, test...
aplay /usr/share/sounds/alsa/Front_Center.wav