# alsa sound mixing aka dmix (not arts or esd needed)

## Redeeman

note: i have only tested this on my cmedia 8738 and Analog Devices AD1980

first you need to make sure you have alsa working with your card.

then you will want to emerge the alsa-oss package that fits for your alsa version (you can eventually use dmesg to see the version) but your alsa-lib and alsa-utils (if using 2.4) alsa-driver package should be of same version, and then you can just do:

```
qpkg -I -v |redeeman@redeeman: ~$ qpkg -I -v | grep alsa

media-libs/alsa-lib-1.0.0_rc2 *

media-sound/alsa-utils-1.0.0_rc2 *
```

though, this requires you have gentoolkit installed.

so now i would want to do:

```
redeeman@redeeman: ~$ su

Password:

root@redeeman: /home/redeeman$ emerge /usr/portage/media-libs/alsa-oss/alsa-oss-1.0.0_rc2.ebuild

```

so it becomes:

```
redeeman@redeeman: ~$ qpkg -I -v | grep alsa

media-libs/alsa-oss-1.0.0-rc2 *

media-libs/alsa-lib-1.0.0_rc2 *

media-sound/alsa-utils-1.0.0_rc2 *
```

now you might want to know, what do the alsa-oss do?! simple, it tricks applications thats using oss to be using alsa, so out dmix is working  :Wink:  (though its recommended to use native alsa if possible)

now we are ready to create ~/.asoundrc, to enable the dmix plugin, and wrap dsp0 and default pcm interface over to our dmixer pcm device, my ~/.asoundrc looks like this:

```
pcm.dmixer {

    type dmix

    ipc_key 1024

    slave {

        pcm "hw:0,0"

        period_time 0

        period_size 1024

        buffer_size 8192

 rate 44100

    }

    bindings {

        0 0

        1 1

    }

}

pcm.dsp0 {

    type plug

    slave.pcm "dmixer"

}

pcm.!default {

        type plug

        slave.pcm "dmixer"

}

pcm.default {

 type plug

 slave.pcm "dmixer"

}

ctl.mixer0 {

    type hw

    card 0

}
```

i have seen this working taken directly in many cases, though it might not work on all cards..  :Sad: 

be sure to specify the device to default in the alsa applications.

to run your applications thats using oss, do like this:

aoss <applicationname>

and it should work.

Application specific stuff:

xmms:

you can emerge media-plugins/alsa-xmms to get native alsa support in xmms, and then you just adjust it to use default pcm device, and you are set!

mplayer:

if you enable alsa at compile time(done via USE variables) you can edit /etc/mplayer.conf in the line where you see ao=oss to:

```
ao=alsa9:default
```

or simply start mplayer like this:

```
mplayer -ao alsa9:default movie.avi
```

Test if it works

now start mplayer on a movie, and start xmms with a file, and try some application that uses oss. and see if it works! and then enjoy!

Questions

in mplayer, you use alsa9:default????

yes. i know it, but thats how it is!

----------

## hanzotutu

I follow the instruction. However, it still doesn't work.

my card is intel AC97.

root@scimd movies # more /etc/mplayer.conf 

##

## MPlayer config file

##

## This file can be copied to /usr/local/etc/mplayer.conf and/or ~/.mplayer/conf

ig .

## If both exist, the ~/.mplayer/config's settings override the

## /usr/local/etc/mplayer.conf ones. And, of course command line overrides all.

## The options are the same as in the command line, but they can be specified

## more flexibly here. See below.

##

# vo=xv                 # To specify default video driver (see -vo help for

                        # list)

ao=alsa9:default        # To specify default audio driver (see -ao help for

                        # list)

....

hanzo@scimd movies $ mplayer movie.avi

...

Checking audio filter chain for 48000Hz/2ch/16bit -> 48000Hz/2ch/16bit...

AF_pre: af format: 2 bps, 2 ch, 48000 hz, little endian signed int 

AF_pre: 48000Hz 2ch Signed 16-bit (Little-Endian)

alsa-init: requested format: 48000 Hz, 2 channels, Signed 16-bit (Little-Endian)

alsa-init: soundcard set to default

alsa-init: unable to set periodsize: Invalid argument

Could not open/initialize audio device -> no sound.

Audio: no sound

Starting playback...

...

root@scimd movies # qpkg -I -v | grep alsa

media-libs/alsa-lib-1.0.0_rc2 *

media-libs/alsa-oss-1.0.0_rc2 *

media-sound/alsa-utils-1.0.0_rc2 *

media-plugins/alsa-xmms-0.9.12 *

root@scimd movies #

----------

## Ian

I followed everything, but I don't think it's working because I'm missing /etc/asound.state.

I'm not a big media buff (on linux at least), and I'm just using alsa-oss emulation through the 2.6 kernel, and it works.  But I have the same sound card (CMedia 8738), so I figured why not try this.

Can you go through all the steps of actually setting up alsa, or point to a good place that has instructions, because I never found one that worked for me or I was able to understand   :Embarassed: .

Oh well, you learn something new everyday...

----------

## Redeeman

 *hanzotutu wrote:*   

> I follow the instruction. However, it still doesn't work.
> 
> my card is intel AC97.
> 
> root@scimd movies # more /etc/mplayer.conf 
> ...

 

try open xmms, and goto preferences, and then change output plugin to alsa, and try play something, if it works there its your mplayer that didnt get compiled with alsa support. let me know if it doesent work

----------

## Redeeman

Setting up alsa.

first you need to make sure what kernel you have, just for good orders sake  :Very Happy: , do like this:

```
redeeman@redeeman: ~$ uname -r

2.6.1-rc1-love3

```

good, i have a 2.6 kernel, then alsa is included in the kernel (and i have the love-sources patch which includes newest snapshot)

we need to enable module loading to load the alsa modules. to do this we will cd into /usr/src/linux, as linux is a symlink to the current kernel, we will also check that its correct

(yes, i know my symlink points to 2.6.0 source, but i only have that)

```
redeeman@redeeman: ~$ su

Password:

root@redeeman: /home/redeeman$ cd /usr/src/

root@redeeman: /usr/src$ ls -l linux

lrwxr-xr-x    1 root     root           20 Jan  2 19:16 linux -> /usr/src/linux-2.6.0

root@redeeman: /usr/src$ cd linux

root@redeeman: /usr/src/linux$ make menuconfig

```

now see that linux points to the linux kernel dir, then its fine, if you by some reason dont have the link, do like this:

```
ln -s <kernel-source-dir> linux

```

and now we have got the link, and we are able to cd into it.

then you enable module loading, and then we need to enable only sound support, not any specific drivers.

when that is done you build the kernel and install.

then we need to install the alsa driver, which is alsa-driver in portage, just take the lastest stable release, i only have the unstable to test.

latest unmasked is right now 0.9.8, and i know that release works, as i have tested in that one, so now we will check which alsa packages we have got, and then uninstall, and install the ones we need again.

```
redeeman@redeeman: ~$ su

Password:

root@redeeman: /home/redeeman$ qpkg -I -v | grep alsa

media-libs/alsa-oss-1.0.0_rc2 *

media-libs/alsa-lib-1.0.0_rc2 *

media-sound/alsa-utils-1.0.0_rc2 *

media-plugins/alsa-xmms-0.9.12 *

root@redeeman: /home/redeeman$ emerge --unmerge alsa-oss alsa-lib alsa-utils alsa-xmms -p

 

>>> These are the packages that I would unmerge:

 

 media-sound/alsa-utils

    selected: 1.0.0_rc2

   protected: none

     omitted: none

 

 media-libs/alsa-oss

    selected: 0.9.8

   protected: none

     omitted: none

 

 media-plugins/alsa-xmms

    selected: 0.9.12

   protected: none

     omitted: none

 

 media-libs/alsa-lib

    selected: 1.0.0_rc2

   protected: none

     omitted: none

 

>>> 'Selected' packages are slated for removal.

>>> 'Protected' and 'omitted' packages will not be removed.

 

root@redeeman: /home/redeeman$ emerge alsa-lib alsa-driver alsa-oss alsa-utils -p

 

These are the packages that I would merge, in order:

 

Calculating dependencies ...done!

[ebuild   R   ] media-libs/alsa-lib-1.0.0_rc2

[ebuild N     ] media-sound/alsa-driver-1.0.0_rc2

[ebuild   R   ] media-libs/alsa-oss-1.0.0_rc2

[ebuild   R   ] media-sound/alsa-utils-1.0.0_rc2

root@redeeman: /home/redeeman$ etc-update

Scanning Configuration files...

Exiting: Nothing left to do; exiting. :)

root@redeeman: /home/redeeman$

```

yes, i know alsa-driver is now, but that is because i have drivers built in, and dont need it. we will come to that.

and no, i didnt have any config files to update, but you probably will, (i just did a -p because i already have installed).

now its time to edit /etc/modules.d/alsa, what we need to do, is uncomment some lines, and then change to our card!

```
# Alsa 0.9.X kernel modules' configuration file.

# $Header: /home/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsa-modules.conf-rc,v 1.1 2003/08/05 21:07:55 johnm Exp $

# ALSA portion

alias char-major-116 snd

# OSS/Free portion

alias char-major-14 soundcore

##

## IMPORTANT:

## You need to customise this section for your specific sound card(s)

## and then run `update-modules' command.

## Read alsa-driver's INSTALL file in /usr/share/doc for more info.

##

##  ALSA portion

alias snd-card-0 snd-cmipci

## alias snd-card-1 snd-ens1371

##  OSS/Free portion

alias sound-slot-0 snd-card-0

## alias sound-slot-1 snd-card-1

##

# OSS/Free portion - card #1

alias sound-service-0-0 snd-mixer-oss

alias sound-service-0-1 snd-seq-oss

alias sound-service-0-3 snd-pcm-oss

alias sound-service-0-8 snd-seq-oss

alias sound-service-0-12 snd-pcm-oss

##  OSS/Free portion - card #2

## alias sound-service-1-0 snd-mixer-oss

## alias sound-service-1-3 snd-pcm-oss

## alias sound-service-1-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss

alias /dev/dsp snd-pcm-oss

alias /dev/midi snd-seq-oss

# Set this to the correct number of cards.

options snd cards_limit=1
```

here i already have my stuff uncommented, so what you basically have to do, is uncomment following lines:

```
alias char-major-116 snd

alias char-major-14 soundcore

alias sound-slot-0 snd-card-0

alias sound-service-0-0 snd-mixer-oss

alias sound-service-0-1 snd-seq-oss

alias sound-service-0-3 snd-pcm-oss

alias sound-service-0-8 snd-seq-oss

alias sound-service-0-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss

alias /dev/dsp snd-pcm-oss

alias /dev/midi snd-seq-oss

options snd cards_limit=1

```

and then you need to edit this line:

```
alias snd-card-0 snd-cmipci

```

to:

```
snd-<whatever_your_card_driver_is>

```

my card is a cmedia 8738. and uses the driver snd-cmipci.

then we update modules, and stuff.

```
root@redeeman: /home/redeeman$ update-modules

```

and then we add alsasound to the default runlevel, and start it now

```
root@redeeman: /home/redeeman$ update-modules

root@redeeman: /home/redeeman$ /etc/init.d/alsasound start

 * ALSA Detected...

 * Restoring Mixer Levels                     [ ok ]

```

now we use the tool alsamixer to unmute our device, simply start alsamixer and unmute your master and/or pcm.

and now we are done, and are ready to follow my steps to get a working dmix plugin (software mixing)

Setting up for 2.6

if you are using 2.6.0, you probably have a little more experience.

then just enable alsa in kernel. with your needed drivers, and remember to install version 0.9.7 of the alsa tools, driver and lib. 2.6.0 includes that release  :Smile: 

and then there shouldnt be anything more, just follow the other generic steps for 2.5.

FAQ

you made a spelling mistake???

      probably thousands. pm me and i will correct![/code]

----------

## MooktaKiNG

Sorry but i don't really understand what this howto is about.

Is dmixer similar to artsd or esound?

Please explain.

I usually use artsd, but there are a lot of disadvantages with artsd.

----------

## Redeeman

no, this is so you DONT need a sound server  :Very Happy:  the sound system in the kernel with do the mixing, so you can use all applications without them having to have support for arts or esd  :Smile: 

----------

## MooktaKiNG

so i can use alsaplay soundfile.mp3

and it would play?

Then its fantastic. 

Is there any performance gain from using artsd?

I'm sure there is, if its inside the kernel right?

How comes i haven't heard of this before?

is it a recent adition?

----------

## |darc|

Okay, I'm not sure if I entirely understand this correctly.

I'm using kernel 2.6.1-gentoo. My sound works fine individually for each app, but, of course, my problem is I can't play two sounds at once. 

I have alsa-lib, alsa-util, alsamixergui, and alsa-xmms installed. I created the ~/.asoundrc file and pasted what you have in the Code box into the file, saved it, and tried to play two sounds at once. It did not work. I don't know if I had to restart stuff or anything, so I rebooted my computer and tried once again to play two things at once. However, it is still not working. I think I'm missing something (it seemed a bit easy to me  :Razz:  ). I would appreciate it if you could walk me through this a bit.

----------

## Redeeman

i dont think there is any direct performance gain, but ofcourse, you wont be running artsd or esd, BUT.

not all applications supports esd or arts, and then it wont work at all. with this dmix plugin from alsa, alsa itself will mix the sounds, and you can play as many as you want the same time.

|darc|:

now you need to emerge alsa-oss too, in the correct version number for the rest of alsa, and then you change output from oss driver to alsa driver in xmms. and type in to use default device.

then if the app more you will run uses oss, run it with aoos, like this:

```
aoss <someapp>
```

and it will work.

if it doesent, type here again, and i will try to help

----------

## |darc|

The problem isn't with OSS, though, it's with the ALSA mixing itself. GAIM, with sounds set to "Command" and the command being "aplay -Dplug:dmix %s," XMMS using the ALSA output plugin, and totem ran with "aoss totem" still do not want to be mixed with each other. Totem, which outputs OSS, still worked without your above suggestion and without running it with "aoss" in front of it, but I still did what you suggested and, unfortunately, it's still not working. Each program still plays by itself perfectly.

EDIT: Nevermind, I got it working. I did not realize I had to specify "dmixer" in the XMMS ALSA configuration. GAIM is playing sound, totem is playing Half-Baked, and XMMS is playing Thurday - Jet Black New Year. Thanks for all your help, and this tutorial.  :Smile: 

----------

## Redeeman

actually, if you use my .asoundrc, it shouldnt be needed with dmixer, but default works too, so default configuration on alsa applications are working  :Smile: 

but im glad it works for you!  :Smile: 

----------

## enrique

Please note, that some programs have a faulty alsa implementation, so the do not work probaly with dmixer.

I can only say that Redeeman .asound works fine for me, with xmms, gaim, ogg123 and mplayer (mplayer sometimes hangs with dmix)

Att: Redeeman: hvor har du dog fået den dejlige .asound fra  :Wink: 

----------

## Redeeman

enrique:  :Very Happy:  hehe well, you didnt write a guide, so i had to take action!  :Smile: 

----------

## dna42

just in case anyone is interested...

in order to make this work with SDL apps (assuming you compiled your libsdl with alsa support) you just have to set two environment variables. i.e.

```
export SDL_AUDIODRIVER=alsa AUDIODEV=default
```

----------

## pharaoh

dna42: sorry I'm a newb...where do these variables get set at?  Somewhere in the app/game that uses SDL or in the alsa file itself?

----------

## discomfitor

people with mplayer problems: https://forums.gentoo.org/viewtopic.php?t=124976

Ironically, I made that before I saw this.  Been meaning to post it for a while.

----------

## arkanlor

I'm a little bit confused now. =) after this howto =)

I have kernel 2.6.1 and I included all alsa stuff into my kernel including the drivers for my soundcards.

alsa is working, playing sound, but only one program a time.

because the howtos are so mixed up, maybe you could write one extra just for 2.6.x because I have no idea now how to continue. and I dont want to mess it up!

----------

## pharaoh

I am in the same situation.  Using kernel-2.6.1-rc1, only one sound at a time  =\   Under Redhat this worked automagically, is maybe somewhere on that box I could search for clues?

----------

## discomfitor

I use 2.6, and everything is the same, but you don't have to compile alsa-drivers since it's in the kernel.

----------

## Niek

Thanks to this topic and https://forums.gentoo.org/viewtopic.php?t=124976 I finally got everything working.

It's possible to run MPlayer (-ao alsa9:default), XMMS (alsa-xmms plugin, audio device set to "default"), aplay (native alsa support) and HelixPlayer (OSS output, running with aoss ./hxplay) at the same time  :Smile: 

Too bad the LD_PRELOAD trick of aoss is not working in all cases, e.g. I can't play Quake3 while another app is using the soundcard (other simple apps like wavplay also fails).

But in general, I'm very happy with this  :Smile:  BTW, here is my stripped down /etc/asound.conf (better place it system-wide instead of per-user). I removed the needless settings the original post had:

```
pcm.mixer {

  type dmix

  ipc_key 1024

  slave {

    pcm "hw:0,0"

    period_time 0

    period_size 1024

    buffer_size 8192

    rate 44100

  }

}

