You are not logged in.

#1 2011-05-25 07:15:33

Corubba
Member
From: Germany
Registered: 2010-11-14
Posts: 86

[ALSA] dmix not working probably

Hey guys,

i'm using ALSA and PulseAudio for quit a long time. since some days PulseAudio is messing up my mixer settings (set the PCM to 100 and set itself speakers down by 10%) i decided to get rid of it and using the dmix-Plugin of ALSA to get sound from multiple apps, cause that's the only thing i needed Pulse for. So i removed Pulse und deleted my ALSA-configs and reinstalled alsa, setting it up with the wiki article for upmixing to surround40. pacman say alsa-utils is v1.0.24.2-1 which should be greater than the mentioned v1.0.9rc2 so dmix should be enabled by default.

The weird thing is, upmixing works. And dmix also ... somehow. Alsa don't say the device is blocked, there is simple no sound from it. Since i close the "first" audio-using-app, and after a little "click" of my speakers i can use the sound again.
And between i have the problem that MPlayer seems not to work probably with alsa, if i start any video there is sound, but with bad quality and a extrem high tone over it.

My /etc/asound.conf

pcm.upmix40{
    type upmix
    slave.pcm "surround40"
    delay 15
    channels 4
}

pcm.!default "plug:upmix40"

defaults.pcm.rate_converter "samplerate_best"

my ~/.asoundrc

pcm.dsp0 {
    type plug
    slave.pcm "dmix"
}

the output of `aplay -L`

[marko@machine ~]$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
front:CARD=SB,DEV=0
    HDA ATI SB, VT1708B Analog
    Front speakers
surround40:CARD=SB,DEV=0
    HDA ATI SB, VT1708B Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=SB,DEV=0
    HDA ATI SB, VT1708B Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SB,DEV=0
    HDA ATI SB, VT1708B Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SB,DEV=0
    HDA ATI SB, VT1708B Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SB,DEV=0
    HDA ATI SB, VT1708B Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=SB,DEV=0
    HDA ATI SB, VT1708B Digital
    IEC958 (S/PDIF) Digital Audio Output

and finally the console output of mplayer while exaile is "using" the sound

[marko@machine ~]$ mplayer Desktop/august_eustia_pm/au/promo.mpg 
MPlayer SVN-r32792-4.6.0 (C) 2000-2011 MPlayer Team
161 Audio- & 351 Videocodecs

Spiele Desktop/august_eustia_pm/au/promo.mpg.
Fülle Zwischenpuffer:  0.00% (0 Bytes)   

MPEG-PS-Dateiformat erkannt!
VIDEO:  MPEG1  1280x720  (aspect 1)  30.000 fps    0.0 kbps ( 0.0 kbyte/s)
Load subtitles in Desktop/august_eustia_pm/au/
==========================================================================
Öffne Videodecoder: [ffmpeg] FFmpeg's libavcodec codec family
Ausgewählter Videocodec: [ffmpeg1] vfm: ffmpeg (FFmpeg MPEG-1)
==========================================================================
==========================================================================
Öffne Audiodecoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24000->176400)
Ausgewählter Audiocodec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Starte Wiedergabe...
Film-Aspekt ist 1.78:1 - Vorskalierung zur Korrektur der Seitenverhältnisse.
VO: [vdpau] 1280x720 => 1280x720 Planar YV12 
A:   2.9 V:   2.9 A-V:  0.012 ct: -0.038  78/ 78 11%  6%  0.5% 0 0 96% 

Beenden... (Ende)

Soo, any suggestions or Solutions? Thanks in advance.

Greetz Corubba

Offline

#2 2011-05-25 18:37:01

Corubba
Member
From: Germany
Registered: 2010-11-14
Posts: 86

Re: [ALSA] dmix not working probably

OK, the Problem with Mplayer was a fail of gcc4.6 to build the mp3lib. Temporary downgrade to gcc4.5, recompile Mplayer and it works like it should. Except that i still can't watch 2 movies at the same time with audio from both. Or play a Flash game and listening music. I tried the hole day to get it working, no luck.

