Building on my last post on Linux sound hacks I’m including this little gem. It’s a little bash script I wrote that plays an input parameter through ALSA. It assumes aplay, oggdec, and mpg321 are installed on your system. (I don’t remember their respective packages but you can use Synaptic to find them.) Here’s the code:
#!/bin/bash
case $1 in
*.ogg) oggdec -Q -o - "$1" | aplay -q &
;;
*.wav|*.voc|*.wav|*.au|*.raw) aplay -q $1 &
;;
*.mp3) mpg321 -o alsa $1 &
;;
*) echo "unsupported file type $1"
;;
esac
To use it you have to save it somewhere on your system and make it executable. (I put mine in $HOME/bin and madify my environment so that $HOME/bin is in my $PATH. Use chmod +x on the command line to make it executable.) Next go into your “System Notification” settings dialog in KDE. In the lower right corner there is a player settings button. Key in the path to the file that you saved, hit apply, then hit ok and you’re all set. If you want you can easily compare the sound that the script gives you with the sound that the KDE sound system gives you (using the player settings dialog) to hear the difference.
Why?
In my experience the KDE sound system plays sound choppy and not as high quality as ALSA. I’ve also had far too many other issues when the Sound system was running than I care to explain. Try my hack and tell me what you think.

Amazing, been meaning to shut artsd off, it just gets in the way! Though applications that access sound through alsa seem to be happy with artsd hogging /dev/dsp, most binary-only software (Skype, Parallels) isn’t.
Great work!
By: LadFromWales85 on December 24, 2006
at 9:04 pm
Thanx Lad,
From my experience ALSA plays well with artsd when you enable the ALSA sink in arts. As I get time I’ll explore the issue in more depth and possibly come up with a better more complete analogy to explain it.
By: Cliff on December 26, 2006
at 10:45 am
apt-get install music123
vim /etc/music123rc
By: caletron on April 16, 2007
at 12:06 pm
Good tip caletron. That does basically what my above script does. I don’t have esdplay installed by default on my distro though. Also I’m not sure how ESD would share with Alsa. I’d have to think that it’s better than ArtsD.
By: Cliff on April 17, 2007
at 8:32 am
[...] ALSA for OSX Sounds 9 10 2008 A follow up to a much earlier post using the same idea I’ve modified my old command line shell script to handle .m4a and [...]
By: Use ALSA for OSX Sounds « Can’t see nothing but the source code on October 9, 2008
at 6:35 pm
[...] I’ve dealt with the no sound on Linux issue so many times I was about to pull my skull apart. I exercised a little more patience and Googled for [...]
By: KMID- KDE MIDI playback on Mepis/Debian « Can’t see nothing but the source code on May 19, 2009
at 7:33 pm