pcm.!default {

  type plug

  slave.pcm "mixer"

}
```

----------

## SubAtomic

 *Ian wrote:*   

> I followed everything, but I don't think it's working because I'm missing /etc/asound.state.

 You don't necessarily need /etc/asound.state to enable dmix for alsa.

When you first execute /etc/init.d/alsasound restart your /etc/asound.state should be created automatically.Last edited by SubAtomic on Sun Jan 18, 2004 8:57 am; edited 2 times in total

----------

## dna42

 *pharaoh wrote:*   

> dna42: sorry I'm a newb...where do these variables get set at?  Somewhere in the app/game that uses SDL or in the alsa file itself?

 

in neither of those locations.

these are environment variables, which are local to a shell, so, if you issue the above-mentioned command in a shell and start your sdl app from this very shell, it should inherit the variables and thus use alsa.

----------

## DOG-mike

Bumping this up to see if anyone could paste their /etc/asound.conf file.  I'm having a hard time getting this to work (properly) with anything other than xmms and mplayer.  Plus mplayer plays sound just a tick too fast.

nvidia soundstorm

----------

## pharaoh

I haven't had any luck with this either.  I don't even have an asound.conf...am I just supposed to make one??  My only goal is to get Teamspeak working while running Q3 or Neverwinter Nights.

Dell laptop with intel8x0

----------

## discomfitor

The mplayer thing is a bug in the mplayer alsa output.

----------

## Birnenpfluecker

great howto. Worked perfect for me 

Sound: Via82xx

Kernel 2.6

xmms 0.98

----------

## dippen

i works almost great... only xmms crashes sometimes when i move a playing mplayer window

thx!

i use alsa-lib / alsa-utils in ver. 9.8, alsa-xmms 0.9.12 and mplayer 1.0_pre3

with kernel-2.6.1-rc1-mm2 and nforce2 onboard sound

----------

## Birnenpfluecker

Seems it doesn't work perfectly. after some time xmms crashes. I have to kill the process to shut it down. After that if I restart xmms, it just crashs at the first or second song played. Short before it crashs the sounds gets messy, af if my mp3s are broken or something...

----------

## gspr

Wow! This is great! But exactly what settings should the XMMS ALSA output plugin be set to? I don't have it working yet (but I am able to live with using aoss and the OSS output plugin).

Thanks!

----------

## Niek

 *gspr wrote:*   

> Wow! This is great! But exactly what settings should the XMMS ALSA output plugin be set to? I don't have it working yet (but I am able to live with using aoss and the OSS output plugin).
> 
> Thanks!

 From my ~/.xmms/config:

```
[xmms]

output_plugin=/usr/lib/xmms/Output/libALSA.so

[ALSA]

audio_card=0

audio_device=1

buffer_time=500

period_time=50

use_user_device=TRUE

mmap=TRUE

user_device=default

mixer_card=0

mixer_device=PCM

pcm_device=default

soft_volume=FALSE

volume_left=100

volume_right=100
```

----------

## gspr

Thank you ever so much! That solved it!

----------

## herring

 *Redeeman wrote:*   

> 
> 
> mplayer:
> 
> if you enable alsa at compile time(done via USE variables) you can edit /etc/mplayer.conf in the line where you see ao=oss to:
> ...

 

mplayer -ao alsa9:default movie.avi

----------

## herring

I use gmplayer (mplayer's GUI). Remember gtk useflag

Had to edit ~/.mplayer/gui.conf by hand to add :default

```
ao_driver = "alsa9:default"
```

----------

## jcc

but isnt mplayer using 'default' by default?

----------

## jingo

I am not sure I got this right at all!!!

I have the gentoo-dev-sources 2.6.1 kernel, alsa-drivers and alsa-oss builtin.

And still I have to emerge alsa-drivers, alsa-oss, alsa-utils, alsa-tools, alsa-lib???

I did emerge alsa-oss for aoss, alsa-utils for /etc/modules.d/<alias>-thing among other things and alsa-lib because of some dependency.

I created the /etc/asound.conf from Niek.

alsa-xmms plays sound without any problem, but still every other program need to wait for xmms to release /dev/dsp.

aoss gives me: /usr/bin/aoss: line 9: 28984 Segmentation fault      LD_PRELOAD=${exec_prefix}/lib/libaoss.so $*   ... 

???? dont get it!

Did I miss anything?

----------

## mholtz

Just wanted to let everyone know it worked for me.

2.4.22-gentoo-r5

alsa 1.0.2

alsa-lib 1.0.2

alsa-utils 1.0.9

XMMS, KDE (use external player aplay), and gaim all share sounds now.  Just hope other apps play nice also.

----------

## MikeP

it works with mplayer and xmms here, but how could i get it to work with xine? it can play sounds when ather apps do, but now with the asound.conf in place all the sound is of very bad quality (the sound from xine that is, mplayer and xmms play nice) - it doesnt matter if any other apps are playing or not.. weird :/

*edit* err it doesnt even fully work with mplayer, when i play a dvb stream i dont have sound now...sigh...*edit*

----------

## mholtz

And what about apps like snes9x which demand exclusive use of /dev/dsp?  Is there any way to make them play nice and use the ALSA mixer?

----------

## bushwakko

alsa-init: requested format: 44100 Hz, 2 channels, Signed 16-bit (Little-Endian)

alsa-init: 1 soundcard found, using: hw:0,0

why oh why does it want to use hw:0,0 and not default?!

the xmms alsa-plugin is nasty too, however using oss and aoss works.

----------

## charlieg

After doing all this, do the alsa init scripts complain loudly about /etc/asound.conf for anybody else?

----------

## lunarg

Okay, I got dmix to work with my intel8x0, although not that perfectly though. I still don't get any sound with games like UT or RTCW, nor do I have sound under KDE (with ARTS disabled).

Guess I'll wait this one out.....

----------

## kf_man

I have Ensoniq 1371 audio on my gateway computer. I used the asound.conf from Niek, but I get errors when restarting alsasound.

Here is my /etc/asound.conf:

```
pcm.mixer {

   type dmix

   ipc_key 1024

   slave {

     pcm "hw:0,0"

     period_time 0

     period_size 1024

     buffer_size 8192

     rate 44100

   }

 }

 pcm.!default {

   type plug

   slave.pcm "mixer"

 }
```

Here is the error I get:

```
bash-2.05b# mv /etc/asound.conf.old /etc/asound.conf

bash-2.05b# nano -w /etc/asound.conf

bash-2.05b# /etc/init.d/alsasound restart

 * WARNING:  you are stopping a boot service.

 * Unloading ALSA...

ALSA lib conf.c:1565:(snd_config_load1) _toplevel_:5:2:Unexpected char

ALSA lib conf.c:2803:(snd_config_hook_load) /etc/asound.conf may be old or corrupted: consider to remove or fix it

ALSA lib conf.c:2667:(snd_config_hooks_call) function snd_config_hook_load returned error: Unknown error

ALSA lib conf.c:3032:(snd_config_update_r) hooks failed, removing configuration

can't open sequencer

 * Storing ALSA Mixer Levels

ALSA lib conf.c:1565:(snd_config_load1) _toplevel_:5:2:Unexpected char

ALSA lib conf.c:2803:(snd_config_hook_load) /etc/asound.conf may be old or corrupted: consider to remove or fix it

ALSA lib conf.c:2667:(snd_config_hooks_call) function snd_config_hook_load returned error: Unknown error

ALSA lib conf.c:3032:(snd_config_update_r) hooks failed, removing configuration

/usr/sbin/alsactl: get_controls:485: snd_ctl_open error: Unknown error

 * Unloading modules                                                      [ ok ]

 * Loading ALSA drivers...

 * Using ALSA OSS emulation

 * Loading: snd-seq-oss

 * Loading: snd-pcm-oss

 * Running card-dependent scripts

 * Restoring Mixer Levels

ALSA lib conf.c:1565:(snd_config_load1) _toplevel_:5:2:Unexpected char

ALSA lib conf.c:2803:(snd_config_hook_load) /etc/asound.conf may be old or corrupted: consider to remove or fix it

ALSA lib conf.c:2667:(snd_config_hooks_call) function snd_config_hook_load returned error: Unknown error

ALSA lib conf.c:3032:(snd_config_update_r) hooks failed, removing configuration

/usr/sbin/alsactl: set_controls:986: snd_ctl_open error: Unknown error    [ ok ]
```

Here are the versions of my alsa:

```
bash-2.05b# qpkg -I -v | grep alsa

media-libs/alsa-lib-0.9.8 *

media-libs/alsa-oss-0.9.8 *

media-sound/alsa-utils-0.9.8 *

media-sound/alsa-driver-0.9.8 *
```

Here is my kernel version:

```
bash-2.05b# uname -r

2.4.22-gentoo-r7
```

What did I do wrong?

----------

## Niek

 *kf_man wrote:*   

> I have Ensoniq 1371 audio on my gateway computer. I used the asound.conf from Niek, but I get errors when restarting alsasound.
> 
> (...)
> 
> What did I do wrong?

 The indentation of your /etc/asound.conf is wrong. You have to remove leading spaces, because something got wrong while copy/pasting the code.

I've uploaded my asound.conf file to http://www.sourcecode.no/pastebin/en/index.php?page=show&id=7923&key=a4zjojmkif

You can copy it from the code block and paste it in an editor, in this way it should work.

----------

## charlieg

Y'all look like you have a complex setup.  All I had to do was:

```
charlie@mightymax charlie $ cat /etc/asound.conf

pcm.!default {

    type plug

    slave.pcm "dmix:CARD=0,DEVICE=0,RATE=44100"

}
```

----------

## kf_man

 *Niek wrote:*   

>  *kf_man wrote:*   I have Ensoniq 1371 audio on my gateway computer. I used the asound.conf from Niek, but I get errors when restarting alsasound.
> 
> (...)
> 
> What did I do wrong? The indentation of your /etc/asound.conf is wrong. You have to remove leading spaces, because something got wrong while copy/pasting the code.
> ...

 

Not to get off topic, but what editor do you use?  Up until now I have been using nano, but that could be the cause of my spacing issues.  I am currently running KDE 3.1.3 on the latest version of XFree (3.5.0-rc2, i just installed it today).  Also, how would I use an X-based editor when I am not logged in as root?  Any help would be great.  

edit:  By the way, I also upgraded to Kernel 2.6.3-mm2 as well.  I am running the built in ALSA.

----------

## kf_man

The change in code did work, but I still can't play two sounds at once...any other tips to try.  I was trying to play xmms and hear the console's sound when you move in a bad direction...  Maybe i'm just dumb?

-Kyle

----------

## kf_man

The change in code did work, but I still can't play two sounds at once...any other tips to try.  I was trying to play xmms and hear the console's sound when you move in a bad direction...  Maybe i'm just dumb?

----------

## Redeeman

sorry, i had forgot about this thread, if any problems or something, if youy need help, just type, i will remember to look at it  :Smile: 

----------

## Niek

 *kf_man wrote:*   

> (...)
> 
> Not to get off topic, but what editor do you use?  Up until now I have been using nano, but that could be the cause of my spacing issues.  I am currently running KDE 3.1.3 on the latest version of XFree (3.5.0-rc2, i just installed it today).
> 
> (...)

 I'm using Kate as my default editor. But it's not the editor's fault I think, but your browser's. There's a bug Konqueror's 3.1.x copy/paste code.

 *kf_man wrote:*   

> The change in code did work, but I still can't play two sounds at once...any other tips to try.  I was trying to play xmms and hear the console's sound when you move in a bad direction...  Maybe i'm just dumb?
> 
> -Kyle

 Are you sure you configured the XMMS ALSA plugin properly? Try the following command to test your asound.conf file with aplay:

```
for i in 1 2 3; do aplay -q $KDEDIR/share/sounds/KDE_Startup.wav& sleep 2; done
```

If this plays multiple sound at the same time, your asound.conf file is OK but your XMMS config is wrong. Else, try another asound.conf file, eg the one from charlieg.

----------

## charlieg

Hmm, my 'short' config was causing alsa to barf for a couple of games.

Now I've reset it to something more normal, but get this:

```
charlie@mightymax charlie $ solarwolf

python: pcm_rate.c:512: snd_pcm_rate_init: Assertion `0' failed.

Aborted
```

My asount.conf:

```
mightymax etc # cat asound.old

pcm.mixer {

  type dmix

  ipc_key 1024

  slave {

    pcm "hw:0,0"

    period_time 0

    period_size 1024

    buffer_size 8192

    rate 44100

  }

}

 

pcm.!default {

  type plug

  slave.pcm "mixer"

}
```

----------

## TheCoop

get same error, moving /etc/asound.conf and restarting alsasound init script solves it.

----------

## OldTango