No one has any idea?

Greetz Corubba

Offline

#3 2011-05-25 19:00:52

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [ALSA] dmix not working probably

I'm using mplaye2 from [community] with alsa and I can listen to many things playing at once. No /etc/asound.conf, no ~/.asoundrc.

Offline

#4 2011-05-25 20:49:36

Corubba
Member
From: Germany
Registered: 2010-11-14
Posts: 86

Re: [ALSA] dmix not working probably

Its not like only parallel mplayer don't works, no kind of sound-using app can output at the same time. I tried with mplayer, vlc, firefox, exaile and speaker-test. always the same. They dont give any error, but its neither working.

and btw: i dont like mplayer2 cause i miss the minimalistic gui with embanded video.

Offline

#5 2011-05-26 04:37:10

Svenstaro
Administrator
From: Germany
Registered: 2008-11-19
Posts: 388

Re: [ALSA] dmix not working probably

First of all: Yes, the device blocks. There is no sound from it because it has some mechanism to still run without sound. If you used a dumber application or forced it to do sound, it will fail.

Now, do multiple sources work without any kind of additional configuration? Delete/move all your alsa config files and /etc/rc.d/alsa-force restart.

Offline

#6 2011-05-26 15:27:50

Corubba
Member
From: Germany
Registered: 2010-11-14
Posts: 86

Re: [ALSA] dmix not working probably

i moved my /etc/asound.conf and ~/.asoundrc and run the command. it throws some failures but after it multiple sources works. so its something wrong with the upmix setup.

[marko@machine ~]$ sudo /etc/rc.d/alsa force-restart
Passwort: 
:: Trying to TERM or KILL processes that are blocking ALSA...            [BUSY]
Specified filename /dev/snd/by-path: does not exist.
Specified filename pci-0000:00:14.2 does not exist.
Specified filename /dev/snd/by-path: does not exist.
Specified filename pci-0000:00:14.2 does not exist.
                                                                         [DONE] 
:: Stopping ALSA                                                         [DONE] 
:: Restoring ALSA Levels                                                 [DONE] 
[marko@machine ~]$ 

Offline

#7 2011-06-08 22:16:35

bucaneer
Member
Registered: 2011-06-08
Posts: 21

Re: [ALSA] dmix not working probably

I had the same problem and managed to fix it by manually setting up dmix based on examples here. My working configuration: /etc/asound.conf is empty, ~/.asoundrc:

pcm.dmix6 {
     type dmix
        ipc_key 1024
        ipc_key_add_uid false
        ipc_perm 0660
         slave {
                pcm hw:0
                rate 48000
                channels 6
                period_time 0
                period_size 1024
                buffer_time 0
                buffer_size 5120
        }
}

pcm.upmix51 {
    type upmix
    slave.pcm "dmix6"
    delay 15
    channels 6
}

pcm.!default "plug:upmix51"

In your case it should just be a matter of changing the number of channels. Don't forget to restart alsa daemon and all sound using applications before testing.

Offline

#8 2011-06-09 06:30:02

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [ALSA] dmix not working probably

bucaneer wrote:

period_size 1024
buffer_size 5120

That's a bizarre combination. I think you want period_size 512, so that the buffer_size is exactly 10 times larger.

Offline

#9 2011-06-09 10:32:33

Svenstaro
Administrator
From: Germany
Registered: 2008-11-19
Posts: 388

Re: [ALSA] dmix not working probably

bucaneer wrote:

I had the same problem and managed to fix it by manually setting up dmix based on examples here. My working configuration: /etc/asound.conf is empty, ~/.asoundrc:

pcm.dmix6 {
     type dmix
        ipc_key 1024
        ipc_key_add_uid false
        ipc_perm 0660
         slave {
                pcm hw:0
                rate 48000
                channels 6
                period_time 0
                period_size 1024
                buffer_time 0
                buffer_size 5120
        }
}

