Debian Alsa

From YobiWiki
Jump to navigation Jump to search

Alsa

apt-get install alsa-base alsa-utils [ gnome-alsamixer alsamixergui ]
  • alsamixer -> be sure main channels are active with some volume
  • alsaconf

OSS compatibility

To check the OSS compatibility:

lsmod|grep oss -> snd_pcm_oss and snd_mixer_oss
play ...wav (apt-get install sox)

To allow mixing of wrapped OSS streams with ALSA:
/etc/asound.conf:

pcm.asymed {
         type asym
         playback.pcm "dmix"
         capture.pcm "dsnoop"
}
pcm.!default {
         type plug
         slave.pcm "asymed"
}
pcm.!dmix {
         type dmix
         ipc_key
         ipc_key_add_uid yes
         slave {
                 pcm "hw:0,0"
                 period_time 0
                 # Values required for mplayer:
                 period_size 1024
                 buffer_size 8196
                 format S16_LE
                rate 48000
         }
         bindings {
                 0 0
                 1 1
         }
}
pcm.!dsnoop {
         type dsnoop
         ipc_key
         ipc_key_add_uid yes
         slave {
                 pcm "hw:0,0"
                 period_time 0
                 period_size 1024
                 buffer_size 8196
                 format S16_LE
                 rate 48000
         }
         bindings {
                 0 0
                 0 1
         }
}

More explanations about asound.conf here

UPDATE I got the error can't create mcop directory at a point in time when trying to use mpg321.
Edit /etc/libao.conf and/or $HOME/.libao:

default_driver=alsa09
=> 
default_driver=alsa

esd

To run esd in a compatible way:

apt-get install esound libesd-alsa0 esound-clients [ alsaplayer-esd mpg123-esd ]

/etc/esound/esd.conf: put auto_spawn=1 only if you don't run esd at startup of gnome

[esd]
auto_spawn=1
spawn_options=-terminate -nobeeps -as 2
spawn_wait_ms=100
# default options are used in spawned and non-spawned mode
default_options=

Note that currently things go very wrong if a user enables the esd in his Gnome preferences, session hangs till esd is killed :-(

aRts

apt-get install arts akode

All together

To resume, we can achieve transparent mixing with all these together:

  • ALSA
    • aplay (or alsaplayer from alsaplayer-alsa)
    • aoss play (wrapper for OSS programs -> ALSA)
  • aRts (artsd)
    • artsplay
    • artsdsp play (wrapper for OSS programs -> aRts -> ALSA)
  • esound (esd)
    • esdplay
    • esddsp play (wrapper for OSS programs -> esound -> ALSA)

Of course direct use of play with the snd-pcm-oss module cannot be mixed with those.

Clients

This page might help finding its way with all the mixer daemons and configuring various applications (xmms, gaim, firefox etc) to use ALSA.

gstreamer

If you use gstreamer:

apt-get install gnome-media gstreamer0.8-alsa
gstreamer-properties -> select alsa
test

If you get hashed output, try selecting Custom with the following pipeline:

alsasink period-size=1024 buffer-size=4096

You can also directly test with:

gst-launch-0.8 filesrc location=/path/to/file.mp3 ! mad ! alsasink period-size=1024 buffer-size=4096

Psi

options -> sound -> player: aplay (instead of play)

aRts

kcontrol -> Sound -> Sound system -> Hardware -> use ALSA

MIDI

Note that intel8x0 doesn not have any midi support as most of the modern sound cards.

aplaymidi -l
  • error -> that's because the kernel module is not loaded
  • Midi Through Port-0 -> that's just passthrough, not usable

Use timidity instead:

  • apt-get install timidity freepats
  • play a midi file with timidity or launch timidity as midi plugin for ALSA:
timidity -iA
aplaymidi -p 128 file.mid

Todo

  • When launched by KDE, artsd gets the right parameters: /usr/bin/artsd -F 10 -S 4096 -a alsa -d -r 48000 -s 5 -m artsmessag


But where are they defined?

  • Get skype working with alsa