I have a question about the kernel itself.  I am running the 2.6.3-gentoo-r2 kernel.  I have configured it with Alsa and my sound device (SB Audigy XGamer)  built in.  Do I need to also tell it to use OSS-Emulation as I haven't built that into the kernel.  My sound works but not well. and i haven't installed alsa-oss.  I am not quite sure what the 2.6.3 kernel needs for proper support.

Please excuse my ignorance here.  I am not just a noob on the forum but a total noob to linux.

----------

## charlieg

 *TheCoop wrote:*   

> get same error, moving /etc/asound.conf and restarting alsasound init script solves it.

 

But that's just working around the problem.

No matter, I've tracked down the reason and the fix and logged it as a bug:

https://bugs.gentoo.org/show_bug.cgi?id=43052

It's a one line patch, a missed break; statement.

----------

## Kymas

I have managed to get the dmix plugin working fine for alsa and oss apps but when I run nwn, which uses the SDL library, everything gets extreamly laggy and the game is unplayable.  I have tried using the current gentoo version of SDL and I compiled 1.2.6 specifically for nwn.  The gentoo version seemed slightly less laggy but was still unplayable.  

I am using the onboard nvidia apu for sound output; I believe I read that this is actually just software ac97 in Linux.

If anyone knows any tips to improve performance please let me know.

Thanks,

Kymas

----------

## Shapierian

With just about any cofig liek Neik's for example mplayer gives me:

```
AF_pre: af format: 2 bps, 2 ch, 44100 hz, little endian signed int

AF_pre: 44100Hz 2ch Signed 16-bit (Little-Endian)

alsa-init: requested format: 44100 Hz, 2 channels, Signed 16-bit (Little-Endian)alsa-init: soundcard set to default

alsa-init: unable to set periodsize: Invalid argument

Could not open/initialize audio device -> no sound.
```

Is there a work around for this I set xmms to use "default" and "-ao alsa9:default" for mplayer.

----------

## Niek

 *Shapierian wrote:*   

> With just about any cofig liek Neik's for example mplayer gives me:
> 
> (...)
> 
> Is there a work around for this I set xmms to use "default" and "-ao alsa9:default" for mplayer.

 There's a patch for MPlayer to solve this problem. See https://forums.gentoo.org/viewtopic.php?t=124976 and https://bugs.gentoo.org/show_bug.cgi?id=38476 how to solve this.

----------

## charlieg

 *charlieg wrote:*   

> No matter, I've tracked down the reason and the fix and logged it as a bug:
> 
> https://bugs.gentoo.org/show_bug.cgi?id=43052
> 
> It's a one line patch, a missed break; statement.

 

The fix was already incorporated in a silent re-release of alsa-1.0.2; if you're afflicted by this problem you need to 'rm /usr/portage/distfiles/alsa-lib-1.0.2.tar.gz' and re-emerge alsa-lib.  This should fix it - it worked for me.

----------

## kf_man

I can play XMMS and hear sounds done using aplay.  This works ok as I can now here Gaim sounds when I set the sound method to the command "aplay %s."  Is there anyway to make kde's sounds work while playing xmms?  Thanks.

----------

## TheCoop

the sound in xine is very crackly when I enable dmix, otherwise it works fine...

----------

## charlieg

Does this make the sound quality awful for totem for anybody else other than me?  And it also makes rhythmbox crash...

 :Crying or Very sad: 

----------

## Niek

 *kf_man wrote:*   

> I can play XMMS and hear sounds done using aplay.  This works ok as I can now here Gaim sounds when I set the sound method to the command "aplay %s."  Is there anyway to make kde's sounds work while playing xmms?  Thanks.

 Control Center -> Sound & Multimedia -> System Notifications -> Player Settings and enable "Use external player" (just use aplay as command).

----------

## Redeeman

 *TheCoop wrote:*   

> the sound in xine is very crackly when I enable dmix, otherwise it works fine...

 

yes, i notice this in pornview :/

and mplayer sometimes plays fast :/

----------

## Redeeman

 *charlieg wrote:*   

> Does this make the sound quality awful for totem for anybody else other than me?  And it also makes rhythmbox crash...
> 
> 

 

you might want to fiddle with the rate parameter, that works on some chips, for example thats needed on my via82xx

----------

## TheCoop

 *Redeeman wrote:*   

> you might want to fiddle with the rate parameter, that works on some chips, for example thats needed on my via82xx

 

Fiddle with it how?

----------

## cca93014

I have this working for XMMS, gAIM and mplayer, but I cant get Gnome sounds to play. Any ideas?

----------

## hjlane3

Working great for ALSA apps, but any oss apps that run or are run with aoss sound EXTREMELY crappy...  what's wrong?

```
pcm.mixer {

  type dmix

  ipc_key 1024

  slave {

    pcm "hw:0,0"

    period_time 0

    period_size 1024

    buffer_size 8192

    rate 44100

  }

}

                                                                                              

pcm.!default {

  type plug

  slave.pcm "mixer"

}

```

----------

## Redeeman

i mean try set rate to 48000, that works on my new via82xx.

with aoss crappy. that might have something to do with the rate too, i am not quite sure. sorry

----------

## Niek

*sigh* I upgraded to alsa-lib 1.0.3, and now my sound isn't working with the asound.conf file. Aplay doesn't play anything and MPlayer crashes. Other people with these problems after upgrading?

----------

## cca93014

How come people are getting version  1.0.3 of alsa. I just re-synced at got 0.9.8...?

----------

## Niek

 *cca93014 wrote:*   

> How come people are getting version  1.0.3 of alsa. I just re-synced at got 0.9.8...?

 I'm using the unstable packages (ACCEPT_KEYWORDS="~x86" in make.conf) instead of the stable.

----------

## hjlane3

 *Redeeman wrote:*   

> i mean try set rate to 48000, that works on my new via82xx.
> 
> with aoss crappy. that might have something to do with the rate too, i am not quite sure. sorry

 

Ok i did that with my intel8x0

mpg123 mp3 would hog the sound card, not letting anything else use it

aoss mpg123 mp3 worked great!

but rhythmbox run with or w/out it still sound horrible  :Sad: 

----------

## Shiryou

Well, lets see.... the aplayer multiple sound trick works for me so i guess thats ok. However, im wondering about everything else. The way i see it.... we've had decent enough soundcards for years now so why is such a simple thing like multiple sounds such a pain under linux. Its very poor. I imagine a lot of it is to do with the intel driver. Im using intel8x0 which i've heard is dire. My main machine uses an Nforce board and 5.1 so linux is going nowhere near it. 

So.... my question is this. I reckon i understand thi dmix stuff... but how can i get KDE to work with it? The soundsystem selector in the KDE control panel lets me choose Alsa but it doesnt seem to let me play multiple sounds. Im usign kde3.2 witht -arts and +alsa use flagss with a 2.6.2 kernel.

I wonder... if theres a kernel patch for a better intel8x0 or soemthing? Possibly,

----------

## Redeeman

 *hjlane3 wrote:*   

>  *Redeeman wrote:*   i mean try set rate to 48000, that works on my new via82xx.
> 
> with aoss crappy. that might have something to do with the rate too, i am not quite sure. sorry 
> 
> Ok i did that with my intel8x0
> ...

 

applications only supporting oss should use aoss, but native alsa applications _should_ use alsa output device with device 4100

----------

## tecknojunky

This thread confuse more than it help  :Sad: 

Anyhow, when I try to use aplay, I get this

```
ALSA lib pcm_dmix.c:812:(snd_pcm_dmix_open) unable to open slave

aplay: main:503: audio open error: No such file or directory

```

----------

## Niek

 *tecknojunky wrote:*   

> This thread confuse more than it help 
> 
> Anyhow, when I try to use aplay, I get this
> 
> ```
> ...

 What does your /etc/asound.conf look like?

----------

## hjlane3

 *Redeeman wrote:*   

>  *hjlane3 wrote:*    *Redeeman wrote:*   i mean try set rate to 48000, that works on my new via82xx.
> 
> with aoss crappy. that might have something to do with the rate too, i am not quite sure. sorry 
> 
> Ok i did that with my intel8x0
> ...

 

So rhythmbox and/or totem support alsa? But then why do they still sound bad with out running with aoss...

On another note, dmix doesn't work for me ( intel8x0 ) with alsa 1.0.3, had to down grade back to 1.0.2 :-\

-HJ

----------

## Redeeman

 *tecknojunky wrote:*   

> This thread confuse more than it help 
> 
> 

 

hows that???

----------

## Shiryou

I guess because, like me, i wasnt sure what dmix was. Is this a mixer, something to emerge, etc etc. Still i reckon i've got the hang of it now. So the deal is:

Mplayer requires a fix and need to be told to use ALSA

Xmms (i use beep but hey, same thing right) has the alsa plugin so thats cool

What about KDE and GNOME sounds? One uses esd and the other uses arts. KDE seems to fire up arts no matter what i set. I've since moved to gnome to test the supposed better multilingual support. Is it possible to pipe sounds through ALSA and thus through this mixer? Cheers

----------

## hjlane3

 *Shiryou wrote:*   

> I guess because, like me, i wasnt sure what dmix was. Is this a mixer, something to emerge, etc etc. Still i reckon i've got the hang of it now. So the deal is:
> 
> Mplayer requires a fix and need to be told to use ALSA
> 
> Xmms (i use beep but hey, same thing right) has the alsa plugin so thats cool
> ...

 

http://alsa.opensrc.org/index.php?page=DmixPlugin

Scroll down to the section "Dmix KDE(arts), ESD and SDL quick and dirty HOWTO"

I haven't tried it, but maybe it'll be some help to you.

----------

## Shiryou

Aye cheers for the help on that one. Thats a pretty useful page. Hopefully soon, i'll have proper mixing. You never know   :Very Happy: 

----------

## Redeeman

that was actually the site i learned it from.  :Very Happy: 

----------

## Benson

Thx Redeeman, works perfect. I have via82cxxx onboard sound. First i had a different .asoundrc:

```
cm.via82xx {

   type hw

   card 0

}

ctl.via82xx {

   type hw

   card 0

}

pcm.!default{

   type plug

   slave.pcm "dmix"

}
```

That worked too, but for example when sim received a message while i was listening to xmms (via alsa), i didn't heard the whole sound output, mostly only the 2nd part of this "ohoh" (stupid to explain it that way, i know  :Wink:  ). So this was kind of a quick, dirty hack, yours is just perfect! thx again!

----------

## Redeeman

no problem!

----------

## Bash[DevNull]

All work perfectly! But sometimes (usually when CPU is havy load) xmms starting playing crackly or stop playing (but indicaty it like playing). How to FiX it ? Any suggestions?

----------

## hjlane3

I had this working OK on my intel8x0 with 2.6.4 kernel, alsa-utils,-oss, and -lib 0.9.8, but i just upgraded them to 1.0.3 and dmix doesn't work at all.  Any suggestions?

----------

## Redeeman

the userspace stuff should be the same version as the kernel version, try grep on dmesg, and see if its the same version.

----------

## elcman

Thanks for the help!

Within the first 4 posts, I had my stuff set up with only minor difficulty and problems. I am, however, getting as has been mentioned, crackling and popping. Mozilla plays only a portion of short sounds, and Gaim will give me a harsher, more screechy sound when sending and receiving IMs.

Any is this buffering? Or is it just being mishandled?

----------

## Redeeman

i believe this is because of the rate you are using, try set the rate to 44800, as i have.

my pcm.dmixer:

```
pcm.dmixer {

    type dmix

    ipc_key 1024

    slave {

        pcm "hw:0,1"

        period_time 0

        period_size 1024

        buffer_size 8192

        rate 44800

    }

    bindings {

        0 0

        1 1

    }

}

```

----------

## hjlane3

 *Redeeman wrote:*   

> the userspace stuff should be the same version as the kernel version, try grep on dmesg, and see if its the same version.

 

Yea, that's what I thought. dmesg doesn't have alsa info, and i can't reboot atm to find out. But i'm using 2.6.4 kernel so i assume it's the latest (1.0.3)

 :Confused: 

-HJ

----------

## Bash[DevNull]

 *Redeeman wrote:*   

> i believe this is because of the rate you are using, try set the rate to 44800, as i have.
> 
> 

 

Why exactly 44800?

----------

## Redeeman

because this is what works best for me, and this doesent cut off quality

----------

## Bash[DevNull]

 *Redeeman wrote:*   

> because this is what works best for me, and this doesent cut off quality

 

only for you??

i tries to understand why 44800 and only...

Hm.. biggest part of my media in 44100 Hz

----------

## Parpin

moved my post to https://forums.gentoo.org/viewtopic.php?p=957875#957875Last edited by Parpin on Mon Mar 15, 2004 10:09 pm; edited 1 time in total

----------

## charlieg

```
        period_size 1024

        buffer_size 8192
```

I've found the best combination, by far, to be:

```
        period_size 1024

        buffer_size 4096