pcm.upmix51 {
    type upmix
    slave.pcm "dmix6"
    delay 15
    channels 6
}

pcm.!default "plug:upmix51"

In your case it should just be a matter of changing the number of channels. Don't forget to restart alsa daemon and all sound using applications before testing.

Could you put this info into https://wiki.archlinux.org/index.php/Ad … .28dmix.29 ? I think it would be fairly helpful for some people.

Offline

#10 2011-06-11 17:37:50

Corubba
Member
From: Germany
Registered: 2010-11-14
Posts: 86

Re: [ALSA] dmix not working probably

I running alsa unconfigured at the moment and it seems that all working fine O_o sound from all 4 speakers. But i gave bucaneer's config a try with changing it to my 4channel setup, it doesn't work for me. First my system dont like the period_* and buffer_* setting, Mplayer gives me stocking play. So i comment them out. Sound works so far with it. But still 2 apps can't use sound at once.

so far my .asoundrc

pcm.dmix4 {
     type dmix
        ipc_key 1024
        ipc_key_add_uid false
        ipc_perm 0660
         slave {
                pcm hw:0
                rate 48000
                channels 4
#                period_time 0
#                period_size 512
#                buffer_time 0
#                buffer_size 1024
        }
}

pcm.upmix40 {
    type upmix
    slave.pcm "dmix4"
    delay 15
    channels 4
}

pcm.!default "plug:upmix40"

MPlayer2 gives me this on console:

Öffne Audiodecoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Ausgewählter Audiocodec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
[AO_ALSA] alsa-lib: pcm_hw.c:1293:(snd_pcm_hw_open) open '/dev/snd/pcmC0D0p' failed (-22): Invalid argument
[AO_ALSA] alsa-lib: pcm_dmix.c:1068:(snd_pcm_dmix_open) unable to open slave
[AO_ALSA] Fehler beim Öffnen der Wiedergabe: Invalid argument
Konnte Audiotreiber 'alsa' nicht initialisieren
Kann Audiotreiber/Soundkarte nicht öffnen/initialisieren -> kein Ton
Audio: kein Ton!
Starte Wiedergabe...

while Mplayer1's starting go get periodly skips. So im going back to the empty config for now.

Greetz Corubba

Offline

#11 2011-06-11 18:11:42

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [ALSA] dmix not working probably

Corubba wrote:

my system dont like the period_* and buffer_* setting

I think you *should* define them, otherwise the first app might set them to wacky values that the second app can't work with.

You can see the parameters, while playing audio, with:

cat /proc/asound/card0/pcm0p/sub0/hw_params

See my ~/.asoundrc for ideas.

Offline

#12 2011-09-23 19:29:42

krakorar
Member
Registered: 2011-09-23
Posts: 1

Re: [ALSA] dmix not working probably

I have never had dmix fail for me on an HDMI output.  However, I have never been successful getting it to work with an analog output.  Same darn asound.conf.  I just change "hw:0,0" (analog) to "hw:0,3" (HDMI), restart ALSA and dmix works.

# MessageNet Systems ALSA sound configuration file
# Allowing multiple playback and capture

pcm.!default {
    type plug
    slave.pcm "duplex"
}
pcm.nullpcm {
    type null
}
pcm.duplex {
    type asym
    playback.pcm "dmixer"
    capture.pcm "analog_input"
}
pcm.dmixer {
    type dmix
    ipc_key 1024
    ipc_perm 0666
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 8192
    }
    bindings {
       0 0
       1 1
    }
}
pcm.analog_input
{
    type dsnoop
    ipc_key 2048
    ipc_perm 0666
    slave{
       pcm "hw:0,0"
    }
}
pcm.dsp0 {
    type plug
    slave.pcm "dmixer"
}
ctl.mixer0 {
    type hw
    card 0
}

Offline

#13 2011-09-23 19:32:47

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [ALSA] dmix not working probably

krakorar, your dmixer doesn't work with more than 2 speakers.

Offline

Board footer

Powered by FluxBB