```

If I use anything else I get awful sound with totem and noticably deformaties in the sound of other applications.

----------

## Redeeman

 *Bash[DevNull] wrote:*   

>  *Redeeman wrote:*   because this is what works best for me, and this doesent cut off quality 
> 
> only for you??
> 
> i tries to understand why 44800 and only...
> ...

 

yes, but i guess you will never get stuff higher than 44800, and as 44800 supports 44100...  :Smile: 

----------

## psyqil

 *Redeeman wrote:*   

> yes, but i guess you will never get stuff higher than 44800

 48000 would make sense, as it is used by movies and would get resampled to that frequency anyway on some cheap cards, but 44800...where did you get that number?

----------

## Redeeman

i didnt exactly get it, i just figured out that would be the highest number that would be used, and so i typed in, and it solved the problem i had  :Smile: 

----------

## psyqil

 *Redeeman wrote:*   

> i just figured out that would be the highest number that would be used

  :Very Happy:  Cool! But now you have to tell me how you figured that out...please! There was a similar funny thing on the german forum today: "I know emerge -f doesn't mean 'force', but will it reinstall gnome?"   :Shocked:   :Razz: 

----------

## MooktaKiNG

is it possible to use arts on top of dmix? my understanding is that you don't need a plugin for each software that wants to use sound, as long as it supports alsa, right? so there arts should, in theory, work on top of dmix?

I was thinking this becuase at the moment i use arts, i don't mind. Its alright. But not all software support arts, so i was thinking, i might be able to use arts and use dmix at the same time, allwing me to listen to buffered music  :Very Happy: 

----------

## Redeeman

@psygil:

i just didnt know of anything using higher.. cant really explain more  :Wink: 

@mooktaking:

yes, you can use arts on top of dmix, just make aarts use alsa, and you will still be able to use regular non-arts programs when arts are running.

but. your thought was wrong, software didnt have to specific support this, just it uses oss or alsa, it will work

----------

## MooktaKiNG

 *Redeeman wrote:*   

> @psygil:
> 
> i just didnt know of anything using higher.. cant really explain more 
> 
> @mooktaking:
> ...

 

Thats great. i'll try it out, as soon as possible  :Very Happy:  :Very Happy: 

THNX  :Very Happy: 

----------

## Imek

This works for me, to a point.. I used Redeeman's original config and I can play two instances of XMMS at the same time, and I can also use aplay file.wav when XMMS is playing. However, what I want is to play ut2004 and NWN (both SDL apps if I'm not mistaken) but they just don't work like normal. ut2004 says /dev/dsp is busy if I run it without aoss, if I try with aoss it claims /dev/dsp doesn't exist. nwn just says nothing, I just get no sound. This is all with XMMS playing in the background.. And yes, I have the export SDL_AUDIODRIVER=alsa AUDIODEV=default in my .bashrc. Also, I want to run a Wine program (coincidentally, it uses SDL but there is no Linux port for it yet, I'm not sure how Wine works with SDL like this) and I get a segfault if I use aoss, and without aoss I get 

err:wave:OSS_WaveOutInit OpenDevice failed (1)

wine: Unhandled exception, starting debugger...

etc

This is all quite frustrating. Any ideas?

Thanks.

PS my card is a bog standard onboard AC'97 dealie

----------

## Redeeman

are you sure that you have oss emulation in the kernel?

----------

## Niek

 *Imek wrote:*   

> (...)
> 
> However, what I want is to play ut2004 and NWN (both SDL apps if I'm not mistaken) but they just don't work like normal. ut2004 says /dev/dsp is busy if I run it without aoss, if I try with aoss it claims /dev/dsp doesn't exist. nwn just says nothing, I just get no sound.
> 
> (...)

 UT2004 is not a SDL app, I don't know about NWN. Because UT2004 (and other UT-engine based games) use OpenAL, you need to set this in your ~/.openalrc:

```
(define devices '(alsa native))
```

----------

## Redeeman

ut2k4 certainly uses SDL, however not for sound  :Wink: 

----------

## tecknojunky

Listening only to my guts, today i unmerged esound  :Very Happy: .  Regardless of this thread's title, esd is still needed for some apps to wack the speakers (unless I missed something).  Other than that, dmix works.  Sensible to cpu usage tough.

Anyone figured out how to have individual volume controls?

Added:

I take it back.  I had to reinstall esound.  Many apps where making use of libesd.so (name may be wrong).  Further, now the sound is again jumpy.  So I have two chained mixing layers, if I understand correctly.

Please.  Give me a REAL desktop, one that works.  It's not my ambition in life to figure out how a desktop works under the hood!  :Mad: 

----------

## gabor

>I had to reinstall esound. Many apps where making use of libesd.so

you could try to reemerge those apps (and remove "esd" from your use-flags (or add "-esd" to your use flags)

----------

## tecknojunky

 *gabor wrote:*   

> >I had to reinstall esound. Many apps where making use of libesd.so
> 
> you could try to reemerge those apps (and remove "esd" from your use-flags (or add "-esd" to your use flags)

 Which brings me to my next question:  How do you identify those apps?

For example, much to my suprise, d4x (dowloader for X) use that libray.  So does gdm.  Probably Gnome too.

Might as well recompile the whole system.  Remember, i don't use Windows anymore and this my main system.  I guess you know how long and dangerous this could be.  That's why I'm complaining for simplicity on desktops.  :Sad: 

----------

## gabor

i usually do this in the following way:

1. i identify the .so files in /usr/lib, which are linked to the given (already removed, like esd) .so files

2. i identify the packages, to which the .so files belong ( "epm -qf /usr/lib/libmy.so")

3. i reemerge them

step 1 can be done like this:

a. 'ldd', lists the dependencies for a given file ('ldd my.so')

b. i do it for all the files in /usr/lib 

("for file in * ; do echo $file; ldd $file; done >~/log.txt") (i do this in /usr/lib

c. i go through log.txt and search for "not found" 

 :Smile: 

----------

## tecknojunky

Yeah, I thought it would have to be the hard way.  Something like that should be taken cared of by Portage.  In fact, this is what many of the Debian sect members at the University reproach to Gentoo.

I don't have time for this.  I will finish the job in a couple of months.  Thanks for the answer tough.

----------

## charlieg

 *gabor wrote:*   

> c. i go through log.txt and search for "not found"

 

grep "not found" log.txt

----------

## semiSfear

Well it works. But I am very dissapointed at alsa-xmms. I can play music thru xmms and watch at several movies at once and hear all sound sources, but xmms sound quality is bad. The sound in xmms get choppy, like you hear short "ticks" every half second. Tick tick tick chop tick tick chop chop ...

Really annoying, so far I'v solved it with using OSS in xmms and start xmms with "aoss xmms". Performance is good, can't say it's a bigger difference when I was using esd. Still it feels nice not to use a sound daemon which takes up CPU cycles and memory, no?   :Wink: 

But if anyone got any good suggestons on improving the sound quality in xmms then please share with the public.

My specs:

gentoo-dev-sources 2.6.3-r1

media-libs/alsa-lib-0.9.8 

media-libs/alsa-oss-0.9.8 

media-sound/alsa-utils-0.9.8 

media-plugins/alsa-xmms-0.9.12 

~/.asoundrc:

```

pcm.mixer { 

    type dmix 

    ipc_key 1024 

    slave { 

      pcm "hw:0,0" 

      period_time 0 

      period_size 1024 

      buffer_size 8192 

      rate 44100 

    } 

  } 

 

  pcm.!default { 

    type plug 

    slave.pcm "mixer" 

  }
```

----------

## synic

Hi,

Here's my /etc/asound.conf:

```

pcm.cs46xx {

   type hw

   card 0

}

ctl.cs46xx {

   type hw

   card 0

}

                                                                                

pcm.mixer {

  type dmix

  ipc_key 1024

  slave {

    pcm "hw:0,0"

    period_time 0

    period_size 1024

    buffer_size 8192

    rate 44100

  }

}

                                                                                

pcm.!default {

  type plug

  slave.pcm "mixer"

}

```

Anything using ALSA after this appears to play, but I hear no sound (like it's muted).  OSS apps play fine (ie. play /file/to/sound.wav).

I've tried different variations of /etc/asound.conf with no luck.

The card I am using is snd_cs46xx - and it _has_ worked before (without using dmix), but no longer does (I cannot play two sounds at the same time).

I'm getting kind of frusterated - can anyone help me out?

Thanks,

Adam Olsen

----------

## bushwakko

It seems to me that all apps using alsa's pcm thingy works perfectly with dmix, however some apps use hw directly and then it doesn't work. :/

Could this be the problem, if so, could you make hw be a slave to dmix too or something?

----------

## Redeeman

hmm, i dont think you can.. let me know if you find something interresting

----------

## wizard69

Here is my .asoundrc ( intel8x0)

```

pcm.dsp0 {

   type plug

   slave.pcm "dmixer"     # use our new PCM here

}

# mixer0 like above

ctl.mixer0 {

   type hw

   card 0

}

pcm.intel8x0 {

   type hw

   card 0

}

ctl.intel8x0 {

   type hw

   card 0

}

pcm.dmixer {

   type dmix

   ipc_key 1024         # must be unique!

   slave {

      pcm "hw:0,0"      # you cannot use a "plug" device here, darn.

      period_time 0

      # if the next two are set to powers of 2, dmix and oss-emu

      #   play together well (x^2: it's all oss knows)

      period_size 1024   # must be power of 2

      buffer_size 4096  # dito. It

               #format "S32_LE"

               #periods 128      # dito.

      rate 44100

      #rate 8000      # with rate 8000 you *will* hear,

               # if ossmix is used :)

   }

   # bindings are cool. This says, that only the first

   # two channels are to be used by dmix, which is enough for

   # (most) oss apps and also lets multichannel chios work

   # much faster:

   bindings {

      0 0   # from 0 => to 0

      1 1   # from 1 => to 1

   }

}

```

Info from: https://forums.gentoo.org/viewtopic.php?t=134743&highlight=multiple+sounds

http://www.alsa-project.org/alsa-doc/doc-php/template.php3?module=intel8x0

----------

## image

semiSfear:

in xmms, you probably have to untick mtrr in alsa's configuration. that got rid of the noise for me.

----------

## iDarbert

How about the Sound Blaster Extigy? This OSS emulation layer is driving me crazy!

----------

## einstein1981

I actually copied and pasted it to my file in home folder and it works, nothing more to do!!

for informational purposes only for htose who read this post, it works on a dell inspiron 5150 laptop, with an intel 8xx sound card!

thanks a lot!

----------

## Given M. Sur

Well, mplayer works fine for me, but I get no sound from mplayerplug-in.  I tried adding "ao=alsa9:default" to /etc/mplayerplug-in.conf, but that didn't do anything.

Anybody know why mplayer would work but the plugin wouldn't?

By the way, I'm using mplayer 1.0_pre3_r5 and mplayerplug-in 2.50.

Everything else works fine though, so thanks everyone!

Edit: The problem is different than I thought.  See my next post.

SOLVED -- See later post

----------

## provicemo

I just fixed a problem i had while trying to use mplayer alsa at the same time as anything else played via alsa. I changed:

```
alsa9:default
```

 to 

```
alsa9:dmixer
```

 and now it works GREAT.

----------

## Given M. Sur

I tried changing it to alsa9:dmixer in mplayerplug-in.conf and now I get sound, but the videos are playing about 3X to fast.

Edit: Hmm... it seems that my problem is with all streaming mplayer videos not just mplayerplug-in.  I found a thread that might help me (https://forums.gentoo.org/viewtopic.php?t=94052&highlight=mplayerplugin+fast), but I'm going to fiddle with some stuff and see if I can get it working without following that thread (since I didn't understand what that thread was saying to do exactly).

Another edit:  I just checked and mplayer has no sound in streaming videos with alsa9:default, but is playing at the correct speed.  So it's definately the alsa9:dmixer that's causing it to speed up (with sound).

Last edit: Well, using alsa9:dmixer definately doesn't work for me.  MPlayer plays local files about 15% too fast, and streaming files about 300% too fast with that setting.  I tried using RealTimeClock support as suggested in the other thread, but it did not help at all.  So, I unenabled rtc, and switched back to alsa9:default. 

Well, I just realized that with alsa9:default I do not get sound from movies that are 48kHz when I have "rate 44100" in ~/.asoundrc, and I do not get sound from movies that are 44.1kHz when I have "rate 48000".  So, perhaps the streaming files that I have been testing have been at different rates than either of those.

Is there any way to make the rate variable?  Or is there anything I can do to convert it at playback?

SOLVED -- see later post

----------

## Given M. Sur

Okay, I figured out the problem with putting "alsa9:dmixer" in mplayer.conf.

It will play the file at whatever speed you have in ~/.asoundrc.  So, if you have the rate set to 48000 and try to play a file that has audio in 41.4kHz it will be too fast.  Likewise if your rate is set to 44100 and try to play a file that has audio at 48kHz it will be too slow.  (Unfortunately, I have (almost)perfect pitch, so I will always notice if the pitch is too high or too low, and it will bug me a lot)

So, apparently I've been testing streaming files that are in a very low rate, which is why they were playing about 3X too fast.

So, at the moment I'm limited to using just mplayer and changing my ~/.asoundrc anytime I need to play a file with a different frequency.  I will not be able to use mplayerplug-in though, because there is no way to know what frequency the files are playing at then.

Which brings me back to the questions: Is there any way to make the rate variable in ~/.asoundrc?  Or is there any way to make mplayer convert the sample rate at playback?

SOLVED -- see next post

----------

## Given M. Sur

Well, due to my problems with mplayer (see above)  I figured I would try to use mplayer with ao=oss, and then use "aoss mplayer" to play files.

This allows me to play files that are in different frequencies with mplayer, but unfortunately, aoss will not allow me to play more than one sound at once, which makes it completely useless (since if I only wanted one sound at once I wouldn't have ever tried setting up dmix).

Does anybody know how I can get aoss to play more than one sound at once?

EDIT - PROBLEM SOLVED:

In mplayer it is possible to convert audio sample rates using the -srate flag.  Or you can edit your mplayer config file (/etc/mplayer.conf, or ~/.mplayer/config) and add the line srate=X (X being the rate defined in .asoundrc).

 :Embarassed:  I can't believe that the mplayer man page was the last thing I checked (after a whole lot of hassle trying to configure .asoundrc)

----------

## _kopsu_

Ok. When I login as root to gnome,  dmixing works with alsaplayer. I can have several instances playing and everything works,

but with ordinary user it won't work. Only one player works at same time.

I use global /etc/asound.conf file where I have defined default to dmixing..

so there's nothing wrong with my settings in asound.conf

neither I don't have .asoundrc files.

My user belongs to audio group.

Any ideas??

I have compiled alsa as modules. I use snd_intel8x0 modules because I have nforce2 motherboard. 

I've seen these posts and noone seems to succeeded with this...(?)

----------

## Given M. Sur

MPLAYER NOTE: the syntax in mplayer version 1.0_pre4-r1 (and assumingly any higher versions) has changed.

You must now use "alsa1x:default" istead of "alsa9:default"

_kopsu_, maybe if you try using ~/.asoundrc instead of a global file it'll work.  That's just a guess though.

----------

## charlieg

 *00420 wrote:*   

> MPLAYER NOTE: the syntax in mplayer version 1.0_pre4-r1 (and assumingly any higher versions) has changed.
> 
> You must now use "alsa1x:default" istead of "alsa9:default"

 

Thank you, thank you, thank you!   :Very Happy: 

----------

## Boris27

 *charlieg wrote:*   

>  *00420 wrote:*   MPLAYER NOTE: the syntax in mplayer version 1.0_pre4-r1 (and assumingly any higher versions) has changed.
> 
> You must now use "alsa1x:default" istead of "alsa9:default" 
> 
> Thank you, thank you, thank you!  

 

What he said! Now I can dump aRts.

----------

## VirtuaSpy

2.6.6-love3-rc3

Hercules cm8738 sound card

KDE 3.2.2

Awesome! Thanks for the guide redeeman.

I got it working in about 30 minutes right as I got finished reading through the entire thread. All the way up until the comment about alsa1x:default in the newer mplayers.   :Wink: 

Thanks!!!!

----------

## Redeeman

thats great

----------

## PrakashP

Using alsa1.04, intel8x0, dmix I have "staccato" with xmms when I play mpc. Playing mp3 is nice. Broken mpc plugin?

----------

## VirtuaSpy

I do have one issue. In xmms (perhaps other apps, but since xmms is running more than other apps...) if I am listening to mp3s, and the disk usage goes up significantly, like when I am compiling, xmms will just stop where it's at. It won't freeze, but I have to hit play and the file will start over and start playing again. It has done this multiple times now and never did this under plain alsa without the .asoundrc file with the dmixer specification.

I tried downgrading to the latest "x86" instead of the ~x86 xmms I was using, same thing.

Has anyone else experienced this? Could I maybe try to run xmms from a console and see if it tells me anything? I'll try that and post here if it does.

Thanks.

edit: no extra output

edit2: I think I got it fixed. In XMMS, I went into Preferences > Configure (under ALSA) > Advanced Settings and set Buffer time to 1000ms, Period Time to 100ms and turned off Mmap mode. Been running it for a few hours now with no stops, so if anyone else has this problem, try that.

----------

## geforce

bash-2.05b# /etc/init.d/alsasound start

 * Loading ALSA drivers...

 * Using ALSA OSS emulation

 * Could not detect custom ALSA settings.  Loading all detected alsa drivers.

 * Unable to find any ALSA drivers. Have you compiled alsa-drivers correctly?

 * Running card-dependent scripts

 * ERROR: Failed to load necessary drivers

 * Restoring Mixer Levels

 * No mixer config in /etc/asound.state, you have to unmute your card!    [ !! ]

                                                                          [ ok ]

----------

## charlieg

 *geforce wrote:*   

> bash-2.05b# /etc/init.d/alsasound start
> 
>  * Loading ALSA drivers...
> 
>  * Using ALSA OSS emulation
> ...

 

Follow the alsa instructions in the gentoo docs to unmute your card, then run 'actlstore' to store your settings so that it'll stay unmuted the next time you reboot.

----------

## geforce

 *Quote:*   

> GentooServ root # actlstore
> 
> -bash: actlstore: command not found
> 
> 

 

 *Quote:*   

> GentooServ root # amixer
> 
> amixer: Mixer attach default error: No such device

 

 *Quote:*   

> GentooServ root # amixer set Master 100 unmute
> 
> amixer: Mixer attach default error: No such device

 

----------

## charlieg

 *geforce wrote:*   

>  *Quote:*   GentooServ root # actlstore
> 
> -bash: actlstore: command not found
> 
>  

 

Ooops... sorry... alsactl, used 'alsactl store'.

 *geforce wrote:*   

>  *Quote:*   GentooServ root # amixer
> 
> amixer: Mixer attach default error: No such device 
> 
>  *Quote:*   GentooServ root # amixer set Master 100 unmute
> ...

 

Alsa is incorrectly configured.

----------

## geforce

damn I don't understand how to configure it correctly.... Could you show me your configuration file please ? /etc/alsa

----------

## EliasP

It doesn't work here ;(

Soundcard: C-Media 8738-C6 (snd-cmipci)

Kernel:

```

Linux osgiliath 2.6.5-gentoo #1 Thu Apr 15 22:52:29 CEST 2004 i686 AMD Athlon(tm) XP 2000+ AuthenticAMD GNU/Linux

```

qpkg -I -v | grep alsa

```

media-libs/alsa-oss-1.0.4 *

media-libs/alsa-lib-1.0.4 *

media-sound/alsa-tools-1.0.4 *

media-sound/alsa-utils-1.0.4 *

media-plugins/gst-plugins-alsa-0.8.1 *

```

/etc/asound.conf

```

pcm.dmixer {

    type dmix

    ipc_key 1024

    slave {

        pcm "hw:0,0"

        period_time 0

        period_size 1024

        buffer_size 8192

   rate 44100

    }

    bindings {

        0 0

        1 1

    }

}

pcm.dsp0 {

    type plug

    slave.pcm "dmixer"

}

pcm.!default {

        type plug

        slave.pcm "dmixer"

}

pcm.default {

   type plug

   slave.pcm "dmixer"

}

ctl.mixer0 {

    type hw

    card 0

}

```

/etc/init.d/alsasound restart

```

 * WARNING:  you are stopping a boot service.

 * Unloading ALSA...

 * Storing ALSA Mixer Levels

/usr/sbin/alsactl: save_state:1061: No soundcards found...

 * Unloading modules                                                                                                           [ ok ]

 * Loading ALSA drivers...

 * Using ALSA OSS emulation

 * Loading: snd-seq-oss

 * Loading: snd-mixer-oss

 * Loading: snd-pcm-oss

 * Running card-dependent scripts

 * Restoring Mixer Levels

```

aplay file.mp3

```

ALSA lib pcm_dmix.c:868:(snd_pcm_dmix_open) unable to open slave

aplay: main:507: audio open error: No such device

```

/etc/modules.d/alsa

```
# Alsa 0.9.X kernel modules' configuration file.

# $Header: /home/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsa-modules.conf-rc,v 1.1 2003/08/05 21:07:55 johnm Exp $

# ALSA portion

alias char-major-116 snd

# OSS/Free portion

alias char-major-14 soundcore

##

## IMPORTANT:

## You need to customise this section for your specific sound card(s)

## and then run `update-modules' command.

## Read alsa-driver's INSTALL file in /usr/share/doc for more info.

##

##  ALSA portion

alias snd-card-0 snd-cmipci

## alias snd-card-1 snd-ens1371

##  OSS/Free portion

alias sound-slot-0 snd-card-0

alias sound-slot-1 snd-card-1

##

# OSS/Free portion - card #1

alias sound-service-0-0 snd-mixer-oss

alias sound-service-0-1 snd-seq-oss

alias sound-service-0-3 snd-pcm-oss

alias sound-service-0-8 snd-seq-oss

alias sound-service-0-12 snd-pcm-oss

##  OSS/Free portion - card #2

## alias sound-service-1-0 snd-mixer-oss

## alias sound-service-1-3 snd-pcm-oss

## alias sound-service-1-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss

alias /dev/dsp snd-pcm-oss

alias /dev/midi snd-seq-oss

# Set this to the correct number of cards.

options snd cards_limit=1

```

Does anybody know what to do??

Greetings

Elias P.

----------

## geforce

Ok I think I advanced.

 *Quote:*   

> 
> 
> Linux version 2.4.25-gentoo (root@GentooServ) (gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)) #10 SMP Mon May 3 21:52:19 UTC 2004
> 
> BIOS-provided physical RAM map:
> ...

 

 *Quote:*   

> GentooServ root # lsmod
> 
> Module                  Size  Used by    Tainted: P
> 
> fglrx                 174632   6
> ...

 

----------

## g0su

Edit: sorry all, that post is only for faq not for questions :S sorry!!! 

 :Embarassed: 

----------

## fng

 *charlieg wrote:*   

>  *00420 wrote:*   MPLAYER NOTE: the syntax in mplayer version 1.0_pre4-r1 (and assumingly any higher versions) has changed.
> 
> You must now use "alsa1x:default" istead of "alsa9:default" 
> 
> Thank you, thank you, thank you!  

 

THNX man!!!

sound quality is really poor tho :/

----------

## Kraymer

Hi!

Thanks for the howto. I took the opportunity to finally 'activate' the alsa dmix-plugin. The packages were already installed, so I just copy&pasted your .asoundrc-stuff and it worked instantly  with two instances of mplayer and xmms (<- using alsa output plugin)  :Very Happy: 

Short note for mplayer-users: '-ao alsa9' is outdated (at least for my version of alsa and/or mplayer). Look:

 *Quote:*   

> mplayer -ao help
> 
> Available audio output drivers:
> 
>          .....
> ...

 

So you may want to use mplayer -ao alsa1x:default or -ao alsa1x:dmix if the default settings don't work.

edit: sorry, didn't read to the end of this thread.. as I should have known, you guys already figured that out  :Wink: 

Sebastian

----------

## tecknojunky

I tried dmix in the past and fiddle several days with it to get crackling-results, at best.  After several weeks of i-give-up period, i decided to give dmix another turn to get it working properly.  5 minutes later, it worked with everything.    :Rolling Eyes:  Go figure that out.

----------

## sir_skiner

and what about mozilla/firefox? does it work for these apps, 'cause i still can't play xmms and play suond via browser in flash games for example

----------

## genstef

Is it already possible to use this in wine/winex/cedega/cxoffice?

On my machine cedega plays through alsa but not through dmix.

----------

## Redeeman

 *tecknojunky wrote:*   

> I tried dmix in the past and fiddle several days with it to get crackling-results, at best.  After several weeks of i-give-up period, i decided to give dmix another turn to get it working properly.  5 minutes later, it worked with everything.    Go figure that out.

 

thats because you should set the rate to 48000 instead of the 441000 it is default. then it should work.

----------

## Redeeman

genstefan:

dunno, if you find outm tell me  :Smile: 

sit_skiner:

hm, try run firefox with aoss  :Smile: 

----------

## goulash

thanks alot for this it works perfectly  :Very Happy: 

edit: havent been able to get the sound in teamspeak working with "aoss TeamSpeak". did i need to compile OSS into the kernel or anything like that? or what should i set my sound driver to in teamspeak?Last edited by goulash on Thu Jun 24, 2004 3:22 am; edited 1 time in total

----------

## sir_skiner

 *Redeeman wrote:*   

> 
> 
> hm, try run firefox with aoss 

 

well, this is the issue that i try running 

```
aoss firefox
```

 and it does nothing good, may it be wrong alsa-oss version? i have kernel 2.6.7 and alsa-oss-1.0.3a

----------

## goulash

the only app i can get to work properly using alsa oss emulation is firefox. quake3 and teamspeak dont work at all. ive copied the guide exactly, and have an intel_i8x0.

----------

## Redeeman

strange.... anyway  :Smile:  i cant test much now, since i have a via 82xx soundcard now, which does hardware mixing

----------

## Wooff

Hi, at last its work for me (I spend 3 days with it...)

Thankx to everybody who sent here his/her ~/.asoundrc, mplayer.conf, ...

I have Mitac 8640 notebook with i8x0 soundcard (Sis962)

I compiled support into kernel. Followed alsa how-to (in doc section)

this is mine ~/.asoundrc

and nothing more ... like seq or binds... (it is just not needed)  *Quote:*   

> pcm.!default {
> 
>         type plug
> 
>         slave.pcm "dmixer"
> ...

 

and mplayer config

simple alsa1x doesnot work (? default is not default?) *Quote:*   

> wooff@Holly wooff $ cat /etc/mplayer.conf | grep ao=
> 
> ao=alsa1x:default       # To specify default audio driver (see -ao help for
> 
> 

 

/etc/modules.d/alsa

its classic one for i8x0 sound card

 *Quote:*   

> alias /dev/mixer snd-mixer-oss
> 
> alias /dev/dsp snd-pcm-oss
> 
> alias /dev/midi snd-seq-oss
> ...

 

~/.xmms/config

this is defalt one I think ... *Quote:*   

> [ALSA]
> 
> buffer_time=500
> 
> period_time=50
> ...

 

~/.mplayer/gui.conf

This is conf file for gMPlayer !! I really dont know why it is separated file.  *Quote:*   

> ao_driver = "alsa1x:default"
> 
> ao_volnorm = "no"
> 
> ao_surround = "no"
> ...

 

Its perfect now ((-:

Always look on the bright side of the live ((-: 

W

----------

## dmitrio

I have copied this HOWTO, with permission of Redeeman, fafhrd, Zoltan, allex87, 00420, Frank Barknecht <fbarATfootils.org>, to gentoo-wiki.com 

http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix

If you see anything that should be added or changed, feel free to do so. 

Thank you for a great HOWTO.

----------

## Given M. Sur

mplayer 1.0_pre5-r1 and above now use just "alsa" instead of "alsa1x:default" or "alsa9:default".

I've already updated the wiki.

----------

## dmitrio

 *00420 wrote:*   

> mplayer 1.0_pre5-r1 and above now use just "alsa" instead of "alsa1x:default" or "alsa9:default".
> 
> I've already updated the wiki.

 

roger that

tnx

----------

## stoffe

Worked right out of the box. Emerged alsa-oss, changed settings for xmms and mplayer and both just played. I have yet to try more applications, but just wanted to pop my head in and say thanks for a great HOWTO! Been wanting this for quite a long time. Buh-bye arts! (Actually, I've set arts to use this as well for now, and that seems to work too, at least until I can see if I want to skip arts completely).

----------

## ranmakun

Thanks for this HOWTO, very nice.

For me it worked great, but there is one problem, stepmania complaints:

 *Quote:*   

> 
> 
> Couldn't load driver ALSA: dsnd_pcm_open: Device or resource busy
> 
> Mixing 0.000000 ahead in 0 Mix() calls
> ...

 

This is when I have artsd on. However, with artsd on, I can play a movie with xine and alsa, or hear music with xmms and the alsa driver. I don't see whats the difference.

Does anyone know whats happening?

----------

## agent_jdh

I've just ripped out my TB Santa Cruz and enabled the nForce2 audio on my mobo, this thread (meesy though it may be) has proven invaluable.  Thanks guys.

A couple of things I have noticed-

1.  In mplayer.conf (and mplayerplug-in.conf), alsa output only works if I use the option

```
ao=alsa:device=default
```

That's with mplayer-1.0_pre5-r2

2.  gmplayer still does not work with the alsa device (even with the option as above in gui.conf), I need to use OSS but it works and it seems this is a gmplayer problem.

3.  Xine and XMMS work fine with the default ALSA driver option selected.

I don't use that many sound apps so this is fine with me - although having read of some ppl with Firefox issues, I may find something in the future.

One other thing, what's with the ipc_key option in the asound file?

----------

## saintdev

Doesn't work at all for me. ALSA works just fine, but I can still only play one sound at a time. I'm trying to use XMMS and Gaim at the same time (so I'm playing sounds through aplay), but it doesn't work. aplay just hangs waiting for the sound device until I stop XMMS.

----------

## genstef

How can i get this working for multiple users?

alsa shows the following error:

```
alsa-init: soundcard set to dmixer

ALSA lib pcm_direct.c:203:(make_local_socket) connect failed: /tmp/alsa-dmix-22490-1091986393-708633: Permission denied

ALSA lib pcm_dmix.c:897:(snd_pcm_dmix_open) unable to connect client

alsa-init: playback open error: Permission denied

```

Is there also a way to get udev to create my sound devs with 660 so that I can actually use it for other users, too. I dunno where udev knows the user from ..

----------

## Redeeman

add users to sound group, but if you insist, look at

/etc/udev/permissions.d/<the file>

----------

## genstef

The problem is that the users are in the "audio" group but they cannot access the files because they are initially 600 ..

----------

## theonlymcc

I have a Dell I5150 with an i8x0 card. When I use the settings at the beginning of the thread, it works. I can use mulitple sounds at once, mainly with XMMS and Gaim. But the problems are: 1) XMMS uses memory (for buffering??) and doesn't give it back. So the music stops midway through. 2) Sometimes the music suddenly gets gittery. 3) XMMS won't play but one song. It won't go down the playlist. I have to click each song. It only does it when using the .asoundrc settings. Any suggestions?

----------

## codergeek42

 *Redeeman wrote:*   

> strange.... anyway  i cant test much now, since i have a via 82xx soundcard now, which does hardware mixing

 Really? I have an onboard VIA 82xx and it doesn't do hardware mixing...

----------

## Redeeman

mine does  :Razz: 

----------

## codergeek42

 *Redeeman wrote:*   

> mine does 

 is there something you have to set or configure?

----------

## tecknojunky

me again.

My 1st post in this thread is dated Oct 12, 2003.  Only today did i manage to make dmix on one of my box (tested using aplay some.wav & twice).  Problem is, no other apps would work.

On that particular box, i use Enlightenment, and need esound to get the ear candy.  To make short story shorter, I enabled esd in xmms, xine and I can now play everything simultaniously.

So, I'm wondering if dmix is that useful.  Esound seem to do the job pretty well.

----------

## Redeeman

i didnt set anything

----------

## tecknojunky

This must be the most ridiculous feature to set that just refuse to work.  It's frustrating and I want to smack someone  :Evil or Very Mad:  .

I can play xmms as root and E will play it's sound them at the same time.  I have recursively chmoded 777 everything in /dev, but a normal user get: *Quote:*   

>  xmms
> 
> ALSA lib pcm_direct.c:203:(make_local_socket) connect failed: /tmp/alsa-dmix-1281-1092269295-140543: Permission non accordée
> 
> ALSA lib pcm_dmix.c:897:(snd_pcm_dmix_open) unable to connect client
> ...

 Permission denied.  What the fuck.  Why can't it be simple?  It makes no sense.

----------

## theonlymcc

Ensure that the users in included in the audio group would be my guess. But I still can't figure out why XMMS with dmix causes the music(mp3, wav, cd audio, etc) to become gittery. I have resolved my other 2 issues. Any one having problems with the music becoming gittery with demix?

----------

## Redeeman

set the rate proper and it shouldnt glitch

----------

## tecknojunky

 *theonlymcc wrote:*   

> Ensure that the users in included in the audio group would be my guess. 

 I have deleted all gentoo's irrelevant users and groups, including the audio group.  Everything is chmoded to 777, how can groups can have any effect then?

 *theonlymcc wrote:*   

> But I still can't figure out why XMMS with dmix causes the music(mp3, wav, cd audio, etc) to become gittery. I have resolved my other 2 issues. Any one having problems with the music becoming gittery with demix?

 I think Redeeman is right.  You can try to set the bitrate at 44800.

----------

## TheWoopWoop

Thanks Wooff.

Your config was the one that made it all come together. This is so much nicer than arts!

----------

## cato`

I got it working on my intel8x0 laptop.

The only problem is with skype ... it stoped working. Any solution?

----------

## Stieltje

Many thanks, this now works for me  :Smile: 

I have read many a howto, but there are always some info missing, like the line :

```
 $ aoss <appname> 
```

so to everyone posting howto threads, try to be as complete as possible  :Smile: 

again, many thanks for this post, this is what makes these forums great  :Smile: 

----------

## Redeeman

as i recall, i described to use aoss for non-alsa applications.

----------

## theonlymcc

 *Quote:*   

> I think Redeeman is right. You can try to set the bitrate at 44800.

 

I tried that and after a few minutes it stills gets glitchy.

----------

## theonlymcc

Anyone?? This problem is really annoying. I can't listen to music with dmix but for a few minutes. I've tried different bit rates. Using intel 8x0 card

----------

## Redeeman

sorry, but i dont have such a card myself, so i cant test it  :Neutral: 

----------

## Skrot

Um... wtf? This all suddenly works now? I'm impressed! It's a shame that quake3 doesn't work with aoss, but everything else works great so far! Hell, even firefox running through aoss, playing flash works. And you know what? The sound is in sync with the video!!!!

Dear god... this is awesome.

Cheers!

----------

## Stieltje

Hi again.

after following this guide, suddenly alsamixer won't work, and xmms has developed a tendency to just freeze on loading mp3's.

[EDIT]

sorry, forgot to type in the alsamixer error:

```
 alsamixer: function snd_ctl_open failed for default: Invalid argument 
```

any clues?[/code]

----------

## Skrot

Ah... yes, all is not perfection... but it's close! I also have the xmms freezing problem  :Sad: .

Ohh well...

----------

## Redeeman

dmix might get alot better in time  :Smile: 

----------

## Bekker

Is there anyone with a snd_cs46xx driver who has got the dmixer plugin to work??? 

the following asound.conf file works perfectly

```
pcm.!default {

        type hw

        card 0

        }

ctl.!default {

        type hw

        card 0

}
```

aplay -D default test.wav works ok.

But when I try to get the dmix plugin to work with the following asound.conf file:

```
pcm.dmixer {

    type dmix

    ipc_key 1024

    slave {

        pcm "hw:0,0"

        period_time 0

        period_size 1024

        buffer_size 4096

 rate 44100

    }

    bindings {

        0 0

        1 1

    }

}

pcm.dsp0 {

    type plug

    slave.pcm "dmixer"

}

pcm.!default {

        type plug

        slave.pcm "dmixer"

}

pcm.default {

 type plug

 slave.pcm "dmixer"

}

ctl.mixer0 {

    type hw

    card 0

}

```

aplay test.wav produces no sound at all. Only aplay -D hw:0,0 test.wav works.

Can anyone help me? I am totally out of ideas.

regards

Chera

----------

## Bekker

To follow up on my previous post, it seems that the snd-cs46xx module is porked. I tried with my onboard nforce 2 soundcard and dmixer worked as advertised. Guess I'll have to dump my Hercules Fortissimo card then.

Any advice on what current soundcard is best supported with ALSA? I discarded my old SB live a couple of years ago due to the data corruption issues with VIA chipsets. Does anyone know if there are these issues with nforce 2 mobo's?

Thanks for any advice.

Chera

----------

## agent_jdh

 *Bekker wrote:*   

> To follow up on my previous post, it seems that the snd-cs46xx module is porked. I tried with my onboard nforce 2 soundcard and dmixer worked as advertised. Guess I'll have to dump my Hercules Fortissimo card then.
> 
> Any advice on what current soundcard is best supported with ALSA? I discarded my old SB live a couple of years ago due to the data corruption issues with VIA chipsets. Does anyone know if there are these issues with nforce 2 mobo's?
> 
> Thanks for any advice.
> ...

 

Why do you need dmix with a cs46xx based card?  It _should_ support hardware mixing, unless Hercules have crippled the card in some way.

I'm not aware of any issues with the Live/Audigy and nForce 2 chipset.

I find the nForce 2 onboard audio to be fine.

----------

## Bekker

Agent,

Could you tell me how to get the hardware mixing to work with the snd-cs46xx module? I cannot get two aplay streams to play at the same time. And like I said dmixer doesn't work (for the Hercules card that is)..

I've got a cheap version of the a7n8x mobo with a Realtek ALC650 audio chipset with very basic capabilities so I prefer to use my Hercules card. 

Thanks for any info

Chera

----------

## Bekker

O.k. found the solution on alsa.opensrc.org. Make sure you have

CONFIG_SND_CS46XX_NEW_DSP=y

in your kernel 2.6.x .config file when you compile the cs46xx module. then you get hardware mixing support.

Now I still have to get the dedicated headphone support to work...

Chera

----------

## agent_jdh

 *Bekker wrote:*   

> Agent,
> 
> Could you tell me how to get the hardware mixing to work with the snd-cs46xx module? I cannot get two aplay streams to play at the same time. And like I said dmixer doesn't work (for the Hercules card that is)..
> 
> I've got a cheap version of the a7n8x mobo with a Realtek ALC650 audio chipset with very basic capabilities so I prefer to use my Hercules card. 
> ...

 

I've actually taken my cs46xx card (TB Santa Cruz) out of my box now, so I'm not 100% sure on this, but could you do a 

```
cat /proc/asound devices
```

This will indicate how many output streams your card can manage in hardware, or it it can't do h/w mixing.

I'm pretty sure the Hercules _should_ be capable of it, maybe the driver doesn't fully support it though.

Actually, just looking at the ALSA website, there is some indication that support for all of the CSxxxx DSP's that use the cs46xx driver is not the same for all the different DSP's - maybe you would get a more definitive answer on the ALSA mailing list.

----------

## Bekker

Agent,

thanks for your input. I got the hardware mixing to work like I said in a previous post. Turned out to be an experimental setting in the .config file of the 2.6.8 kernel.

Chera

----------

## agent_jdh

 *Bekker wrote:*   

> Agent,
> 
> thanks for your input. I got the hardware mixing to work like I said in a previous post. Turned out to be an experimental setting in the .config file of the 2.6.8 kernel.
> 
> Chera

 

Was it the "Cirrus Logic (Sound Fusion) New DSP support (EXPERIMENTAL)" option?

That's not really experimental these days ... it's been there for ages, and should really be the default by now.

----------

## Bekker

Agent,

Could be, but in the 2.6.8.1 kernel source it is still labelled as experimental. Probably the ALSA maintainers forgot to tell the kernel guys that it is stable. 

Chera

----------

## GroennDemon

Hi,

I now can have xmms and xine run simultaneously. However, xine always starts muted and the Gnome volume control applet would only let me control the main volume. When I want it to open the "volume control", i.e. PCM, CD etc., it always says "no mixer devices found" or something similar. Any ideas?

I'm running alsa + alsa-oss + esound + dmix.

Thanks.

----------

## Bekker

It helps when you tell us:

1) what alsa driver you use

2) did you add alsasound to the default startup scripts?

3) why do you use esound, you don't really need it if you have dmixer working.

regards

Chera

----------

## GroennDemon

I have ALSA compiled as modules and 

```
media-libs/alsa-lib-1.0.5-r3 *

media-libs/alsa-oss-1.0.5 *

media-sound/alsa-headers-1.0.5a *

media-sound/alsa-utils-1.0.5 *

media-plugins/gst-plugins-alsa-0.8.2-r1 *
```

.

After I had read about dmixer, I unmerged esound, but then several programs refused to work because they couldn't find esound.so...

Also, I have had that program before I used dmixer...

----------

## MooktaKiNG

 *GroennDemon wrote:*   

> I have ALSA compiled as modules and 
> 
> ```
> media-libs/alsa-lib-1.0.5-r3 *
> 
> ...

 

Even though i have dmix, i still like to have arts and esound running.

Just so that all apps work without bothering to configure it.

----------

## Bekker

 *GroennDemon wrote:*   

> I have ALSA compiled as modules and 
> 
> ```
> media-libs/alsa-lib-1.0.5-r3 *
> 
> ...

 

What kernel do you use and what ALSA module?

I have only experience with the snd-cs46xx module.

Chera

----------

## GroennDemon

I use gentoo-dev-sources-2.6.8-r2. Lsmod says I have:

```
snd snd_intel8x0m,snd_virmidi,snd_seq_virmidi,snd_seq_midi,snd_intel8x0,snd_ac97_codec,snd_mpu401_uart,snd_rawmidi,snd_seq_oss,snd_seq_midi_event,snd_seq,snd_seq_device,snd_pcm_oss,snd_pcm,snd_timer,snd_mixer_oss

```

----------

## syadnom

this is just a big pain in the ass.  why don't the alsa guys gave this built in, seamless.  why doesn't alsa just use hardware mixing when available and use dmix or some software mixing when hard-mixing is not avail????  

a good piece of software does not require a 'howto' to just get it working!  alsa runs flawlessly when a card with hardware mixing is used, no config, no mess, just works(kernel_2.6) but when no hardware mixing is avail, this dmix mess has to be dealt with.  i STILL don't have a 100% working sound system, i can't launch every single program like './aoss foo', some just won't work that way, and others SHOULDn't run that way.

----------

## Kream

I prefer to have ALSA's dmix enabled global ly for my card and here's my working /etc/asound.conf for my nforce intel8x0 onboard soundcard : 

```
pcm.!default {

        type hw

        card 0

}

ctl.!default {

        type hw

        card 0

}

pcm.dmixer {

    type dmix

    ipc_key 1024

    slave {

        pcm "hw:0,0"

        period_time 0

        period_size 1024

        buffer_size 8192

   rate 44100

    }

    bindings {

        0 0

        1 1

    }

}

pcm.dsp0 {

    type plug

    slave.pcm "dmixer"

}

pcm.!default {

        type plug

        slave.pcm "dmixer"

}

pcm.default {

   type plug

   slave.pcm "dmixer"

}

ctl.mixer0 {

    type hw

    card 0

}
```

----------

## cradlebin

Here is my .asoundrc:

```
pcm.my_card {

  type hw

  card 0

# mmap_emulation true

}

pcm.dmixed {

  type dmix

  ipc_key 1024

  slave {

    pcm "my_card"

   # period_time 0

   # buffer_size

    rate 48000

    period_size 1024

  }

}

pcm.dsnooped {

  type dsnoop

  ipc_key 2048

  slave {

    pcm "my_card"

#   rate 48000

#   period_size 128

  }

}

pcm.asymed {

  type asym

  playback.pcm "dmixed"

  capture.pcm "dsnooped"

}

pcm.pasymed {

  type plug

  slave.pcm "asymed"

}

pcm.dsp0 {

  type plug

  slave.pcm "asymed"

}

pcm.!default {

  type plug

  slave.pcm "asymed"

}

```

However I got some problems with UT (GOTY, the original version).

When I set UT to use 22001 Hz sound, sound works but it's awful.

So I set it UT to use 44100 Hz sound today, and sound was better but now the sound lags behind and stutters all the time, really weird.

I though it might have been the buffer in my .asoundrc file, but when i uncomment the buffer, i get high squeeky noises through my speakers instead of regular sound, changing the rate to 48000 didn't work (that setting is still in my posted file, I tried 44100 as well, didn't work).  (I start UT with aoss ut btw).

So i'm quite stuck here, i'd love to hear xmms play during some instagib, so hopefully someone can help me here, I use intel8x0 for my soundcard (Epox 8 RDA3+ onbourd C-media 9739 chip).

----------

## Alexander_L

Some hints for errors like this?

```
alsa_get_mixer(): Attaching to mixer hw:0 failed: Permission denied
```

xmms tells me this.... other aplications don't work too.

Did i miss something??

----------

## PrakashP

Do you belong to group sound?

----------

## Alexander_L

I belong to the group audio.

----------

## PrakashP

Right, sorry. audio is the correct group. Then the only thing left to check is whether the devices in /dev belong to group audio.

----------

## Alexander_L

They do:

```
ls -l /dev/sound

total 0

crw-rw----  1 root audio 14, 12 Oct 13 16:04 adsp

crw-rw----  1 root audio 14,  4 Oct 13 16:04 audio

crw-rw----  1 root audio 14,  3 Oct 13 16:04 dsp

crw-rw----  1 root audio 14,  0 Oct 13 16:04 mixer

crw-------  1 root audio 14,  1 Oct 12 10:45 sequencer

crw-------  1 root audio 14,  8 Oct 12 10:45 sequencer2
```

Are there any other devices i have to check?

Btw, some background info: i am running a 2.6 kernel + udev

----------

## Alexander_L

```
find /dev -group audio -print

/dev/sound/mixer

/dev/sound/audio

/dev/sound/dsp

/dev/sound/adsp

/dev/sound/sequencer2

/dev/sound/sequencer

/dev/snd/pcmC0D0c

/dev/snd/pcmC0D0p

/dev/snd/pcmC0D1c

/dev/snd/timer

/dev/snd/seq

/dev/snd/controlC0

/dev/smpte3

/dev/smpte2

/dev/smpte1

/dev/smpte0

/dev/rmidi3

/dev/rmidi2

/dev/rmidi1

/dev/rmidi0

/dev/mpu401stat

/dev/mpu401data

/dev/mixer3

/dev/mixer2

/dev/mixer1

/dev/midi3

/dev/midi2

/dev/midi1

/dev/midi03

/dev/midi02

/dev/midi01

/dev/midi00

/dev/midi0

/dev/dsp3

/dev/dsp2

/dev/dsp1

/dev/audioctl

/dev/audio3

/dev/audio2

/dev/audio1
```

is some device missing?

----------

## galay2

anyone got dmix to work with winex/cedega?

----------

## melteye

Thanks. Did just as you said and it works great.

----------

## keyser_soze

I keep getting errors with various programs when using aoss

as an example

```

$ aoss esd -nobeeps -terminate

esd: stack smashing attack in function read()

Aborted

```

Anyone know what causes this?

it also happens on wine

mplayer gives a segmentation fault

?? any suggestions

----------

## TheChuckster

In order to get this to work, forget using the integrated 2.6 kernel drivers. They just won't work no matter what you try. Just enable Sound Support (one thing) but not anything ALSA at all in the kernel config. Recompile the kernel and install the alsa-driver ebuild and set it up 2.4 style. One advantage of separate drivers from the kernel is that you can always update ALSA without upgrading your kernel in the process.

Any way is there a way to configure OSS Emulation to also be mixed in?

----------

## stahlsau

 *Quote:*   

> In order to get this to work, forget using the integrated 2.6 kernel drivers. They just won't work no matter what you try.

 

I can´t second that. Works very well here with kernel-alsa.

Anyhow, maybe someone in the meantime figured out how to  include enemy-territory or some game like that into dmix? Running with 

```
aoss et
```

 doesn´t work, it dies with 

```
Received signal 11, exiting...

Shutdown tty console
```

Anything else i´ve tried doesn´t work too, so i would be happy if s/o could point me a clue  :Smile: 

----------

## moosh

Hi all,

I tried the solutions suggested here for software mixing (I have a Dell Inspiron 9100 with intel8x0) and everything seems to work great except for a couple of problems.

I disabled artsd (I work with KDE) and made mplayer play the system notifications. So far, so good. However, mozilla and skype refuse to cooperate. I noticed skype uses /dev/dsp. I tried running it through aoss, but then I have no microphone (I tried the asymd .asoundrc and it doesn't work). As for mozilla, I don't know where to even begin.

Thanks

----------

## monicajae

why is it i can't hear more than two sounds at the same time?  i have a default mail .wav for when evolution is evoked and I copiled it with alsa.  HOwever, when i am listening to xmms and have gaim open, i hear both.  Is there a remedy to this?

----------

## Redeeman

that is because not all of your stuff is using alsa's default device, it might be using alsa's hw device directly, or oss emulation

----------

## bushwakko

why do programs access the hw device and not the default, and why doesn't the oss device map to the default device in some way? it isn't a very bullet proof system imo.

----------

## Redeeman

i agree, its ugly that the oss emulation doesent just wrap to the default alsa device.

and why the programs doesent use the default device as default? because the program authors somehow should be kneecapped.  :Smile: 

----------

## bushwakko

Why is it even possible to use the hw directly and not the default device? isn't it the same API? If alsa makes it harder, people probably would use the defaultdeivice  :Wink:  Let's petition them!  :Very Happy: 

----------

## Redeeman

it shouldnt be harder.

----------

## monicajae

 *Redeeman wrote:*   

> that is because not all of your stuff is using alsa's default device, it might be using alsa's hw device directly, or oss emulation

 

that's it?  is there a workaround?

plus, when i reboot, i have to do

the whole process all over.  Now 

that's a bigger pain in the arse

----------

## monicajae

 *Redeeman wrote:*   

> that is because not all of your stuff is using alsa's default device, it might be using alsa's hw device directly, or oss emulation

 

that's it?  is there a workaround?

plus, when i reboot, i have to do

the whole process all over.  Now 

that's a bigger pain in the arse

----------

## Redeeman

what process all over?

----------

## monicajae

you know, having to do this in Lynx 

is also a pain in the ass.  i keep losing it.  any

way, that's another thread.  

Waht was it about my post that confused

you?  i thought it was pretty straigt

forward "when i reboot, i have to 

do it again"  i.e. the hardware mixing 

process you mentioned at the beginning

of the thread.  redundant: what is the

way to fix this?  i'm tired of the 

message that i can't start alsasound be

cause of the "lack of a soundcard", which

of course it tells me in it's own words.

i want to be able to do this whether i 

reboot or not.  I hope this was specific enough for you.  i'm surprised

that ginven the simple language i used you could've tried to offer

and answer anyway based on maybe an idea or projection 

may have had concerning the thread. /etc/init.d/alsasound restart

```

* WARNING:  you are stopping a boot service.

 * Unloading ALSA...                                                      [ ok ] 

* Storing ALSA Mixer Levels

/usr/sbin/alsactl: save_state:1061: No soundcards found...                [ ok ] 

* Unloading modules                                                      [ ok ] 

* Loading ALSA drivers...

*   Loading: snd-intel8x0...

FATAL: Module snd_intel8x0 not found.                                     [ !! ]

 * ERROR: Failed to load necessary drivers                              [ ok ]

 * Restoring Mixer Levels                                                 [ ok ]

```

That's the output i get.  this is after doing asound.conf your way, which works, till i reaboot.

Should i have a ~/.asoundrc?  or a /etc/asound.conf?

I think i'm gonna recompile the kernel with sound as a module, re-emerge all the drivers and then try again....

----------

## monicajae

ok, where'd you go?  now i can't even compile alsa-drivers.  what the hell.  this was working so well until i had to go ahead and reboot, but you know, it happens.  i'm going back to xp.  this is bullshit, i'm getting sick of this, it works, oops, then it doesn't.  what the hell, anyone know why i cna't emerge alsa-drivers now?

```

var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../drivers/serialmidi.c:327: error: too many arguments to function

make[4]: *** [/var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../drivers/serialmidi.o] Error 1

make[3]: *** [/var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../drivers] Error 2

make[3]: *** Waiting for unfinished jobs....

  CC [M]  /var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../acore/pcm_lib.o

  CC [M]  /

 ----and later---

e/seq/snd-seq-dummy.o

  LD [M]  /var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../ac ore/seq/snd-seq-virmidi.o

  LD [M]  /var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../ac ore/seq/snd-seq-midi.o

  LD [M]  /var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../ac ore/seq/snd-seq-midi-emul.o

  LD [M]  /var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../ac ore/seq/snd-seq-instr.o

  LD [M]  /var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/kbuild/../ac ore/seq/oss/snd-seq-oss.o

make[2]: *** [_module_/var/tmp/portage/alsa-driver-1.0.7/work/alsa-driver-1.0.7/ kbuild] Error 2

make[1]: *** [modules] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.10-rc1'

make: *** [compile] Error 2

```

----------

## jamapii

I followed the instructions on page 1, and the mixing seemed to work as intended (was a little tricky to verify because... well...), but now I have this problem:

http://linux.derkeiler.com/Mailing-Lists/Debian/2003-11/3464.html

http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=123920 (only comment #1)

As if some daemon was dragging the volume down, or as if two entities are bouncing the volume value back and forth in different units, always rounding down until it's zero.

What I did was:

```
emerge alsa-utils alsa-oss

rc-update add alsasound default

/etc/init.d/alsasound start

# write ~/.asoundrc

# switch from esd to alsa

# volume starts decreasing

# moving alsasound to boot runlevel ...

emerge alsamixergui

# trying to undo it, no effect ...

```

The obvious workaround would be a daemon that keeps the volume up.

I'll continue this in the Multimedia forum

----------

## monicajae

yo redeeman, where did you frikken go.  why can't i get it to work anymore?

----------

## monicajae

 *Quote:*   

> (yes, i know my symlink points to 2.6.0 source, but i only have that)
> 
> ```
> redeeman@redeeman: ~$ su
> 
> ...

 

Now, when you say, only sound support, can you please be more specific?  i tried many things for so long since this thread that i forgot which one worked.  you just don't want the actual card driver enabled?  is that of which you speak??  or the other crap too after you enable a bo for sound on the first page for that part of the config?

----------

## stahlsau

I had some trouble with getting dmix to work correctly, too. But afterall, it´s just (for 2.6er kernel):

-compile alsa-drivers into the kernel

-emerge alsa-lib, alsa-oss and alsa-utils

-start alsasound (and evtl. add to boot-runlevel)

-find a matching .asoundrc for your card and your needs

The first steps are simple and when done, single sounds should work. The hardest (for me, at least) was messing around with .asoundrc to get the real mixing to work. 

But there is pretty much documentation for that, on the wiki, the alsa-project homepage etc, and if you try some different settings in your .asoundrc, you´ll get it to work  :Smile: 

----------

## syadnom

i have completely given up knowing that it is completely hopeless to get software mixing working for all interfaces and all programs.  i will wait until the alsa developers get this straightened out.  on my desktop i run a SB so i don't have any problems but my laptop is a i810 so i will have 1 sound at a time for a while.

----------

## einstein1981

this used to work " out of the box" I mean I just copied it, and it worked, on this fairly new install seemed to work, until today... amsn sounds just piled up until xmms stopped and then amsn sounds for about 2 mins...

so I checked, and the only thing that I see is that my file is now ~.asoundrc

instead of ~/.asoundrc so I try to rename it, and gnome tells me, I can;t use / in file names...

now I tried messing with sawfsh a while back , and I changed something in the X setup so as when I start starx sawfish starts and not X but, I don;t know if this changes anything in gnome, if anyone knows, please infom me

thanks

charles

----------

## syadnom

no offense einstein1981, you make very little sense. *Quote:*   

> and I changed something in the X setup so as when I start starx sawfish starts and not X but, I don;t know if this changes anything in gnome, if anyone knows, please infom me 

 

if sawfish starts, then X has started, did you mean to say something else?

also, the  ~/.asoundrc just means /home/username/.asoundrc.  

if the filename is ~.asoundrc, that is wrong.you just need to delete the ~ out of the filename and make sure it is in the root of your home directory[/home/einstein1981/.asoundrc] what i read is that you have /home/einstein1981/~.asoundrc

hope this helps

----------

## einstein1981

OMG... sorry...  :Embarassed: 

was kinda drunk and programing some stupid client server thing for the university, check the post hour.. yeah I think what I meant was thatI tried setting the default WM to sawfish, in the rc.conf file, I set the XSESSION VAR to sawfish..

well sorry for that stupid post...

changed it back, but still doesn't work, I have an intel 8x sound card, on my inspiron laptop, used to work...

did you have any luck with it?

----------

## syadnom

i have never had an i8xx sound system work with software mixing properly.  if i run OSS emulation i can get a number of apps to 'work' but thats it, many many things dont so i just gave up on it.

you would think it would be easy to make dsp0 a mixable buffer that streamed to the real dsp but it must not really be that simple.

----------

## rohan28

I have an i8xx (855GM on an Acer Extensa laptop), and dmix works for me (although SDL apps sometimes have problems).  It took me a lot of experimenting to find good values for asound.conf though.  Speaking of that file, here it is:

```

pcm.card0 {

  type hw

  card 0

}

pcm.dmix0 {

  type dmix

  ipc_key 34521

  slave {

    pcm "card0"

    period_time 80000

    periods 8

    rate 44100

  }

}

pcm.dsnoop0 {

  type dsnoop

  ipc_key 34522

  slave {

    pcm "card0"

    period_time 80000

    periods 8

  }

}

pcm.asym0 {

  type asym

  playback.pcm "dmix0"

  capture.pcm "dsnoop0"

}

pcm.pasym0 {

  type plug

  slave.pcm "asym0"

}

pcm.dsp0 {

  type                  plug

  slave.pcm             "asym0"

}

ctl.dsp0 {

    type                hw

    card                0

}

pcm.!default {

  type                  plug

  slave.pcm             "asym0"

}

ctl.!default {

    type                hw

    card                0

}

```

(note I don't have a ~/.asoundrc)

Of course, there are many varieties of i8xx, but maybe this will work for some others.

----------

## bushwakko

my god damn hero! everything works perfectly now, no need to use aoss on stuff, and xine even works! WOOOHOO  :Very Happy: 

----------

## russianpirate

i have a CMEDIA 8738

tried that last asound.conf above, worked, but i agree there are problems with sdl games, delays and things like that.. ive had the same problem with esd.. anyone has a solution?

----------

## chetan13

could anyone who is using alsa without oss emulation (pure alsa) please post their ~/.asoundrc file? i have a intel8x0 card and i can't figure out how to make it work.

thanks in advance

chetan

----------

## genstef

You dont need a .asoundrc. A /etc/asound.conf for all alsa-users is imo better.

Here is my /etc/asound.conf .. it could also be used as .asoundrc

I use snd-intel8x0 and I am very content with this config, I run it for month w/o problems now.

```
pcm.dmixed {

    type dmix

    ipc_key 1024

    slave {

        pcm "hw:0,0"

        period_time 0

        period_size 1024

        buffer_size 16384 # BUffer size doubled to avoid sound stutters

        rate 44100

    }

    bindings {

        0 0

        1 1

    }

}

pcm.dsnooped {

    ipc_key 1027

    type dsnoop

    slave.pcm "hw:0,0"

}

pcm.dmixer {

    type asym

    playback.pcm "dmixed"

    capture.pcm "dsnooped"

}

pcm.dsp0 {

    type plug

    slave.pcm "dmixer"

}

pcm.!default {

    type plug

    slave.pcm "dmixer"

}

pcm.default {

    type plug

    slave.pcm "dmixer"

}

ctl.mixer0 {

    type hw

    card 0

}
```

----------

## chetan13

i saved your file in /etc/asound.conf and rebooted. now there is no sound.

$ aplay test.wav

ALSA lib pcm_dmix.c:1192:(_snd_pcm_dmix_open) Unknown field playback

aplay: main:508: audio open error: Invalid argument

is this problem due to not having the alsa oss emulation? i don't use any oss only apps so i never enabled it.

----------

## genstef

Do alsaplayer and mplayer work?

----------

## chetan13

 *genstef wrote:*   

> Do alsaplayer and mplayer work?

 

no.. mplayer doesn't work, it plays the video but there is no sound. i don't have alsaplayer installed

----------

## TecHunter

 *VirtuaSpy wrote:*   

> I do have one issue. In xmms (perhaps other apps, but since xmms is running more than other apps...) if I am listening to mp3s, and the disk usage goes up significantly, like when I am compiling, xmms will just stop where it's at. It won't freeze, but I have to hit play and the file will start over and start playing again. It has done this multiple times now and never did this under plain alsa without the .asoundrc file with the dmixer specification.
> 
> I tried downgrading to the latest "x86" instead of the ~x86 xmms I was using, same thing.
> 
> Has anyone else experienced this? Could I maybe try to run xmms from a console and see if it tells me anything? I'll try that and post here if it does.
> ...

 hey, i have the same problem with you. hope your advice will help me.

----------

## monicajae

is there a newer way to get the newer mplayer to work with this as well?  so far i only have gaim and xmms.

----------

## codergeek42

I read somewhere that the in-CVS ALSA driver automagically uses dmix on most cards that don't have hardware-mixing (such as my onboard via82xx). Is this true? Can someone verify this?

----------

## bushwakko

bump. would be great if someone could verify. 

Also I'm having problems with this dmix setup and using skype via arts.. sound is extremely choppy and I can't get mic to work.

----------

## Arainach

dmix and arts conflict.  If you're going to use arts, disable arts.

----------

## bushwakko

disable arts to use arts?

----------

## PrakashP

 *Quote:*   

> 
> 
> dmix and arts conflict
> 
> 

 

No, dmix is redundant, but (newer) arts should work with dmix.

----------

## bushwakko

I have problems with sound in quake3 too. I get /dev/dsp busy. Even though nothing is playing sound atm.

----------

## bushwakko

when starting quake2 and quake3 I get:

------- sound initialization -------

/dev/dsp: Device or resource busy

Could not open /dev/dsp

------------------------------------

shouldn't oss work with alsa and dmix too?

when using aoss quake3 it just hangs at bootup

----------

## bushwakko

argghh, bump!

----------

## hicksboson

ok, it's working fine so far, but how to prevent xine  from taking over sound volume controll for the whole system. Everything else is working fine and I got good sound quality in all apps. And I can handle sound volume independent in all other apps (xmms, alsaplayer, gaim), only when I change volume in Xine it's like handling the master volume.

I'm running gentoo-sources 2.6.11, xine 0.9.23, and alsa stuff just updated today.  

I compiled all those apps with alsa-support (where available) 

I tried out a lot of settings for .asoundrc (mostly from this thread) as well as no .asoundrc at all. 

I've tried both kernel modules (the builtin and media-sound/alsa-driver).

I've also tried differnt configurations for xine

Now I've got no more ideas, where to look. :Confused: 

Any suggestions?

Thanks

----------

## b0fh

I created my /etc/asound.conf as in the first post. Dmix works for alsa-programs, but I don't get a /dev/dsp0 for oss-emulation, although I emerged also-oss... Do I have to mknod it somehow?

----------

## codergeek42

My sound card is an on-board  VT82C686 AC97 Audio Controller (rev 50) (via82xx) with an ICEnsemble 1232 chip, and the following works for me nicely (I can play music in Rhythmbox and hear the sound effects of bzflag and gaim all at the same time):

```

pcm.via82xx {

    type hw

    card 0

}

ctl.via82xx {

    type hw

    card 0

}

pcm.dmixer {

    type dmix

    ipc_key 1024

    slave {

        pcm "hw:0,0"

        period_time 0

        period_size 2048

        buffer_size 6144

 rate 44100

    }

    bindings {

        0 0

        1 1

    }

}

pcm.dsp0 {

    type plug

    slave.pcm "dmixer"

}

pcm.!default {

        type plug

        slave.pcm "dmixer"

}

pcm.default {

 type plug

 slave.pcm "dmixer"

}

ctl.mixer0 {

    type hw

    card 0

}
```

Maybe that will help someone. I spen about 10 minutes trying to tweak the buffer_size until it was smooth (anything else would give slight timing and speef errors with mplayer and other things).

----------

## Xer0

I don't think this has been mentioned:

If you emerge alsa-drivers, by default it does oss emulation by modules (snd-pcm-oss, etc...). These appear to be used even when you run a program using aoss. You can tell this is happening to you if you can run an oss program without aoss. As such, any dmix trickery in asound.conf is bypassed, and you won't be able to play multiple streams from oss programs. The solution to this is to disable kernel level OSS emulation. I'm not sure how to do this with alsa-driver (USE=-oss?), but if you are using the drivers available in the kernel (I'm using 2.6), you can just unselect the two OSS options.

The next step is to get the latest version version of aoss from CVS, as it supposedly fixes the buggy fopen() emulation (read: Should work with quake 3!).

EDIT: Damn out of date wikis, the fopen() patch has been in since 1.0.6 - and q3 still doesn't work  :Sad:  I get sound, but it's really scratchy, and in game it is just random noise. Hopefully adjusting my buffer or rate will fix things up. Anyone have any other ideas?

Hope this helps someone, had me stumped for a while. Read more at the ALSA Wiki

- Xavier

----------

## jamapii

in /etc/mplayer.conf,

ao=alsa9:default # doesn't seem to work anymore, but

ao=alsa:mmap:device=dmix # works for me.

----------

## Ard Righ

Do you need to configure DMIX to get Teamspeak working in Linux ?

 I know there is a 'howto' guide which is supposed to get Teamspeak working in Gentoo, but it didn't really work for me. And I'm not too keen on having to rm anything in /dev just to get a software app to behave correctly.

 Teamspeak requires sound capture for the mic to work. It only supports OSS. 

 If I could get this DMIX to enable me to use Teamspeak with alsa-oss, and play games like America's Army in Linux, life would be perfect. Any help would be appreciated.

----------

## codergeek42

To those still having trouble you may want to let ALSA automagically configure things for you. From what I can tell, ALSA does built-in software-mixing as of 1.0.9-rc2. So far it seems to work well on my onboard VIA chip (using the in-kernel via82xx driver with Linux 2.6.12-rc3)

----------

## yaneurabeya

Hmmmm... that's good news. Finally I might be able to properly soundmix my TB card  :Smile: .

----------

## yaneurabeya

Holy mackerel. It works!!!! *tips his hat to the ALSA folks for the good work*

----------

## Sheepdogj15

 *codergeek42 wrote:*   

> To those still having trouble you may want to let ALSA automagically configure things for you. From what I can tell, ALSA does built-in software-mixing as of 1.0.9-rc2. So far it seems to work well on my onboard VIA chip (using the in-kernel via82xx driver with Linux 2.6.12-rc3)

 

hmm... sorry to bump up an old thread but i'm curious... how would i configure this, then, using  inte8x0 hardware? (i installed alsa-driver rc3, as the real 1.0.9 didn't work for me)

[edit] Cancel that. I got it working with XMMS (as verified by the fact i can have XMMS playing and KDE sounds at the same time). however, i can't get mplayer to cooperate.  :Confused: 

----------

## Sheepdogj15

 *Sheepdogj15 wrote:*   

>  however, i can't get mplayer to cooperate. 

 

if someone can help, this is the end of my output from mplayer:

```
...

Cache fill:  0.00% (0 bytes)    Audio file detected.

==========================================================================

Opening audio decoder: [mp3lib] MPEG layer-2, layer-3

AUDIO: 24000 Hz, 2 ch, s16le, 24.0 kbit/3.12% (ratio: 3000->96000)

Selected audio codec: [mp3] afm:mp3lib (mp3lib MPEG layer-2, layer-3)

==========================================================================

Checking audio filter chain for 24000Hz/2ch/s16le -> 24000Hz/2ch/s16le...

AF_pre: 24000Hz/2ch/s16le

alsa-init: 1 soundcard found, using: dmix

ALSA lib pcm.c:6449:(snd_pcm_slave_conf) unknown format S16

alsa-init: playback open error: Invalid argument

Could not open/initialize audio device -> no sound.

Audio: no sound

Video: no video
```

i tried googling that error message, but no luck. i used the "ao=alsa:mmap:device=dmix" option as mentioned above.

----------

## Sheepdogj15

cancel that again!  :Very Happy:  w00t

after monkeying with it for about a couple of hours, i figured out a workaround. i simply had mplayer run output through esd instead of straight to alsa, and i configured esd (per instructions on the wiki page) to mix through dmix. 

this is sweet ...  now i'm listening to an audio stream in mplayer, P.O.D. on XMMS, and am minimizing/maximizing this window (well, not right now but you get the idea) to trigger KDE sounds. this is great!  :Smile: 

----------

## sirlark

Hi

I'm using kernel 2.6.12-r6, gentoo sources, with ALSA compiled in, using only the driver for my AC'97. All my programs that want to play sound can. I would like to get hardware mixing working, but I must admit that I am very confused, because most of this howto seems to deal with 2.4 kernels and using external modules for ALSA. So I was wondering if anyone could answer a few questions for me...

What packages do I need to install if I use 2.6?

Do any of these packages require me to remove ALSA components from my kernel?

If so which components?

How do I set up my /etc/asoundrc file correctly?

How do I set up various apps, specifically XMMS, madplay, GAIM, mplayer, ogg123, and firefox/thunderbird?

Thanks in advance

----------

## syadnom

you wont get hardware mixing, but software mixing is working.

just delete all the /etc/asound.conf and config files and install the most rescent alsa.  i use the release in the nitro5 kernel. it works nicely and gives a nice performance boost on the desktop as well.  you get full software mixing this way

----------

## fatboyjim

I've tried the instructions in the wiki and also in https://forums.gentoo.org/viewtopic-t-266647.html (as I'm on a Shuttle SN95G5 - intel8x0)

No joy here. Using latest everything (amd64)

I noticed I've got the esd USE flag set. Reckon that's interfering with anything?

Problem is basically, if amaroK is open (using gstreamer->alsasink) I can't get most other things to work (UT2004 etc) all grumbling with /dev/dsp: Device or resource busy

Any ideas? Thanks _so_ much  :Wink: 

Jim

----------

## syadnom

what kernel are you running?

----------

## fatboyjim

2.6.12-gentoo-r6

----------

## syadnom

have you tried nitro5?  it hsa the newest alsa beta with sw mixing on by default.  i works great for me  with nforce and ac97 audio.

----------

## sirlark

Hi I tried nitro-5 but the in kernel intel pro wireless 2200 drivers don't seem to work, and the external ones won't compile against nitro-5, so I went back to 2.6.12-gentoo-r6, with ALSA removed from the kernel. I emerged asla-drivers, alsa-libs, alsa-oss, alsa-utils, and alsa-tools. Then I ran alsaconf, and viola! Now I have sound mixing working in everything except firefox (flash), which still locks the device. No config file alteration necessary. I had no /etc/asound.conf or .asoundrc before doing the emerges.

----------

## cYmen

did anybody get that aoss stuff working with skype?

it always seems to hijack the complete audio device and that s pissing me off...

----------

## givertex

Thanks for this, it helped me alot.  One problem I have is when i reboot I have to have run 

```
alsaconf
```

to have the sound work correctly.

Here is a lsmod:

```
vertex@localhost ~ $ lsmod

Module                  Size  Used by

ipv6                  250784  6 

ohci_hcd               21284  0 

analog                 11808  0 

ns558                   5636  0 

parport_pc             39940  0 

parport                35976  1 parport_pc

floppy                 59188  0 

pcspkr                  3788  0 

rtc                     9364  0 

i2c_viapro              8208  0 

i2c_core               22400  1 i2c_viapro

ehci_hcd               31816  0 

at76c503_i3861         32740  0 

at76c503               90752  1 at76c503_i3861

at76_usbdfu             6020  1 at76c503

eth1394                20904  0 

uhci_hcd               32144  0 

via_rhine              24068  0 

mii                     5376  1 via_rhine

ohci1394               34452  0 

ieee1394              100792  2 eth1394,ohci1394

via_agp                 9632  1 

usbcore               115996  7 ohci_hcd,ehci_hcd,at76c503_i3861,at76c503,at76_usbdfu,uhci_hcd

snd_ens1371            24640  4 

gameport               16840  4 analog,ns558,snd_ens1371

snd_rawmidi            23136  1 snd_ens1371

snd_ac97_codec         74680  1 snd_ens1371

snd_pcm                88708  3 snd_ens1371,snd_ac97_codec

snd_timer              25252  2 snd_pcm

snd                    49492  11 snd_ens1371,snd_rawmidi,snd_ac97_codec,snd_pcm,snd_timer

soundcore              10240  1 snd

snd_page_alloc          9828  1 snd_pcm

nvidia               3711848  12 

agpgart                35440  2 via_agp,nvidia

```

I'm running a 2.6.12-r6 kernel with the gentoo sources. 

Thanks

-Bryon

----------

## JloR

Does anyone have a trick to make Skype work?

I'm _not_ using the kernel supplied drivers for ALSA, I'm using 

```

[ebuild   R   ] media-sound/alsa-driver-1.0.10_rc3  -doc +oss 2,140 kB 

[ebuild   R   ] media-libs/alsa-oss-1.0.10_rc3  0 kB 

[ebuild   R   ] media-libs/alsa-lib-1.0.10_rc3  -doc -jack 689 kB 

```

So that should provide OSS support in ALSA..

Also, my /etc/asound.conf currently looks like this:

```

pcm.dsp0 {

type plug

slave.pcm "dmix"

}

ctl.mixer0 {

type hw

card 0

}

```

Modules are loaded:

```

Gabriel ~ # lsmod

Module                  Size  Used by

snd_pcm_oss            47904  - 

snd_mixer_oss          16712  - 

snd_seq_oss            34240  - 

snd_seq_midi_event      5640  - 

snd_seq                51536  - 

snd_seq_device          7060  - 

snd_intel8x0           29764  - 

snd_ac97_codec         93608  - 

snd_ac97_bus            1672  - 

snd_pcm                81796  - 

snd_timer              21036  - 

snd                    48036  - 

snd_page_alloc          8336  - 

```

And yet, when I start skype using aoss skype I get this:

```

No installed artsshell or esd found

Assuming you're running no sound daemon

Starting skype without a sound wrapper

==========================================

```

And sound doesn't work.. Can't hear when contacts are calling me, I can't hear when people are writing me... In short, can't really use Skype for anything but textmessaging..

There MUST be a way to fix this - I honestly doesn't see why aoss doesn't work.

----------

## trueshanti

Hello 

can someone please post a matching .asoundrc .. paleeez

my soundcard is a hda-intel ( model=full_dig ) that comes with a shuttle-ST20G5 running amd64 (!) 

.. soon the hard times for shuttle-user will be over - i can feel it  :Smile: 

everything runs fine but my SKYPE on kde (artsd !:-p ) 

tnx

_

.. and please . give us alsa-support in skype

----------

## Termulator

I have a via82xx chip and this asound.conf works wonders for me, all programs in whatever manner can aquire a sound device.

```

#--Begin asound.conf

pcm.!default {

        type asym

        playback.pcm {

                type plug

                slave { pcm "dmix" }

        }

        capture.pcm {

                type plug

                slave { pcm "dsnoop" }

        }

}

#--end asound.conf

```

Also, these lines in my local.start fixed up the Q3 based games last time I used them.

```

#--Begin /etc/conf.d/local.start

#fix quake3 based games

echo "q3demo.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss

echo "quake3.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss

echo "wolf.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss

echo "wolfsp.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss

echo "wolfmp.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss

echo "sof-bin 0 0 direct" > /proc/asound/card0/pcm0p/oss

#--end local.start

```

I pulled this stuff from various places that I don't recall, except that the Q3 stuff was based on some things in the Gentoo Wiki. Sorry I can't be more help.

Jesse Ruffin

----------

## Aitikin

Excellent thread, helped me finally get dmix working with spdif, only problem now is I still can't get gaim to work with em, anybody have some advice?

(EDIT: Should mention I'm using the gaim betas right now, about emerge the latest one)

----------

